Ralph Lange has proposed merging lp:~epics-core/epics-base/get-cpus into lp:epics-base.
Requested reviews:
EPICS Core Developers (epics-core)
For more details, see:
https://code.launchpad.net/~epics-core/epics-base/get-cpus/+merge/155967
Add int epicsThreadGetCPUs() to the epicsThread API.
epicsThreadGetCPUs() returns the number of logical CPUs that are available for the IOC. On systems that use Hyper-Threading, this number may be up to twice the number of physical cores.
The Posix and WIN32 implementations are returning the number of CPUs available for the process, which may be limited by the system.
For the time being, vxWorks just returns 1.
Only tested for Linux. The implementations for RTEMS, vxWorks and WIN32 need testing, please...
--
https://code.launchpad.net/~epics-core/epics-base/get-cpus/+merge/155967
Your team EPICS Core Developers is requested to review the proposed merge of lp:~epics-core/epics-base/get-cpus into lp:epics-base.
=== modified file 'src/libCom/osi/epicsThread.h'
--- src/libCom/osi/epicsThread.h 2012-07-06 21:33:10 +0000
+++ src/libCom/osi/epicsThread.h 2013-03-28 14:15:26 +0000
@@ -3,7 +3,7 @@
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
-* Copyright (c) 2012 ITER Organization
+* Copyright (c) 2013 ITER Organization.
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
@@ -85,6 +85,7 @@
epicsShareFunc double epicsShareAPI epicsThreadSleepQuantum(void);
epicsShareFunc epicsThreadId epicsShareAPI epicsThreadGetIdSelf(void);
epicsShareFunc epicsThreadId epicsShareAPI epicsThreadGetId(const char *name);
+epicsShareFunc int epicsThreadGetCPUs(void);
epicsShareFunc const char * epicsShareAPI epicsThreadGetNameSelf(void);
=== modified file 'src/libCom/osi/os/RTEMS/osdThread.c'
--- src/libCom/osi/os/RTEMS/osdThread.c 2012-07-31 19:04:38 +0000
+++ src/libCom/osi/os/RTEMS/osdThread.c 2013-03-28 14:15:26 +0000
@@ -718,3 +718,12 @@
return 1.0 / rtemsTicksPerSecond_double;
}
+
+epicsShareFunc int epicsThreadGetCPUs(void)
+{
+#if defined(RTEMS_SMP)
+ return rtems_smp_get_number_of_processors();
+#else
+ return 1;
+#endif
+}
=== modified file 'src/libCom/osi/os/WIN32/osdThread.c'
--- src/libCom/osi/os/WIN32/osdThread.c 2012-07-31 19:04:38 +0000
+++ src/libCom/osi/os/WIN32/osdThread.c 2013-03-28 14:15:26 +0000
@@ -1105,6 +1105,14 @@
return ( void * ) TlsGetValue ( pPvt->key );
}
+/*
+ * epicsThreadGetCPUs ()
+ */
+epicsShareFunc int epicsThreadGetCPUs ( void )
+{
+ return atoi(getenv("NUMBER_OF_PROCESSORS"));
+}
+
#ifdef TEST_CODES
void testPriorityMapping ()
{
=== modified file 'src/libCom/osi/os/posix/osdThread.c'
--- src/libCom/osi/os/posix/osdThread.c 2012-09-20 19:55:32 +0000
+++ src/libCom/osi/os/posix/osdThread.c 2013-03-28 14:15:26 +0000
@@ -3,7 +3,7 @@
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
-* Copyright (c) 2012 ITER Organization
+* Copyright (c) 2013 ITER Organization.
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
@@ -873,3 +873,7 @@
return 1.0 / hz;
}
+epicsShareFunc int epicsThreadGetCPUs(void)
+{
+ return sysconf(_SC_NPROCESSORS_ONLN);
+}
=== modified file 'src/libCom/osi/os/vxWorks/osdThread.c'
--- src/libCom/osi/os/vxWorks/osdThread.c 2012-07-31 19:04:38 +0000
+++ src/libCom/osi/os/vxWorks/osdThread.c 2013-03-28 14:15:26 +0000
@@ -449,3 +449,8 @@
double HZ = sysClkRateGet ();
return 1.0 / HZ;
}
+
+epicsShareFunc int epicsThreadGetCPUs(void)
+{
+ return 1;
+}
- Replies:
- Re: [Merge] lp:~epics-core/epics-base/get-cpus into lp:epics-base mdavidsaver
- Re: [Merge] lp:~epics-core/epics-base/get-cpus into lp:epics-base Andrew Johnson
- Navigate by Date:
- Prev:
PMAC Gaudiello, Phillip
- Next:
Re: [Merge] lp:~epics-core/epics-base/get-cpus into lp:epics-base mdavidsaver
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
<2013>
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
PMAC Gaudiello, Phillip
- Next:
Re: [Merge] lp:~epics-core/epics-base/get-cpus into lp:epics-base mdavidsaver
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
<2013>
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|