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 2020/11/02 03:33:17 UTC

[incubator-nuttx-apps] branch master updated: Add task name recording support for trace command

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 e6e4355  Add task name recording support for trace command
e6e4355 is described below

commit e6e435572b0f8e38e7d9af651b51d5109472c5e1
Author: Nakamura, Yuuichi <Yu...@sony.com>
AuthorDate: Wed Oct 28 10:48:48 2020 +0900

    Add task name recording support for trace command
---
 system/trace/trace_dump.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/system/trace/trace_dump.c b/system/trace/trace_dump.c
index 380b139..677fb3e 100644
--- a/system/trace/trace_dump.c
+++ b/system/trace/trace_dump.c
@@ -91,6 +91,7 @@ struct trace_dump_context_s
 {
   struct trace_dump_cpu_context_s cpu[NCPUS];
   FAR struct trace_dump_task_context_s *task;
+  int notefd;
 };
 
 /****************************************************************************
@@ -125,12 +126,15 @@ static void note_ioctl(int cmd, unsigned long arg)
  * Name: trace_dump_init_context
  ****************************************************************************/
 
-static void trace_dump_init_context(FAR struct trace_dump_context_s *ctx)
+static void trace_dump_init_context(FAR struct trace_dump_context_s *ctx,
+                                   int fd)
 {
   int cpu;
 
   /* Initialize the trace dump context */
 
+  ctx->notefd = fd;
+
   for (cpu = 0; cpu < NCPUS; cpu++)
     {
       ctx->cpu[cpu].intr_nest = 0;
@@ -222,6 +226,20 @@ FAR static struct trace_dump_task_context_s *get_task_context(pid_t pid,
       (*tctxp)->pid = pid;
       (*tctxp)->syscall_nest = 0;
       (*tctxp)->name[0] = '\0';
+
+#if CONFIG_DRIVER_NOTERAM_TASKNAME_BUFSIZE > 0
+        {
+          struct noteram_get_taskname_s tnm;
+          int res;
+
+          tnm.pid = pid;
+          res = ioctl(ctx->notefd, NOTERAM_GETTASKNAME, (unsigned long)&tnm);
+          if (res == 0)
+            {
+              copy_task_name((*tctxp)->name, tnm.taskname);
+            }
+        }
+#endif
     }
 
   return *tctxp;
@@ -638,7 +656,7 @@ int trace_dump(FAR FILE *out)
       return ERROR;
     }
 
-  trace_dump_init_context(&ctx);
+  trace_dump_init_context(&ctx, fd);
 
   /* Read and output all notes */