* [PATCH] Add the xsc field when rtps reads the sched/acct file.
@ 2018-10-29 6:22 Christophe BLAESS
2018-10-31 17:47 ` Jan Kiszka
0 siblings, 1 reply; 2+ messages in thread
From: Christophe BLAESS @ 2018-10-29 6:22 UTC (permalink / raw)
To: xenomai; +Cc: Christophe BLAESS
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: Christophe Blaess <christophe.blaess@logilin.fr>
---
utils/ps/rtps.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/utils/ps/rtps.c b/utils/ps/rtps.c
index bf5400e8d..6a07f110d 100644
--- a/utils/ps/rtps.c
+++ b/utils/ps/rtps.c
@@ -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) {
break;
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Add the xsc field when rtps reads the sched/acct file.
2018-10-29 6:22 [PATCH] Add the xsc field when rtps reads the sched/acct file Christophe BLAESS
@ 2018-10-31 17:47 ` Jan Kiszka
0 siblings, 0 replies; 2+ messages in thread
From: Jan Kiszka @ 2018-10-31 17:47 UTC (permalink / raw)
To: Christophe BLAESS, xenomai
On 29.10.18 07:22, Christophe BLAESS wrote:
> 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: Christophe Blaess <christophe.blaess@logilin.fr>
> ---
> utils/ps/rtps.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/utils/ps/rtps.c b/utils/ps/rtps.c
> index bf5400e8d..6a07f110d 100644
> --- a/utils/ps/rtps.c
> +++ b/utils/ps/rtps.c
> @@ -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) {
> break;
>
Thanks, applied.
Jan
--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-10-31 17:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-29 6:22 [PATCH] Add the xsc field when rtps reads the sched/acct file Christophe BLAESS
2018-10-31 17:47 ` Jan Kiszka
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.