|
The RTUtility class contains functions for improving the realtime capabilities of a thread or of the whole system. More...
#include <armarx/control/ethercat/RTUtility.h>
Static Public Member Functions | |
static bool | elevateThreadPriority (int priority) |
Elevate the thread priority of the calling thread to the given priority. More... | |
static bool | pinThreadToCPU (unsigned int cpu) |
Pins the calling thread to the CPU with the given id. More... | |
static bool | startLowLatencyMode () |
Activate low latency mode of the system. More... | |
static bool | stopLowLatencyMode () |
Deactivate low latency mode of the system. More... | |
Static Public Attributes | |
static constexpr int | RT_THREAD_PRIORITY = 49 |
The thread priority for rt-threads. More... | |
The RTUtility class contains functions for improving the realtime capabilities of a thread or of the whole system.
Definition at line 14 of file RTUtility.h.
|
static |
Elevate the thread priority of the calling thread to the given priority.
The owning user of the calling thread must be allowed to set its priority to the given value. Each user has a maximum value it can sets its thread priorities to. This maximum value can be configured by editing the file /etc/security/limits.conf according to https://linux.die.net/man/5/limits.conf and setting the entry rtprio for the executing users. This function will only work if the operating system is build with a PRREMPT_RT patch (https://wiki.linuxfoundation.org/realtime/documentation/technical_details/start).
priority | the new priority of the calling thread |
Definition at line 17 of file RTUtility.cpp.
|
static |
Pins the calling thread to the CPU with the given id.
The thread can only be pinned to a cpu which actually exists on the system.
cpu | The id of the CPU the calling thread should be pinned to |
Definition at line 52 of file RTUtility.cpp.
|
static |
Activate low latency mode of the system.
If the file /dev/cpu_dma_latency exists, open it and write a zero into it. This will tell the power management system not to transition to a high cstate (in fact, the system acts like idle=poll). When the fd to /dev/cpu_dma_latency is closed, the behavior goes back to the system default.
Taken from https://wiki.linuxfoundation.org/realtime/documentation/howto/tools/rt-tests.
Definition at line 95 of file RTUtility.cpp.
|
static |
Deactivate low latency mode of the system.
Definition at line 131 of file RTUtility.cpp.
|
staticconstexpr |
The thread priority for rt-threads.
49 is the highest value that can be safely used, because PRREMPT_RT uses 50 for kernel tasklets and interrupt handler by default.
Definition at line 24 of file RTUtility.h.