1
0
Fork 0
forked from nuttx/nuttx-update

drivers/note:add the api of sched_note_add

Signed-off-by: zhangwenjian <zhangwenjian@xiaomi.com>
This commit is contained in:
zhangwenjian 2024-02-05 15:54:39 +08:00 committed by Xiang Xiao
parent 7aa1871664
commit 149b1f186e
2 changed files with 57 additions and 0 deletions

View file

@ -564,6 +564,57 @@ static void note_record_taskname(pid_t pid, FAR const char *name)
* Public Functions
****************************************************************************/
#ifdef CONFIG_SCHED_INSTRUMENTATION
/****************************************************************************
* Name: sched_note_add
*
* Description:
* Forward rpmsg note data to individual channels.This process does
* not require filtering
*
* Input Parameters:
* data - The forward note data.
* len - The len of forward note data.
*
* Returned Value:
* None
*
* Assumptions:
* We are within a critical section.
*
****************************************************************************/
void sched_note_add(FAR const void *data, size_t len)
{
DEBUGASSERT(data);
while (len >= sizeof(struct note_common_s))
{
FAR struct note_common_s *note = (FAR struct note_common_s *)data;
size_t notelen = note->nc_length;
FAR struct note_driver_s **driver;
DEBUGASSERT(notelen >= sizeof(struct note_common_s) &&
len >= notelen);
for (driver = g_note_drivers; *driver; driver++)
{
if ((*driver)->ops->add == NULL)
{
continue;
}
/* Add the note to circular buffer */
note_add(*driver, note, notelen);
}
data += notelen;
len -= notelen;
}
}
#endif
/****************************************************************************
* Name: sched_note_*
*

View file

@ -595,6 +595,12 @@ extern "C"
*
****************************************************************************/
#ifdef CONFIG_SCHED_INSTRUMENTATION
void sched_note_add(FAR const void *note, size_t notelen);
#else
# define sched_note_add(n,l)
#endif
#ifdef CONFIG_SCHED_INSTRUMENTATION_SWITCH
void sched_note_start(FAR struct tcb_s *tcb);
void sched_note_stop(FAR struct tcb_s *tcb);