EPICS Multi-Core Utilities  1.2.3-SNAPSHOT
Real-Time Utilities for EPICS IOCs on Multi-Core Linux
utils.h
Go to the documentation of this file.
1 /********************************************/
12 #ifndef UTILS_H
13 #define UTILS_H
14 
15 #include <sched.h>
16 #include <unistd.h>
17 
18 #include <errlog.h>
19 #include <shareLib.h>
20 
21 // TODO: Use libCom call when get-cpus branch is merged
22 #define NO_OF_CPUS sysconf(_SC_NPROCESSORS_CONF)
23 
24 #define checkStatus(status,message) \
25 if((status)) {\
26  errlogPrintf("%s error %s\n", (message), strerror((status))); \
27 }
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
38 epicsShareExtern int cpuDigits;
39 
40 void strToCpuset(cpu_set_t *cpuset, const char *spec);
41 void cpusetToStr(char *set, size_t len, const cpu_set_t *cpuset);
42 const char *policyToStr(const int policy);
43 int strToPolicy(const char *string);
44 
45 #ifdef __cplusplus
46 }
47 #endif
48 
49 #endif // UTILS_H
const char * policyToStr(const int policy)
Convert scheduling policy to string.
Definition: utils.c:101
void cpusetToStr(char *set, size_t len, const cpu_set_t *cpuset)
Convert a cpuset into its string specification (e.g. "0,2-3").
Definition: utils.c:63
void strToCpuset(cpu_set_t *cpuset, const char *spec)
Convert a cpuset string specification (e.g. "0,2-3") to a cpuset.
Definition: utils.c:33
int strToPolicy(const char *string)
Convert string policy specification to policy.
Definition: utils.c:129
epicsShareExtern int cpuDigits
Number of digits needed for a single CPU spec.
Definition: utils.h:38