From 192cbd8717addb37ee583336b8bc1ebe85fe2b01 Mon Sep 17 00:00:00 2001 From: ligd Date: Fri, 7 May 2021 23:16:07 +0800 Subject: [PATCH] system/critmon: add thread run time support Change-Id: I272a38f29a9aad3267052ce94643bbd73c8753a9 Signed-off-by: ligd --- system/critmon/critmon.c | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/system/critmon/critmon.c b/system/critmon/critmon.c index 6d1bf17e5..c3d60fa79 100644 --- a/system/critmon/critmon.c +++ b/system/critmon/critmon.c @@ -118,6 +118,7 @@ static int critmon_process_directory(FAR struct dirent *entryp) FAR char *filepath; FAR char *maxpreemp; FAR char *maxcrit; + FAR char *maxrun; FAR char *endptr; FILE *stream; int errcode; @@ -217,8 +218,8 @@ static int critmon_process_directory(FAR struct dirent *entryp) goto errout_with_filepath; } - /* Input Format: X.XXXXXXXXX,X.XXXXXXXXX - * Output Format: X.XXXXXXXXX X.XXXXXXXXX NNNNN + /* Input Format: X.XXXXXXXXX,X.XXXXXXXXX,X.XXXXXXXXX + * Output Format: X.XXXXXXXXX X.XXXXXXXXX X.XXXXXXXXX NNNNN */ maxpreemp = g_critmon.line; @@ -227,22 +228,34 @@ static int critmon_process_directory(FAR struct dirent *entryp) if (maxcrit != NULL) { *maxcrit++ = '\0'; - endptr = strchr(maxcrit, '\n'); - if (endptr != NULL) + + maxrun = strchr(maxcrit, ','); + if (maxrun != NULL) { - *endptr = '\0'; + *maxrun++ = '\0'; + + endptr = strchr(maxrun, '\n'); + if (endptr != NULL) + { + *endptr = '\0'; + } + } + else + { + maxrun = "None"; } } else { maxcrit = "None"; + maxrun = "None"; } /* Finally, output the stack info that we gleaned from the procfs */ #if CONFIG_TASK_NAME_SIZE > 0 - printf("%11s %11s %5s %s\n", - maxpreemp, maxcrit, entryp->d_name, name); + printf("%11s %11s %11s %5s %s\n", + maxpreemp, maxcrit, maxrun, entryp->d_name, name); #else printf("%11s %11s %5s\n", maxpreemp, maxcrit, entryp->d_name); @@ -368,7 +381,8 @@ static void critmon_global_crit(void) /* Finally, output the stack info that we gleaned from the procfs */ - printf("%11s %11s --- CPU %s\n", maxpreemp, maxcrit, cpu); + printf("%11s %11s ----------- ----- CPU %s\n", + maxpreemp, maxcrit, cpu); } fclose(stream); @@ -391,11 +405,10 @@ static int critmon_list_once(void) /* Output a Header */ #if CONFIG_TASK_NAME_SIZE > 0 - printf("PRE-EMPTION CSECTION PID DESCRIPTION\n"); + printf("PRE-EMPTION CSECTION RUN PID DESCRIPTION\n"); #else - printf("PRE-EMPTION CSECTION PID\n"); + printf("PRE-EMPTION CSECTION RUN PID\n"); #endif - printf("MAX DISABLE MAX TIME\n"); /* Should global usage first */