Hello,
I am looking for a way to get the idle process percentage for all cores in pre-qualified RTEMS as return values to a function call, or similar. There seems to be some functionality in this direction in cpuuse.h, but it appears to write a stream of characters instead of simply providing the values directly.
Best regards,
Fredrik
gedare
January 21, 2026, 5:40pm
2
We have an issue to track this as a feature request:
Feel free to add more there as well about what would be useful to you.
I have this change for the EPICS iocStats module . The piece of code in the commit is:
/*
* See IEEE Std 1003.1-1988 (“POSIX.1”) for getrusage()
*/
static void cpu_ticks(double *total, double *idle) {
struct rusage stats;
double curActive;
double curIdle;
getrusage(RUSAGE_SELF, &stats);
curActive = (double)stats.ru_utime.tv_sec + stats.ru_utime.tv_usec / 1e6;
curIdle = (double)stats.ru_stime.tv_sec + stats.ru_stime.tv_usec / 1e6;
*idle = curIdle - oldIdleUsage;
*total = *idle + (curActive - oldActiveUsage);
oldActiveUsage = curActive;
oldIdleUsage = curIdle;
}
Thank you for your answers!
@kiwichris , I am afraid the getrusage() function call is unavailable in the pre-qualified version of RTEMS.
@gedare , thanks for directing me to that issue!