diff --git a/include/nuttx/sched_note.h b/include/nuttx/sched_note.h index f148b67b800..9e9d1b8f825 100644 --- a/include/nuttx/sched_note.h +++ b/include/nuttx/sched_note.h @@ -124,6 +124,10 @@ sched_note_printf(SCHED_NOTE_IP, fmt, ##args) # define SCHED_NOTE_BPRINTF(event, fmt, args...) \ sched_note_bprintf(SCHED_NOTE_IP, event, fmt, ##args) +# define SCHED_NOTE_BEGIN() \ + sched_note_begin(SCHED_NOTE_IP, __FUNCTION__) +# define SCHED_NOTE_END() \ + sched_note_end(SCHED_NOTE_IP, __FUNCTION__) #else # define SCHED_NOTE_STRING(buf) # define SCHED_NOTE_DUMP(event, buf, len) @@ -131,6 +135,8 @@ # define SCHED_NOTE_VBPRINTF(event, fmt, va) # define SCHED_NOTE_PRINTF(fmt, args...) # define SCHED_NOTE_BPRINTF(event, fmt, args...) +# define SCHED_NOTE_BEGIN() +# define SCHED_NOTE_END() #endif /**************************************************************************** @@ -538,6 +544,8 @@ void sched_note_printf(uintptr_t ip, FAR const char *fmt, ...) printflike(2, 3); void sched_note_bprintf(uintptr_t ip, uint8_t event, FAR const char *fmt, ...) printflike(3, 4); +void sched_note_begin(uintptr_t ip, FAR const char *buf); +void sched_note_end(uintptr_t ip, FAR const char *buf); #else # define sched_note_string(ip,b) # define sched_note_dump(ip,e,b,l) @@ -545,6 +553,8 @@ void sched_note_bprintf(uintptr_t ip, uint8_t event, # define sched_note_vbprintf(ip,e,f,v) # define sched_note_printf(ip,f...) # define sched_note_bprintf(ip,e,f...) +# define sched_note_begin(ip,f...) +# define sched_note_end(ip,f...) #endif /* CONFIG_SCHED_INSTRUMENTATION_DUMP */ #if defined(__KERNEL__) || defined(CONFIG_BUILD_FLAT) @@ -675,6 +685,8 @@ void sched_note_filter_irq(struct note_filter_irq_s *oldf, # define sched_note_vbprintf(ip,e,f,v) # define sched_note_printf(ip,f...) # define sched_note_bprintf(ip,e,f...) +# define sched_note_begin(ip,f...) +# define sched_note_end(ip,f...) #endif /* CONFIG_SCHED_INSTRUMENTATION */ #endif /* __INCLUDE_NUTTX_SCHED_NOTE_H */ diff --git a/sched/sched/sched_note.c b/sched/sched/sched_note.c index c74a3452d1d..24659b41cbd 100644 --- a/sched/sched/sched_note.c +++ b/sched/sched/sched_note.c @@ -1184,6 +1184,16 @@ void sched_note_bprintf(uintptr_t ip, uint8_t event, sched_note_vbprintf(ip, event, fmt, va); va_end(va); } + +void sched_note_begin(uintptr_t ip, FAR const char *buf) +{ + sched_note_printf(ip, "B|%d|%s", getpid(), buf); +} + +void sched_note_end(uintptr_t ip, FAR const char *buf) +{ + sched_note_printf(ip, "E|%d|%s", getpid(), buf); +} #endif /* CONFIG_SCHED_INSTRUMENTATION_DUMP */ #ifdef CONFIG_SCHED_INSTRUMENTATION_FILTER