You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/07/03 06:51:38 UTC

[incubator-nuttx-apps] branch master updated: system/critmon: add thread run time support

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new 192cbd8  system/critmon: add thread run time support
192cbd8 is described below

commit 192cbd8717addb37ee583336b8bc1ebe85fe2b01
Author: ligd <li...@xiaomi.com>
AuthorDate: Fri May 7 23:16:07 2021 +0800

    system/critmon: add thread run time support
    
    Change-Id: I272a38f29a9aad3267052ce94643bbd73c8753a9
    Signed-off-by: ligd <li...@xiaomi.com>
---
 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 6d1bf17..c3d60fa 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 <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)
+        {
+          *maxrun++ = '\0';
+
+          endptr = strchr(maxrun, '\n');
+          if (endptr != NULL)
+            {
+              *endptr = '\0';
+            }
+        }
+      else
         {
-          *endptr = '\0';
+          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 */