system/critmon: add thread run time support

Change-Id: I272a38f29a9aad3267052ce94643bbd73c8753a9
Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
ligd 2021-05-07 23:16:07 +08:00 committed by Xiang Xiao
parent 4f68f43cc2
commit 192cbd8717

View File

@ -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 <name>
/* Input Format: X.XXXXXXXXX,X.XXXXXXXXX,X.XXXXXXXXX
* Output Format: X.XXXXXXXXX X.XXXXXXXXX X.XXXXXXXXX NNNNN <name>
*/
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 */