Commit 941f6dc6 authored by Christophe BLAESS's avatar Christophe BLAESS Committed by Jan Kiszka

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 <christophe.blaess@logilin.fr>
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent 23c88b34
...@@ -25,15 +25,15 @@ ...@@ -25,15 +25,15 @@
#define PROC_ACCT "/proc/xenomai/sched/acct" #define PROC_ACCT "/proc/xenomai/sched/acct"
#define PROC_PID "/proc/%d/cmdline" #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_FMT_2 ACCT_FMT_1 " %[^\n]"
#define ACCT_NFMT_1 9 #define ACCT_NFMT_1 10
#define ACCT_NFMT_2 10 #define ACCT_NFMT_2 11
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
char cmdpath[sizeof(PROC_PID) + 32], cmdbuf[BUFSIZ], acctbuf[BUFSIZ], name[64]; 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, unsigned long long account_period,
exectime_period, exectime_total, v; exectime_period, exectime_total, v;
unsigned int cpu, hr, min, msec, usec; unsigned int cpu, hr, min, msec, usec;
...@@ -49,12 +49,12 @@ int main(int argc, char *argv[]) ...@@ -49,12 +49,12 @@ int main(int argc, char *argv[])
while (fgets(acctbuf, sizeof(acctbuf), acctfp) != NULL) { while (fgets(acctbuf, sizeof(acctbuf), acctfp) != NULL) {
if (sscanf(acctbuf, ACCT_FMT_2, if (sscanf(acctbuf, ACCT_FMT_2,
&cpu, &pid, &ssw, &csw, &pf, &state, &cpu, &pid, &ssw, &csw, &xsc, &pf, &state,
&account_period, &exectime_period, &account_period, &exectime_period,
&exectime_total, name) != ACCT_NFMT_2) { &exectime_total, name) != ACCT_NFMT_2) {
strcpy(name, ""); strcpy(name, "");
if (sscanf(acctbuf, ACCT_FMT_1, if (sscanf(acctbuf, ACCT_FMT_1,
&cpu, &pid, &ssw, &csw, &pf, &state, &cpu, &pid, &ssw, &csw, &xsc, &pf, &state,
&account_period, &exectime_period, &account_period, &exectime_period,
&exectime_total) != ACCT_NFMT_1) { &exectime_total) != ACCT_NFMT_1) {
break; break;
......
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