Commit 85c93ba5 authored by Christophe BLAESS's avatar Christophe BLAESS Committed by Jan Kiszka
Browse files

Add the xsc field when rtps reads the sched/acct file.

The rtps tools reads the /proc/xenomai/sched/acct file but didn't
take the xsc field in account and failed to display some Xenomai
threads. This patch adds the missing field when rtps reads a line.
Signed-off-by: default avatarChristophe Blaess <>
Signed-off-by: Jan Kiszka's avatarJan Kiszka <>
parent 971bd06d
......@@ -25,15 +25,15 @@
#define PROC_ACCT "/proc/xenomai/sched/acct"
#define PROC_PID "/proc/%d/cmdline"
#define ACCT_FMT_1 "%u %d %lu %lu %lu %lx %Lu %Lu %Lu"
#define ACCT_FMT_1 "%u %d %lu %lu %lu %lu %lx %Lu %Lu %Lu"
#define ACCT_FMT_2 ACCT_FMT_1 " %[^\n]"
#define ACCT_NFMT_1 9
#define ACCT_NFMT_2 10
#define ACCT_NFMT_1 10
#define ACCT_NFMT_2 11
int main(int argc, char *argv[])
char cmdpath[sizeof(PROC_PID) + 32], cmdbuf[BUFSIZ], acctbuf[BUFSIZ], name[64];
unsigned long ssw, csw, pf, state, sec;
unsigned long ssw, csw, xsc, pf, state, sec;
unsigned long long account_period,
exectime_period, exectime_total, v;
unsigned int cpu, hr, min, msec, usec;
......@@ -49,12 +49,12 @@ int main(int argc, char *argv[])
while (fgets(acctbuf, sizeof(acctbuf), acctfp) != NULL) {
if (sscanf(acctbuf, ACCT_FMT_2,
&cpu, &pid, &ssw, &csw, &pf, &state,
&cpu, &pid, &ssw, &csw, &xsc, &pf, &state,
&account_period, &exectime_period,
&exectime_total, name) != ACCT_NFMT_2) {
strcpy(name, "");
if (sscanf(acctbuf, ACCT_FMT_1,
&cpu, &pid, &ssw, &csw, &pf, &state,
&cpu, &pid, &ssw, &csw, &xsc, &pf, &state,
&account_period, &exectime_period,
&exectime_total) != ACCT_NFMT_1) {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment