mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 23:40:19 +08:00
note: Move the instrument register to note_initialize
avoid the instrument doesn't get registered in some case Signed-off-by: cuiziwei <cuiziwei@xiaomi.com> Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
This commit is contained in:
@@ -41,7 +41,6 @@
|
|||||||
#include <nuttx/note/notestream_driver.h>
|
#include <nuttx/note/notestream_driver.h>
|
||||||
#include <nuttx/spinlock.h>
|
#include <nuttx/spinlock.h>
|
||||||
#include <nuttx/sched_note.h>
|
#include <nuttx/sched_note.h>
|
||||||
#include <nuttx/instrument.h>
|
|
||||||
|
|
||||||
#include "sched/sched.h"
|
#include "sched/sched.h"
|
||||||
#include "noterpmsg.h"
|
#include "noterpmsg.h"
|
||||||
@@ -157,18 +156,6 @@ struct note_taskname_s
|
|||||||
* Private Data
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_SCHED_INSTRUMENTATION_FUNCTION
|
|
||||||
static void note_driver_instrument_enter(FAR void *this_fn,
|
|
||||||
FAR void *call_site, FAR void *arg) noinstrument_function;
|
|
||||||
static void note_driver_instrument_leave(FAR void *this_fn,
|
|
||||||
FAR void *call_site, FAR void *arg) noinstrument_function;
|
|
||||||
static struct instrument_s g_note_instrument =
|
|
||||||
{
|
|
||||||
.enter = note_driver_instrument_enter,
|
|
||||||
.leave = note_driver_instrument_leave,
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_SCHED_INSTRUMENTATION_FILTER
|
#ifdef CONFIG_SCHED_INSTRUMENTATION_FILTER
|
||||||
static struct note_filter_s g_note_filter =
|
static struct note_filter_s g_note_filter =
|
||||||
{
|
{
|
||||||
@@ -1997,24 +1984,6 @@ FAR const char *note_get_taskname(pid_t pid)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_SCHED_INSTRUMENTATION_FUNCTION
|
|
||||||
static void note_driver_instrument_enter(FAR void *this_fn,
|
|
||||||
FAR void *call_site,
|
|
||||||
FAR void *arg)
|
|
||||||
{
|
|
||||||
sched_note_event_ip(NOTE_TAG_ALWAYS, (uintptr_t)this_fn,
|
|
||||||
NOTE_DUMP_BEGIN, NULL, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void note_driver_instrument_leave(FAR void *this_fn,
|
|
||||||
FAR void *call_site,
|
|
||||||
FAR void *arg)
|
|
||||||
{
|
|
||||||
sched_note_event_ip(NOTE_TAG_ALWAYS, (uintptr_t)this_fn,
|
|
||||||
NOTE_DUMP_END, NULL, 0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: note_driver_register
|
* Name: note_driver_register
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -2022,15 +1991,6 @@ static void note_driver_instrument_leave(FAR void *this_fn,
|
|||||||
int note_driver_register(FAR struct note_driver_s *driver)
|
int note_driver_register(FAR struct note_driver_s *driver)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
#ifdef CONFIG_SCHED_INSTRUMENTATION_FUNCTION
|
|
||||||
static bool initialized;
|
|
||||||
|
|
||||||
if (!initialized)
|
|
||||||
{
|
|
||||||
instrument_register(&g_note_instrument);
|
|
||||||
initialized = true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
DEBUGASSERT(driver);
|
DEBUGASSERT(driver);
|
||||||
for (i = 0; i < CONFIG_DRIVERS_NOTE_MAX; i++)
|
for (i = 0; i < CONFIG_DRIVERS_NOTE_MAX; i++)
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
#include <nuttx/instrument.h>
|
||||||
#include <nuttx/note/note_driver.h>
|
#include <nuttx/note/note_driver.h>
|
||||||
#include <nuttx/note/noteram_driver.h>
|
#include <nuttx/note/noteram_driver.h>
|
||||||
#include <nuttx/note/notectl_driver.h>
|
#include <nuttx/note/notectl_driver.h>
|
||||||
@@ -34,6 +35,51 @@
|
|||||||
|
|
||||||
#include "noterpmsg.h"
|
#include "noterpmsg.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Function Prototypes
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_SCHED_INSTRUMENTATION_FUNCTION
|
||||||
|
static void note_driver_instrument_enter(FAR void *this_fn,
|
||||||
|
FAR void *call_site, FAR void *arg) noinstrument_function;
|
||||||
|
static void note_driver_instrument_leave(FAR void *this_fn,
|
||||||
|
FAR void *call_site, FAR void *arg) noinstrument_function;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_SCHED_INSTRUMENTATION_FUNCTION
|
||||||
|
static void note_driver_instrument_enter(FAR void *this_fn,
|
||||||
|
FAR void *call_site,
|
||||||
|
FAR void *arg)
|
||||||
|
{
|
||||||
|
sched_note_event_ip(NOTE_TAG_ALWAYS, (uintptr_t)this_fn,
|
||||||
|
NOTE_DUMP_BEGIN, NULL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void note_driver_instrument_leave(FAR void *this_fn,
|
||||||
|
FAR void *call_site,
|
||||||
|
FAR void *arg)
|
||||||
|
{
|
||||||
|
sched_note_event_ip(NOTE_TAG_ALWAYS, (uintptr_t)this_fn,
|
||||||
|
NOTE_DUMP_END, NULL, 0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_SCHED_INSTRUMENTATION_FUNCTION
|
||||||
|
static struct instrument_s g_note_instrument =
|
||||||
|
{
|
||||||
|
.enter = note_driver_instrument_enter,
|
||||||
|
.leave = note_driver_instrument_leave,
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -97,6 +143,10 @@ int note_initialize(void)
|
|||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
#ifdef CONFIG_SCHED_INSTRUMENTATION_FUNCTION
|
||||||
|
instrument_register(&g_note_instrument);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_DRIVERS_NOTERAM
|
#ifdef CONFIG_DRIVERS_NOTERAM
|
||||||
ret = noteram_register();
|
ret = noteram_register();
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user