|
24 | 24 |
|
25 | 25 | #include <debug.h>
|
26 | 26 |
|
| 27 | +#include <nuttx/instrument.h> |
27 | 28 | #include <nuttx/note/note_driver.h>
|
28 | 29 | #include <nuttx/note/noteram_driver.h>
|
29 | 30 | #include <nuttx/note/notectl_driver.h>
|
|
34 | 35 |
|
35 | 36 | #include "noterpmsg.h"
|
36 | 37 |
|
| 38 | +/**************************************************************************** |
| 39 | + * Private Function Prototypes |
| 40 | + ****************************************************************************/ |
| 41 | + |
| 42 | +#ifdef CONFIG_SCHED_INSTRUMENTATION_FUNCTION |
| 43 | +static void note_driver_instrument_enter(FAR void *this_fn, |
| 44 | + FAR void *call_site, FAR void *arg) noinstrument_function; |
| 45 | +static void note_driver_instrument_leave(FAR void *this_fn, |
| 46 | + FAR void *call_site, FAR void *arg) noinstrument_function; |
| 47 | +#endif |
| 48 | + |
| 49 | +/**************************************************************************** |
| 50 | + * Private Functions |
| 51 | + ****************************************************************************/ |
| 52 | + |
| 53 | +#ifdef CONFIG_SCHED_INSTRUMENTATION_FUNCTION |
| 54 | +static void note_driver_instrument_enter(FAR void *this_fn, |
| 55 | + FAR void *call_site, |
| 56 | + FAR void *arg) |
| 57 | +{ |
| 58 | + sched_note_event_ip(NOTE_TAG_ALWAYS, (uintptr_t)this_fn, |
| 59 | + NOTE_DUMP_BEGIN, NULL, 0); |
| 60 | +} |
| 61 | + |
| 62 | +static void note_driver_instrument_leave(FAR void *this_fn, |
| 63 | + FAR void *call_site, |
| 64 | + FAR void *arg) |
| 65 | +{ |
| 66 | + sched_note_event_ip(NOTE_TAG_ALWAYS, (uintptr_t)this_fn, |
| 67 | + NOTE_DUMP_END, NULL, 0); |
| 68 | +} |
| 69 | +#endif |
| 70 | + |
| 71 | +/**************************************************************************** |
| 72 | + * Private Data |
| 73 | + ****************************************************************************/ |
| 74 | + |
| 75 | +#ifdef CONFIG_SCHED_INSTRUMENTATION_FUNCTION |
| 76 | +static struct instrument_s g_note_instrument = |
| 77 | +{ |
| 78 | + .enter = note_driver_instrument_enter, |
| 79 | + .leave = note_driver_instrument_leave, |
| 80 | +}; |
| 81 | +#endif |
| 82 | + |
37 | 83 | /****************************************************************************
|
38 | 84 | * Public Functions
|
39 | 85 | ****************************************************************************/
|
@@ -97,6 +143,10 @@ int note_initialize(void)
|
97 | 143 | {
|
98 | 144 | int ret = 0;
|
99 | 145 |
|
| 146 | +#ifdef CONFIG_SCHED_INSTRUMENTATION_FUNCTION |
| 147 | + instrument_register(&g_note_instrument); |
| 148 | +#endif |
| 149 | + |
100 | 150 | #ifdef CONFIG_DRIVERS_NOTERAM
|
101 | 151 | ret = noteram_register();
|
102 | 152 | if (ret < 0)
|
|
0 commit comments