note:support filter for each note channel

Signed-off-by: zhangwenjian <zhangwenjian@xiaomi.com>
This commit is contained in:
zhangwenjian 2024-04-11 16:53:08 +08:00 committed by Xiang Xiao
parent c018be66bd
commit 7aa1871664
11 changed files with 459 additions and 213 deletions

View file

@ -32,6 +32,7 @@
#include <stddef.h>
#include <nuttx/sched.h>
#include <nuttx/sched_note.h>
/****************************************************************************
* Pre-processor Definitions
@ -108,8 +109,28 @@ struct note_driver_ops_s
#endif
};
#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_driver_s
{
#ifdef CONFIG_SCHED_INSTRUMENTATION_FILTER
FAR const char *name;
struct note_filter_s filter;
#endif
FAR const struct note_driver_ops_s *ops;
};

View file

@ -517,6 +517,12 @@ struct note_filter_mode_s
#endif
};
struct note_filter_named_mode_s
{
char name[NAME_MAX];
struct note_filter_mode_s mode;
};
/* This is the type of the argument passed to the NOTECTL_GETSYSCALLFILTER
* and NOTECTL_SETSYSCALLFILTER ioctls
*/
@ -526,6 +532,12 @@ struct note_filter_syscall_s
{
uint8_t syscall_mask[(SYS_nsyscalls + 7) / 8];
};
struct note_filter_named_syscall_s
{
char name[NAME_MAX];
struct note_filter_syscall_s syscall_mask;
};
#endif
/* This is the type of the argument passed to the NOTECTL_GETIRQFILTER and
@ -537,11 +549,23 @@ struct note_filter_irq_s
uint8_t irq_mask[(NR_IRQS + 7) / 8];
};
struct note_filter_named_irq_s
{
char name[NAME_MAX];
struct note_filter_irq_s irq_mask;
};
struct note_filter_tag_s
{
uint8_t tag_mask[(NOTE_TAG_MAX + 7) / 8];
};
struct note_filter_named_tag_s
{
char name[NAME_MAX];
struct note_filter_tag_s tag_mask;
};
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
@ -682,8 +706,8 @@ void sched_note_printf_ip(uint32_t tag, uintptr_t ip, FAR const char *fmt,
****************************************************************************/
#ifdef CONFIG_SCHED_INSTRUMENTATION_FILTER
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);
#endif
/****************************************************************************
@ -708,8 +732,8 @@ void sched_note_filter_mode(FAR struct note_filter_mode_s *oldm,
#if defined(CONFIG_SCHED_INSTRUMENTATION_FILTER) && \
defined(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);
#endif
/****************************************************************************
@ -734,14 +758,14 @@ void sched_note_filter_syscall(FAR struct note_filter_syscall_s *oldf,
#if defined(CONFIG_SCHED_INSTRUMENTATION_FILTER) && \
defined(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);
#endif
#if defined(CONFIG_SCHED_INSTRUMENTATION_FILTER) && \
defined(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);
#endif
#endif /* defined(__KERNEL__) || defined(CONFIG_BUILD_FLAT) */