1
0
Fork 0
forked from nuttx/nuttx-update

note: make sched_note_start depend on INSTRUMENTATION_SWITCH

In some cases, we only need to use INSTRUMENTATION_DUMP to record custom data,
and we don't want the thread start and end information

Move this part to INSTRUMENTATION_SWTICH for recording

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
This commit is contained in:
yinshengkai 2024-10-08 23:23:21 +08:00 committed by Xiang Xiao
parent 453cde945f
commit a70175ea06
3 changed files with 17 additions and 21 deletions

View file

@ -203,7 +203,8 @@ FAR static struct note_driver_s *
NULL
};
#if CONFIG_DRIVERS_NOTE_TASKNAME_BUFSIZE > 0
#if CONFIG_DRIVERS_NOTE_TASKNAME_BUFSIZE > 0 && \
defined(CONFIG_SCHED_INSTRUMENTATION_SWITCH)
static struct note_taskname_s g_note_taskname;
#endif
@ -475,6 +476,7 @@ static inline int note_isenabled_dump(uint32_t tag)
}
#endif
#ifdef CONFIG_SCHED_INSTRUMENTATION_SWITCH
#if CONFIG_DRIVERS_NOTE_TASKNAME_BUFSIZE > 0
/****************************************************************************
@ -718,7 +720,6 @@ void sched_note_stop(FAR struct tcb_s *tcb)
}
}
#ifdef CONFIG_SCHED_INSTRUMENTATION_SWITCH
void sched_note_suspend(FAR struct tcb_s *tcb)
{
struct note_suspend_s note;
@ -795,7 +796,6 @@ void sched_note_resume(FAR struct tcb_s *tcb)
note_add(*driver, &note, sizeof(struct note_resume_s));
}
}
#endif
#ifdef CONFIG_SMP
void sched_note_cpu_start(FAR struct tcb_s *tcb, int cpu)
@ -875,7 +875,6 @@ void sched_note_cpu_started(FAR struct tcb_s *tcb)
}
}
#ifdef CONFIG_SCHED_INSTRUMENTATION_SWITCH
void sched_note_cpu_pause(FAR struct tcb_s *tcb, int cpu)
{
struct note_cpu_pause_s note;
@ -1029,8 +1028,8 @@ void sched_note_cpu_resumed(FAR struct tcb_s *tcb)
note_add(*driver, &note, sizeof(struct note_cpu_resumed_s));
}
}
#endif
#endif
#endif /* CONFIG_SMP */
#endif /* CONFIG_SCHED_INSTRUMENTATION_SWITCH */
#ifdef CONFIG_SCHED_INSTRUMENTATION_PREEMPTION
void sched_note_premption(FAR struct tcb_s *tcb, bool locked)
@ -1975,6 +1974,7 @@ FAR const char *note_get_taskname(pid_t pid)
{
FAR struct note_taskname_info_s *ti;
FAR struct tcb_s *tcb;
UNUSED(ti);
tcb = nxsched_get_tcb(pid);
if (tcb != NULL)
@ -1982,6 +1982,7 @@ FAR const char *note_get_taskname(pid_t pid)
return tcb->name;
}
#ifdef CONFIG_SCHED_INSTRUMENTATION_SWITCH
ti = note_find_taskname(pid);
if (ti != NULL)
{
@ -1989,6 +1990,9 @@ FAR const char *note_get_taskname(pid_t pid)
}
return NULL;
#else
return "unknown";
#endif
}
#endif

View file

@ -937,6 +937,7 @@ static int noteram_dump_one(FAR uint8_t *p, FAR struct lib_outstream_s *s,
switch (note->nc_type)
{
#ifdef CONFIG_SCHED_INSTRUMENTATION_SWITCH
case NOTE_START:
{
ret += noteram_dump_header(s, note, ctx);
@ -956,7 +957,6 @@ static int noteram_dump_one(FAR uint8_t *p, FAR struct lib_outstream_s *s,
}
break;
#ifdef CONFIG_SCHED_INSTRUMENTATION_SWITCH
case NOTE_SUSPEND:
{
FAR struct note_suspend_s *nsu = (FAR struct note_suspend_s *)p;

View file

@ -577,36 +577,28 @@ extern "C"
*
****************************************************************************/
#ifdef CONFIG_SCHED_INSTRUMENTATION
#ifdef CONFIG_SCHED_INSTRUMENTATION_SWITCH
void sched_note_start(FAR struct tcb_s *tcb);
void sched_note_stop(FAR struct tcb_s *tcb);
#else
# define sched_note_start(t)
# define sched_note_stop(t)
#endif
#ifdef CONFIG_SCHED_INSTRUMENTATION_SWITCH
void sched_note_suspend(FAR struct tcb_s *tcb);
void sched_note_resume(FAR struct tcb_s *tcb);
#else
# define sched_note_stop(t)
# define sched_note_start(t)
# define sched_note_suspend(t)
# define sched_note_resume(t)
#endif
#if defined(CONFIG_SMP) && defined(CONFIG_SCHED_INSTRUMENTATION)
#if defined(CONFIG_SMP) && defined(CONFIG_SCHED_INSTRUMENTATION_SWITCH)
void sched_note_cpu_start(FAR struct tcb_s *tcb, int cpu);
void sched_note_cpu_started(FAR struct tcb_s *tcb);
#else
# define sched_note_cpu_start(t,c)
# define sched_note_cpu_started(t)
#endif
#if defined(CONFIG_SMP) && defined(CONFIG_SCHED_INSTRUMENTATION_SWITCH)
void sched_note_cpu_pause(FAR struct tcb_s *tcb, int cpu);
void sched_note_cpu_paused(FAR struct tcb_s *tcb);
void sched_note_cpu_resume(FAR struct tcb_s *tcb, int cpu);
void sched_note_cpu_resumed(FAR struct tcb_s *tcb);
#else
# define sched_note_cpu_start(t,c)
# define sched_note_cpu_started(t)
# define sched_note_cpu_pause(t,c)
# define sched_note_cpu_paused(t)
# define sched_note_cpu_resume(t,c)