mirror of
https://github.com/apache/nuttx-apps.git
synced 2025-07-05 11:20:00 +08:00
Add task name recording support for trace command
This commit is contained in:
parent
fce08ec029
commit
e6e435572b
@ -91,6 +91,7 @@ struct trace_dump_context_s
|
|||||||
{
|
{
|
||||||
struct trace_dump_cpu_context_s cpu[NCPUS];
|
struct trace_dump_cpu_context_s cpu[NCPUS];
|
||||||
FAR struct trace_dump_task_context_s *task;
|
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
|
* 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;
|
int cpu;
|
||||||
|
|
||||||
/* Initialize the trace dump context */
|
/* Initialize the trace dump context */
|
||||||
|
|
||||||
|
ctx->notefd = fd;
|
||||||
|
|
||||||
for (cpu = 0; cpu < NCPUS; cpu++)
|
for (cpu = 0; cpu < NCPUS; cpu++)
|
||||||
{
|
{
|
||||||
ctx->cpu[cpu].intr_nest = 0;
|
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)->pid = pid;
|
||||||
(*tctxp)->syscall_nest = 0;
|
(*tctxp)->syscall_nest = 0;
|
||||||
(*tctxp)->name[0] = '\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;
|
return *tctxp;
|
||||||
@ -638,7 +656,7 @@ int trace_dump(FAR FILE *out)
|
|||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
trace_dump_init_context(&ctx);
|
trace_dump_init_context(&ctx, fd);
|
||||||
|
|
||||||
/* Read and output all notes */
|
/* Read and output all notes */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user