From 89ea234af8592d3c089a33c73048534c7cf01285 Mon Sep 17 00:00:00 2001 From: "Nakamura, Yuuichi" Date: Wed, 9 Sep 2020 09:06:38 +0900 Subject: [PATCH] Add on-boot instrumentation support for note filter --- drivers/note/Kconfig | 9 +++++++++ drivers/note/noteram_driver.c | 4 ++++ sched/Kconfig | 10 ++++++++++ sched/sched/sched_note.c | 6 +++++- 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/drivers/note/Kconfig b/drivers/note/Kconfig index a467d78477f..0424e6d43d9 100644 --- a/drivers/note/Kconfig +++ b/drivers/note/Kconfig @@ -55,6 +55,15 @@ config DRIVER_NOTERAM_BUFSIZE ---help--- The size of the in-memory, circular instrumentation buffer (in bytes). +config DRIVER_NOTERAM_DEFAULT_NOOVERWRITE + bool "Disable overwrite by default" + depends on DRIVER_NOTERAM + default n + ---help--- + Disables overwriting old notes in the circular buffer when the buffer + is full by default. This is useful to keep instrumentation data of the + beginning of a system boot. + config DRIVER_NOTECTL bool "Scheduler instrumentation filter control driver" default n diff --git a/drivers/note/noteram_driver.c b/drivers/note/noteram_driver.c index df379baef41..0f9306b4e73 100644 --- a/drivers/note/noteram_driver.c +++ b/drivers/note/noteram_driver.c @@ -92,7 +92,11 @@ static const struct file_operations g_noteram_fops = static struct noteram_info_s g_noteram_info = { +#ifdef CONFIG_DRIVER_NOTERAM_DEFAULT_NOOVERWRITE + .ni_overwrite = NOTERAM_MODE_OVERWRITE_DISABLE +#else .ni_overwrite = NOTERAM_MODE_OVERWRITE_ENABLE +#endif }; #ifdef CONFIG_SMP diff --git a/sched/Kconfig b/sched/Kconfig index 974571918eb..840f5897999 100644 --- a/sched/Kconfig +++ b/sched/Kconfig @@ -1000,6 +1000,16 @@ config SCHED_INSTRUMENTATION_FILTER The filter logic can be configured by sched_note_filter APIs defined in include/nuttx/sched_note.h. +config SCHED_INSTRUMENTATION_FILTER_DEFAULT_MODE + hex "Default instrumentation filter mode" + depends on SCHED_INSTRUMENTATION_FILTER + default 0x7 + ---help--- + Default mode of the instrumentation filter logic. + Bit 0 = Enable instrumentation + Bit 1 = Enable syscall instrumentation + Bit 2 = Enable IRQ instrumentation + endif # SCHED_INSTRUMENTATION endmenu # Performance Monitoring diff --git a/sched/sched/sched_note.c b/sched/sched/sched_note.c index 608ebfac8bb..95e32b16290 100644 --- a/sched/sched/sched_note.c +++ b/sched/sched/sched_note.c @@ -75,9 +75,13 @@ struct note_startalloc_s #ifdef CONFIG_SCHED_INSTRUMENTATION_FILTER static struct note_filter_s g_note_filter = { + .mode = + { + .flag = CONFIG_SCHED_INSTRUMENTATION_FILTER_DEFAULT_MODE, #ifdef CONFIG_SMP - .mode.cpuset = CONFIG_SCHED_INSTRUMENTATION_CPUSET + .cpuset = CONFIG_SCHED_INSTRUMENTATION_CPUSET, #endif + } }; #ifdef CONFIG_SMP