sched/note: add support of trace section mark
The implementation of this feature is based on android systrace: https://source.android.com/devices/tech/debug/ftrace Application developers are more concerned about the performance of the specified application section, added two APIs to implement performance measurement: void sched_note_begin(uintptr_t ip, FAR const char *buf); void sched_note_end(uintptr_t ip, FAR const char *buf); or SCHED_NOTE_BEGIN(); /* defined to sched_note_begin(_THIS_IP_, __FUNCTION__) */ SCHED_NOTE_END(); /* defined to sched_note_end(_THIS_IP_, __FUNCTION__) */ Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
parent
e05f64735f
commit
6e0ba2bed5
|
@ -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 */
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue