mirror of
https://github.com/apache/nuttx.git
synced 2026-10-06 13:55:15 +00:00
note:support filter for each note channel
Signed-off-by: zhangwenjian <zhangwenjian@xiaomi.com>
This commit is contained in:
parent
c018be66bd
commit
7aa1871664
11 changed files with 459 additions and 213 deletions
|
|
@ -106,22 +106,6 @@
|
|||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION_FILTER
|
||||
struct note_filter_s
|
||||
{
|
||||
struct note_filter_mode_s mode;
|
||||
# ifdef CONFIG_SCHED_INSTRUMENTATION_DUMP
|
||||
struct note_filter_tag_s tag_mask;
|
||||
# endif
|
||||
# ifdef CONFIG_SCHED_INSTRUMENTATION_IRQHANDLER
|
||||
struct note_filter_irq_s irq_mask;
|
||||
# endif
|
||||
# ifdef CONFIG_SCHED_INSTRUMENTATION_SYSCALL
|
||||
struct note_filter_syscall_s syscall_mask;
|
||||
# endif
|
||||
};
|
||||
#endif
|
||||
|
||||
struct note_startalloc_s
|
||||
{
|
||||
struct note_common_s nsa_cmn; /* Common note parameters */
|
||||
|
|
@ -157,16 +141,6 @@ struct note_taskname_s
|
|||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION_FILTER
|
||||
static struct note_filter_s g_note_filter =
|
||||
{
|
||||
{
|
||||
CONFIG_SCHED_INSTRUMENTATION_FILTER_DEFAULT_MODE
|
||||
#ifdef CONFIG_SMP
|
||||
, (cpu_set_t)CONFIG_SCHED_INSTRUMENTATION_CPUSET
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION_IRQHANDLER
|
||||
static unsigned int g_note_disabled_irq_nest[CONFIG_SMP_NCPUS];
|
||||
#endif
|
||||
|
|
@ -251,17 +225,17 @@ static void note_common(FAR struct tcb_s *tcb,
|
|||
* Check whether the instrumentation is enabled.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
* driver - The channel of note driver
|
||||
*
|
||||
* Returned Value:
|
||||
* True is returned if the instrumentation is enabled.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static inline int note_isenabled(void)
|
||||
static inline int note_isenabled(FAR struct note_driver_s *driver)
|
||||
{
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION_FILTER
|
||||
if (!(g_note_filter.mode.flag & NOTE_FILTER_MODE_FLAG_ENABLE))
|
||||
if (!(driver->filter.mode.flag & NOTE_FILTER_MODE_FLAG_ENABLE))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -269,7 +243,7 @@ static inline int note_isenabled(void)
|
|||
#ifdef CONFIG_SMP
|
||||
/* Ignore notes that are not in the set of monitored CPUs */
|
||||
|
||||
if (CPU_ISSET(this_cpu(), &g_note_filter.mode.cpuset) == 0)
|
||||
if (CPU_ISSET(this_cpu(), &driver->filter.mode.cpuset) == 0)
|
||||
{
|
||||
/* Not in the set of monitored CPUs. Do not log the note. */
|
||||
|
||||
|
|
@ -288,7 +262,7 @@ static inline int note_isenabled(void)
|
|||
* Check whether the switch instrumentation is enabled.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
* driver - The channel of note driver
|
||||
*
|
||||
* Returned Value:
|
||||
* True is returned if the instrumentation is enabled.
|
||||
|
|
@ -296,17 +270,17 @@ static inline int note_isenabled(void)
|
|||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION_SWITCH
|
||||
static inline int note_isenabled_switch(void)
|
||||
static inline int note_isenabled_switch(FAR struct note_driver_s *driver)
|
||||
{
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION_FILTER
|
||||
if (!note_isenabled())
|
||||
if (!note_isenabled(driver))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* If the switch trace is disabled, do nothing. */
|
||||
|
||||
if ((g_note_filter.mode.flag & NOTE_FILTER_MODE_FLAG_SWITCH) == 0)
|
||||
if ((driver->filter.mode.flag & NOTE_FILTER_MODE_FLAG_SWITCH) == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -323,6 +297,7 @@ static inline int note_isenabled_switch(void)
|
|||
* Check whether the syscall instrumentation is enabled.
|
||||
*
|
||||
* Input Parameters:
|
||||
* driver - The channel of note driver
|
||||
* nr - syscall number
|
||||
*
|
||||
* Returned Value:
|
||||
|
|
@ -331,10 +306,11 @@ static inline int note_isenabled_switch(void)
|
|||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION_SYSCALL
|
||||
static inline int note_isenabled_syscall(int nr)
|
||||
static inline int note_isenabled_syscall(FAR struct note_driver_s *driver,
|
||||
int nr)
|
||||
{
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION_FILTER
|
||||
if (!note_isenabled())
|
||||
if (!note_isenabled(driver))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -361,9 +337,9 @@ static inline int note_isenabled_syscall(int nr)
|
|||
* do nothing.
|
||||
*/
|
||||
|
||||
if (!(g_note_filter.mode.flag & NOTE_FILTER_MODE_FLAG_SYSCALL) ||
|
||||
if (!(driver->filter.mode.flag & NOTE_FILTER_MODE_FLAG_SYSCALL) ||
|
||||
NOTE_FILTER_SYSCALLMASK_ISSET(nr - CONFIG_SYS_RESERVED,
|
||||
&g_note_filter.syscall_mask))
|
||||
&driver->filter.syscall_mask))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -380,6 +356,7 @@ static inline int note_isenabled_syscall(int nr)
|
|||
* Check whether the interrupt handler instrumentation is enabled.
|
||||
*
|
||||
* Input Parameters:
|
||||
* driver - The channel of note driver
|
||||
* irq - IRQ number
|
||||
* enter - interrupt enter/leave flag
|
||||
*
|
||||
|
|
@ -389,10 +366,11 @@ static inline int note_isenabled_syscall(int nr)
|
|||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION_IRQHANDLER
|
||||
static inline int note_isenabled_irq(int irq, bool enter)
|
||||
static inline int note_isenabled_irq(FAR struct note_driver_s *driver,
|
||||
int irq, bool enter)
|
||||
{
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION_FILTER
|
||||
if (!note_isenabled())
|
||||
if (!note_isenabled(driver))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -401,8 +379,8 @@ static inline int note_isenabled_irq(int irq, bool enter)
|
|||
* subsequent syscall traces until leaving the interrupt handler
|
||||
*/
|
||||
|
||||
if (!(g_note_filter.mode.flag & NOTE_FILTER_MODE_FLAG_IRQ) ||
|
||||
NOTE_FILTER_IRQMASK_ISSET(irq, &g_note_filter.irq_mask))
|
||||
if (!(driver->filter.mode.flag & NOTE_FILTER_MODE_FLAG_IRQ) ||
|
||||
NOTE_FILTER_IRQMASK_ISSET(irq, &driver->filter.irq_mask))
|
||||
{
|
||||
int cpu = this_cpu();
|
||||
|
||||
|
|
@ -430,6 +408,7 @@ static inline int note_isenabled_irq(int irq, bool enter)
|
|||
* Check whether the dump instrumentation is enabled.
|
||||
*
|
||||
* Input Parameters:
|
||||
* driver - The channel of note driver
|
||||
* tag: The dump instrumentation tag
|
||||
*
|
||||
* Returned Value:
|
||||
|
|
@ -438,18 +417,19 @@ static inline int note_isenabled_irq(int irq, bool enter)
|
|||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION_DUMP
|
||||
static inline int note_isenabled_dump(uint32_t tag)
|
||||
static inline int note_isenabled_dump(FAR struct note_driver_s *driver,
|
||||
uint32_t tag)
|
||||
{
|
||||
# ifdef CONFIG_SCHED_INSTRUMENTATION_FILTER
|
||||
if (!note_isenabled())
|
||||
if (!note_isenabled(driver))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* If the dump trace is disabled, do nothing. */
|
||||
|
||||
if (!(g_note_filter.mode.flag & NOTE_FILTER_MODE_FLAG_DUMP) ||
|
||||
NOTE_FILTER_TAGMASK_ISSET(tag, &g_note_filter.tag_mask))
|
||||
if (!(driver->filter.mode.flag & NOTE_FILTER_MODE_FLAG_DUMP) ||
|
||||
NOTE_FILTER_TAGMASK_ISSET(tag, &driver->filter.tag_mask))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -614,13 +594,13 @@ void sched_note_start(FAR struct tcb_s *tcb)
|
|||
int namelen;
|
||||
#endif
|
||||
|
||||
if (!note_isenabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (driver = g_note_drivers; *driver; driver++)
|
||||
{
|
||||
if (!note_isenabled(*driver))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (note_start(*driver, tcb))
|
||||
{
|
||||
continue;
|
||||
|
|
@ -671,13 +651,13 @@ void sched_note_stop(FAR struct tcb_s *tcb)
|
|||
note_record_taskname(tcb->pid, tcb->name);
|
||||
#endif
|
||||
|
||||
if (!note_isenabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (driver = g_note_drivers; *driver; driver++)
|
||||
{
|
||||
if (!note_isenabled(*driver))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (note_stop(*driver, tcb))
|
||||
{
|
||||
continue;
|
||||
|
|
@ -709,13 +689,13 @@ void sched_note_suspend(FAR struct tcb_s *tcb)
|
|||
FAR struct note_driver_s **driver;
|
||||
bool formatted = false;
|
||||
|
||||
if (!note_isenabled_switch())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (driver = g_note_drivers; *driver; driver++)
|
||||
{
|
||||
if (!note_isenabled_switch(*driver))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (note_suspend(*driver, tcb))
|
||||
{
|
||||
continue;
|
||||
|
|
@ -748,13 +728,13 @@ void sched_note_resume(FAR struct tcb_s *tcb)
|
|||
FAR struct note_driver_s **driver;
|
||||
bool formatted = false;
|
||||
|
||||
if (!note_isenabled_switch())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (driver = g_note_drivers; *driver; driver++)
|
||||
{
|
||||
if (!note_isenabled_switch(*driver))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (note_resume(*driver, tcb))
|
||||
{
|
||||
continue;
|
||||
|
|
@ -787,13 +767,13 @@ void sched_note_cpu_start(FAR struct tcb_s *tcb, int cpu)
|
|||
FAR struct note_driver_s **driver;
|
||||
bool formatted = false;
|
||||
|
||||
if (!note_isenabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (driver = g_note_drivers; *driver; driver++)
|
||||
{
|
||||
if (!note_isenabled(*driver))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (note_cpu_start(*driver, tcb, cpu))
|
||||
{
|
||||
continue;
|
||||
|
|
@ -826,13 +806,13 @@ void sched_note_cpu_started(FAR struct tcb_s *tcb)
|
|||
FAR struct note_driver_s **driver;
|
||||
bool formatted = false;
|
||||
|
||||
if (!note_isenabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (driver = g_note_drivers; *driver; driver++)
|
||||
{
|
||||
if (!note_isenabled(*driver))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (note_cpu_started(*driver, tcb))
|
||||
{
|
||||
continue;
|
||||
|
|
@ -864,13 +844,13 @@ void sched_note_cpu_pause(FAR struct tcb_s *tcb, int cpu)
|
|||
FAR struct note_driver_s **driver;
|
||||
bool formatted = false;
|
||||
|
||||
if (!note_isenabled_switch())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (driver = g_note_drivers; *driver; driver++)
|
||||
{
|
||||
if (!note_isenabled_switch(*driver))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (note_cpu_pause(*driver, tcb, cpu))
|
||||
{
|
||||
continue;
|
||||
|
|
@ -903,13 +883,13 @@ void sched_note_cpu_paused(FAR struct tcb_s *tcb)
|
|||
FAR struct note_driver_s **driver;
|
||||
bool formatted = false;
|
||||
|
||||
if (!note_isenabled_switch())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (driver = g_note_drivers; *driver; driver++)
|
||||
{
|
||||
if (!note_isenabled_switch(*driver))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (note_cpu_paused(*driver, tcb))
|
||||
{
|
||||
continue;
|
||||
|
|
@ -941,13 +921,13 @@ void sched_note_cpu_resume(FAR struct tcb_s *tcb, int cpu)
|
|||
FAR struct note_driver_s **driver;
|
||||
bool formatted = false;
|
||||
|
||||
if (!note_isenabled_switch())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (driver = g_note_drivers; *driver; driver++)
|
||||
{
|
||||
if (!note_isenabled_switch(*driver))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (note_cpu_resume(*driver, tcb, cpu))
|
||||
{
|
||||
continue;
|
||||
|
|
@ -980,13 +960,13 @@ void sched_note_cpu_resumed(FAR struct tcb_s *tcb)
|
|||
FAR struct note_driver_s **driver;
|
||||
bool formatted = false;
|
||||
|
||||
if (!note_isenabled_switch())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (driver = g_note_drivers; *driver; driver++)
|
||||
{
|
||||
if (!note_isenabled_switch(*driver))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (note_cpu_resumed(*driver, tcb))
|
||||
{
|
||||
continue;
|
||||
|
|
@ -1021,13 +1001,13 @@ void sched_note_premption(FAR struct tcb_s *tcb, bool locked)
|
|||
FAR struct note_driver_s **driver;
|
||||
bool formatted = false;
|
||||
|
||||
if (!note_isenabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (driver = g_note_drivers; *driver; driver++)
|
||||
{
|
||||
if (!note_isenabled(*driver))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (note_premption(*driver, tcb, locked))
|
||||
{
|
||||
continue;
|
||||
|
|
@ -1062,13 +1042,13 @@ void sched_note_csection(FAR struct tcb_s *tcb, bool enter)
|
|||
FAR struct note_driver_s **driver;
|
||||
bool formatted = false;
|
||||
|
||||
if (!note_isenabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (driver = g_note_drivers; *driver; driver++)
|
||||
{
|
||||
if (!note_isenabled(*driver))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (note_csection(*driver, tcb, enter))
|
||||
{
|
||||
continue;
|
||||
|
|
@ -1122,13 +1102,13 @@ void sched_note_spinlock(FAR struct tcb_s *tcb,
|
|||
FAR struct note_driver_s **driver;
|
||||
bool formatted = false;
|
||||
|
||||
if (!note_isenabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (driver = g_note_drivers; *driver; driver++)
|
||||
{
|
||||
if (!note_isenabled(*driver))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (note_spinlock(*driver, tcb, spinlock, type))
|
||||
{
|
||||
continue;
|
||||
|
|
@ -1187,26 +1167,40 @@ void sched_note_syscall_enter(int nr, int argc, ...)
|
|||
FAR struct tcb_s *tcb = this_task();
|
||||
unsigned int length;
|
||||
uintptr_t arg;
|
||||
va_list ap;
|
||||
int argc_bak = argc;
|
||||
int i;
|
||||
|
||||
if (!note_isenabled_syscall(nr))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION_FILTER
|
||||
if (!(g_note_filter.mode.flag & NOTE_FILTER_MODE_FLAG_SYSCALL_ARGS))
|
||||
{
|
||||
argc = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
va_start(ap, argc);
|
||||
for (driver = g_note_drivers; *driver; driver++)
|
||||
{
|
||||
va_list copy;
|
||||
|
||||
if (!note_isenabled_syscall(*driver, nr))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION_FILTER
|
||||
if (!(*driver->filter.mode.flag & NOTE_FILTER_MODE_FLAG_SYSCALL_ARGS))
|
||||
{
|
||||
if (formatted && argc != 0)
|
||||
{
|
||||
formatted = false;
|
||||
}
|
||||
|
||||
argc = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (formatted && argc == 0)
|
||||
{
|
||||
formatted = false;
|
||||
}
|
||||
|
||||
argc = argc_bak;
|
||||
}
|
||||
#endif
|
||||
|
||||
va_copy(copy, ap);
|
||||
if (note_syscall_enter(*driver, nr, argc, ©))
|
||||
{
|
||||
|
|
@ -1258,13 +1252,13 @@ void sched_note_syscall_leave(int nr, uintptr_t result)
|
|||
bool formatted = false;
|
||||
FAR struct tcb_s *tcb = this_task();
|
||||
|
||||
if (!note_isenabled_syscall(nr))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (driver = g_note_drivers; *driver; driver++)
|
||||
{
|
||||
if (!note_isenabled_syscall(*driver, nr))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (note_syscall_leave(*driver, nr, result))
|
||||
{
|
||||
continue;
|
||||
|
|
@ -1303,13 +1297,13 @@ void sched_note_irqhandler(int irq, FAR void *handler, bool enter)
|
|||
bool formatted = false;
|
||||
FAR struct tcb_s *tcb = this_task();
|
||||
|
||||
if (!note_isenabled_irq(irq, enter))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (driver = g_note_drivers; *driver; driver++)
|
||||
{
|
||||
if (!note_isenabled_irq(*driver, irq, enter))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (note_irqhandler(*driver, irq, handler, enter))
|
||||
{
|
||||
continue;
|
||||
|
|
@ -1381,15 +1375,13 @@ void sched_note_heap(uint8_t event, FAR void *heap, FAR void *mem,
|
|||
bool formatted = false;
|
||||
FAR struct tcb_s *tcb = this_task();
|
||||
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION_FILTER
|
||||
if (!note_isenabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (driver = g_note_drivers; *driver; driver++)
|
||||
{
|
||||
if (!note_isenabled(*driver))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (note_heap(*driver, event, heap, mem, size, used))
|
||||
{
|
||||
continue;
|
||||
|
|
@ -1428,13 +1420,13 @@ void sched_note_event_ip(uint32_t tag, uintptr_t ip, uint8_t event,
|
|||
unsigned int length;
|
||||
FAR struct tcb_s *tcb = this_task();
|
||||
|
||||
if (!note_isenabled_dump(tag))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (driver = g_note_drivers; *driver; driver++)
|
||||
{
|
||||
if (!note_isenabled_dump(*driver, tag))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (note_event(*driver, ip, event, buf, len))
|
||||
{
|
||||
continue;
|
||||
|
|
@ -1478,13 +1470,13 @@ void sched_note_vprintf_ip(uint32_t tag, uintptr_t ip, FAR const char *fmt,
|
|||
size_t length = 0;
|
||||
FAR struct tcb_s *tcb = this_task();
|
||||
|
||||
if (!note_isenabled_dump(tag))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (driver = g_note_drivers; *driver; driver++)
|
||||
{
|
||||
if (!note_isenabled_dump(*driver, tag))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (note_vprintf(*driver, ip, fmt, va))
|
||||
{
|
||||
continue;
|
||||
|
|
@ -1778,21 +1770,46 @@ void sched_note_printf_ip(uint32_t tag, uintptr_t ip, FAR const char *fmt,
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
void sched_note_filter_mode(FAR struct note_filter_mode_s *oldm,
|
||||
FAR struct note_filter_mode_s *newm)
|
||||
void sched_note_filter_mode(FAR struct note_filter_named_mode_s *oldm,
|
||||
FAR struct note_filter_named_mode_s *newm)
|
||||
{
|
||||
irqstate_t irq_mask;
|
||||
FAR struct note_driver_s **driver;
|
||||
|
||||
irq_mask = spin_lock_irqsave_wo_note(&g_note_lock);
|
||||
|
||||
if (oldm != NULL)
|
||||
{
|
||||
*oldm = g_note_filter.mode;
|
||||
for (driver = g_note_drivers; *driver; driver++)
|
||||
{
|
||||
if (oldm->name[0] == '\0')
|
||||
{
|
||||
oldm->mode = (*driver)->filter.mode;
|
||||
strlcpy(oldm->name, (*driver)->name, NAME_MAX);
|
||||
break;
|
||||
}
|
||||
else if (strcmp((*driver)->name, oldm->name) == 0)
|
||||
{
|
||||
oldm->mode = (*driver)->filter.mode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (newm != NULL)
|
||||
{
|
||||
g_note_filter.mode = *newm;
|
||||
for (driver = g_note_drivers; *driver; driver++)
|
||||
{
|
||||
if (newm->name[0] == '\0')
|
||||
{
|
||||
(*driver)->filter.mode = newm->mode;
|
||||
}
|
||||
else if (0 == strcmp((*driver)->name, newm->name))
|
||||
{
|
||||
(*driver)->filter.mode = newm->mode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore_wo_note(&g_note_lock, irq_mask);
|
||||
|
|
@ -1819,25 +1836,46 @@ void sched_note_filter_mode(FAR struct note_filter_mode_s *oldm,
|
|||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION_SYSCALL
|
||||
void sched_note_filter_syscall(FAR struct note_filter_syscall_s *oldf,
|
||||
FAR struct note_filter_syscall_s *newf)
|
||||
void sched_note_filter_syscall(FAR struct note_filter_named_syscall_s *oldf,
|
||||
FAR struct note_filter_named_syscall_s *newf)
|
||||
{
|
||||
irqstate_t irq_mask;
|
||||
FAR struct note_driver_s **driver;
|
||||
|
||||
irq_mask = spin_lock_irqsave_wo_note(&g_note_lock);
|
||||
|
||||
if (oldf != NULL)
|
||||
{
|
||||
/* Return the current filter setting */
|
||||
|
||||
*oldf = g_note_filter.syscall_mask;
|
||||
for (driver = g_note_drivers; *driver; driver++)
|
||||
{
|
||||
if (oldf->name[0] == '\0')
|
||||
{
|
||||
oldf->syscall_mask = (*driver)->filter.syscall_mask;
|
||||
strlcpy(oldf->name, (*driver)->name, NAME_MAX);
|
||||
break;
|
||||
}
|
||||
else if (strcmp((*driver)->name, oldf->name) == 0)
|
||||
{
|
||||
oldf->syscall_mask = (*driver)->filter.syscall_mask;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (newf != NULL)
|
||||
{
|
||||
/* Replace the syscall filter mask by the provided setting */
|
||||
|
||||
g_note_filter.syscall_mask = *newf;
|
||||
for (driver = g_note_drivers; *driver; driver++)
|
||||
{
|
||||
if (newf->name[0] == '\0')
|
||||
{
|
||||
(*driver)->filter.syscall_mask = newf->syscall_mask;
|
||||
}
|
||||
else if (0 == strcmp((*driver)->name, newf->name))
|
||||
{
|
||||
(*driver)->filter.syscall_mask = newf->syscall_mask;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore_wo_note(&g_note_lock, irq_mask);
|
||||
|
|
@ -1865,25 +1903,46 @@ void sched_note_filter_syscall(FAR struct note_filter_syscall_s *oldf,
|
|||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION_IRQHANDLER
|
||||
void sched_note_filter_irq(FAR struct note_filter_irq_s *oldf,
|
||||
FAR struct note_filter_irq_s *newf)
|
||||
void sched_note_filter_irq(FAR struct note_filter_named_irq_s *oldf,
|
||||
FAR struct note_filter_named_irq_s *newf)
|
||||
{
|
||||
irqstate_t irq_mask;
|
||||
FAR struct note_driver_s **driver;
|
||||
|
||||
irq_mask = spin_lock_irqsave_wo_note(&g_note_lock);
|
||||
|
||||
if (oldf != NULL)
|
||||
{
|
||||
/* Return the current filter setting */
|
||||
|
||||
*oldf = g_note_filter.irq_mask;
|
||||
for (driver = g_note_drivers; *driver; driver++)
|
||||
{
|
||||
if (oldf->name[0] == '\0')
|
||||
{
|
||||
oldf->irq_mask = (*driver)->filter.irq_mask;
|
||||
strlcpy(oldf->name, (*driver)->name, NAME_MAX);
|
||||
break;
|
||||
}
|
||||
else if (strcmp((*driver)->name, oldf->name) == 0)
|
||||
{
|
||||
oldf->irq_mask = (*driver)->filter.irq_mask;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (newf != NULL)
|
||||
{
|
||||
/* Replace the syscall filter mask by the provided setting */
|
||||
|
||||
g_note_filter.irq_mask = *newf;
|
||||
for (driver = g_note_drivers; *driver; driver++)
|
||||
{
|
||||
if (newf->name[0] == '\0')
|
||||
{
|
||||
(*driver)->filter.irq_mask = newf->irq_mask;
|
||||
}
|
||||
else if (0 == strcmp((*driver)->name, newf->name))
|
||||
{
|
||||
(*driver)->filter.irq_mask = newf->irq_mask;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore_wo_note(&g_note_lock, irq_mask);
|
||||
|
|
@ -1911,25 +1970,46 @@ void sched_note_filter_irq(FAR struct note_filter_irq_s *oldf,
|
|||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION_DUMP
|
||||
void sched_note_filter_tag(FAR struct note_filter_tag_s *oldf,
|
||||
FAR struct note_filter_tag_s *newf)
|
||||
void sched_note_filter_tag(FAR struct note_filter_named_tag_s *oldf,
|
||||
FAR struct note_filter_named_tag_s *newf)
|
||||
{
|
||||
irqstate_t falgs;
|
||||
FAR struct note_driver_s **driver;
|
||||
|
||||
falgs = spin_lock_irqsave_wo_note(&g_note_lock);
|
||||
|
||||
if (oldf != NULL)
|
||||
{
|
||||
/* Return the current filter setting */
|
||||
|
||||
*oldf = g_note_filter.tag_mask;
|
||||
for (driver = g_note_drivers; *driver; driver++)
|
||||
{
|
||||
if (oldf->name[0] == '\0')
|
||||
{
|
||||
oldf->tag_mask = (*driver)->filter.tag_mask;
|
||||
strlcpy(oldf->name, (*driver)->name, NAME_MAX);
|
||||
break;
|
||||
}
|
||||
else if (strcmp((*driver)->name, oldf->name) == 0)
|
||||
{
|
||||
oldf->tag_mask = (*driver)->filter.tag_mask;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (newf != NULL)
|
||||
{
|
||||
/* Replace the dump filter mask by the provided setting */
|
||||
|
||||
g_note_filter.tag_mask = *newf;
|
||||
for (driver = g_note_drivers; *driver; driver++)
|
||||
{
|
||||
if (newf->name[0] == '\0')
|
||||
{
|
||||
(*driver)->filter.tag_mask = newf->tag_mask;
|
||||
}
|
||||
else if (0 == strcmp((*driver)->name, newf->name))
|
||||
{
|
||||
(*driver)->filter.tag_mask = newf->tag_mask;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore_wo_note(&g_note_lock, falgs);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue