Skip to content
Snippets Groups Projects
Commit 114b4ede authored by Christoph Pohl's avatar Christoph Pohl Committed by ARMAR-DE
Browse files

Fix CPU pinning in RTUtility and BusIO

Adjusted CPU pinning in the RTUtility and BusIO modules to correctly fix the CPU indices. Earlier, the threads were erroneously always pinned to CPU 0. This adjustment facilitates distributing the load among multiple cores, improving overall system performance. The BusIO's requestHandlerLoop thread is now pinned to CPU 1.
parent 26413976
No related branches found
No related tags found
1 merge request!47Changes for ARMAR-DE and ARMAR-7
......@@ -63,7 +63,7 @@ namespace armarx::control::ethercat
ARMARX_INFO << "Pinning thread #" << pid << " to CPU #" << cpu;
cpu_set_t mask;
CPU_ZERO(&mask);
CPU_SET(0, &mask);
CPU_SET(cpu, &mask);
int retval = sched_setaffinity(static_cast<int>(pid), sizeof(mask), &mask);
if (retval != 0)
{
......@@ -72,7 +72,7 @@ namespace armarx::control::ethercat
}
cpu_set_t mask2;
CPU_ZERO(&mask2);
CPU_SET(0, &mask2);
CPU_SET(cpu, &mask2);
sched_getaffinity(static_cast<int>(pid), sizeof(mask2), &mask2);
bool matches = CPU_EQUAL(&mask, &mask2);
if (matches)
......
......@@ -131,6 +131,7 @@ namespace armarx::control::ethercat
BusIO::requestHandlerLoop()
{
RTUtility::elevateThreadPriority(RTUtility::RT_THREAD_PRIORITY);
RTUtility::pinThreadToCPU(1);
while (requestHandlerThreadRunning.load() == true)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment