EPICS Multi-Core Utilities
1.2.2-SNAPSHOT
Real-Time Utilities for EPICS IOCs on Multi-Core Linux
|
Allow user-specified rules that modify real-time properties of EPICS threads. More...
Files | |
file | threadRules.c |
Rule-based modification of thread real-time properties. | |
Functions | |
epicsShareFunc void | mcoreThreadModify (epicsThreadId id, const char *policy, const char *priority, const char *cpus) |
iocShell: Modify a thread's real-time properties. | |
epicsShareFunc void | mcoreThreadRulesInit () |
Initialization routine. | |
epicsShareFunc long | mcoreThreadRuleAdd (const char *name, const char *policy, const char *priority, const char *cpus, const char *pattern) |
iocShell: Add or replace a thread rule. | |
epicsShareFunc void | mcoreThreadRuleDelete (const char *name) |
iocShell: Delete a thread rule. | |
epicsShareFunc void | mcoreThreadRulesShow (void) |
iocShell: Print a comprehensive list of the thread rules. | |
Allow user-specified rules that modify real-time properties of EPICS threads.
Implements a library that uses rules to modify real-time properties of EPICS threads:
SCHED_FIFO
, but SCHED_OTHER
and SCHED_RR
are also supported. This is achieved by creating a linked list of rules, which consist of a regular expression pattern and modification instructions. A hook function is added to the EPICS thread creation module. The hook is called from every thread as part of its creation, matches the regular expression patterns of all rules against the name of the newly created thread, and applies the modifications of all rules that match.
See man pages for pthread_setschedparam(3) and sched_setscheduler(2) for details on scheduling policy and priority, pthread_setaffinity_np(3) and sched_setaffinity(2) for details on CPU affinity.
/etc/rtrules
) and a user configuration file (default: $HOME/.rtrules
) to create the initial list of thread rules. /etc/rtgroups
file on RHEL-MRG. Each line has the format name:policy:priority:affinity:pattern
name | name of the rule |
policy | scheduling policy to set for the thread (first letter, not case sensitive), * = don't change |
priority | scheduling priority to set for the thread (a + or - sign adds to the current priority), * = don't change |
affinity | CPUs to set the thread's affinity to (use , and - to specify multiple CPUs and ranges, e.g. 0 ,3-5), * = don't change |
pattern | regular expression pattern to match thread names against, see man page for regex(7) for details |
#
(comments), and empty lines (containing only whitespace) are ignored.HOME
HOME
directory (default: /
) EPICS_MCORE_USERCONFIG
HOME
directory (default: .rtrules
) rtprio
entry in the pam limits module configuration. epicsThreadSetPriority()
to set its priority while running may override the priorities defined in the rules at any time. epicsShareFunc void mcoreThreadModify | ( | epicsThreadId | id, |
const char * | policy, | ||
const char * | priority, | ||
const char * | cpus | ||
) |
iocShell: Modify a thread's real-time properties.
id | EPICS thread id |
policy | scheduling policy to set (* = don't change) |
priority | scheduling priority (OSI) to set (a + or - sign adds to the current priority, * = don't change) |
cpus | cpuset specification to set (use , and - to specify multiple CPUs and ranges, * = don't change) |
mcoreThreadModify thread policy priority cpus
thread | thread name or id |
policy | scheduling policy to set (* = don't change) |
priority | scheduling priority (OSI) to set (a + or - sign adds to the current priority, * = don't change) |
cpus | cpuset specification to set (use , and - to specify multiple CPUs and ranges, * = don't change) |
Definition at line 289 of file threadRules.c.
epicsShareFunc long mcoreThreadRuleAdd | ( | const char * | name, |
const char * | policy, | ||
const char * | priority, | ||
const char * | cpus, | ||
const char * | pattern | ||
) |
iocShell: Add or replace a thread rule.
name | rule name (identifier) |
policy | scheduling policy to set (* = don't change) |
priority | scheduling priority (OSI) to set (a + or - sign adds to the current priority, * = don't change) |
cpus | cpuset specification to set (use , and - to specify multiple CPUs and ranges, * = don't change) |
pattern | regex(7) pattern to match thread names against |
mcoreThreadRuleAdd name policy priority cpus pattern
name | rule name (identifier) |
policy | scheduling policy to set (* = don't change) |
priority | scheduling priority (OSI) to set (a + or - sign adds to the current priority, * = don't change) |
cpus | cpuset specification to set (use , and - to specify multiple CPUs and ranges, * = don't change) |
pattern | regex(7) pattern to match thread names against |
Definition at line 109 of file threadRules.c.
epicsShareFunc void mcoreThreadRuleDelete | ( | const char * | name | ) |
iocShell: Delete a thread rule.
name | name (identifier) of the rule to delete |
mcoreThreadRuleDelete name
name | name (identifier) of the rule to delete |
Definition at line 140 of file threadRules.c.
epicsShareFunc void mcoreThreadRulesInit | ( | ) |
Initialization routine.
Must be called before using any of the other functions, which is done when registering the iocsh commands.
Definition at line 377 of file threadRules.c.
epicsShareFunc void mcoreThreadRulesShow | ( | void | ) |
iocShell: Print a comprehensive list of the thread rules.
Rule names are shortened to 16 characters.
mcoreThreadRulesShow
Definition at line 165 of file threadRules.c.