nuttx/drivers/note/Kconfig
yinshengkai f85102d81b drivers/note: adjust note kconfig order
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-12-30 15:50:30 -03:00

273 lines
9.4 KiB
Plaintext

#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
menuconfig SCHED_INSTRUMENTATION
bool "System performance monitor hooks"
default n
select SCHED_SUSPENDSCHEDULER
select SCHED_RESUMESCHEDULER
---help---
Enables instrumentation in scheduler to monitor system performance.
If enabled, then the board-specific logic must provide the following
functions (see include/sched.h):
void sched_note_start(FAR struct tcb_s *tcb);
void sched_note_stop(FAR struct tcb_s *tcb);
If CONFIG_SMP is enabled, then these additional interfaces are
expected:
void sched_note_cpu_start(FAR struct tcb_s *tcb, int cpu);
void sched_note_cpu_started(FAR struct tcb_s *tcb);
if SCHED_INSTRUMENTATION
config SCHED_INSTRUMENTATION_EXTERNAL
bool "System performance monitor endpoints are external"
default n
---help---
When this option is enabled, the board specific logic must implement all
callbacks listed in SCHED_INSTRUMENTATION, SCHED_INSTRUMENTATION_CSECTION,
SCHED_INSTRUMENTATION_SPINLOCKS, SCHED_INSTRUMENTATION_SYSCALL and
SCHED_INSTRUMENTATION_IRQHANDLER. Otherwise the common code will implement
these callbacks and packet the arguments into note_ struct. Then the board
-specific logic just needs to implement one callback:
void sched_note_add(FAR const void *note, size_t notelen);
and send the data to the suitable transport hardware.
config SCHED_INSTRUMENTATION_CPUSET
hex "CPU bit set"
default 0xffff
depends on SMP && SCHED_INSTRUMENTATION_FILTER
---help---
Monitor only CPUs in the bitset. Bit 0=CPU0, Bit1=CPU1, etc.
config SCHED_INSTRUMENTATION_HIRES
bool "Use Hi-Res RTC for instrumentation"
default n
---help---
Use higher resolution system timer for instrumentation.
config SCHED_INSTRUMENTATION_FILTER
bool "Instrumenation filter"
default n
---help---
Enables the filter logic for the instrumentation. If this option
is enabled, the instrumentation data passed to sched_note_add()
can be filtered by syscall and IRQ number.
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 0x3f
---help---
Default mode of the instrumentation filter logic.
Bit 0 = Enable instrumentation
Bit 1 = Enable switch instrumentation
Bit 2 = Enable syscall instrumentation
Bit 3 = Enable IRQ instrumentation
Bit 4 = Enable dump instrumentation
Bit 5 = Enable collecting syscall arguments
menu "System performance monitor hooks choose"
config SCHED_INSTRUMENTATION_SWITCH
bool "Use note switch for instrumentation"
default n
---help---
Use note switch for instrumentation.
void sched_note_suspend(FAR struct tcb_s *tcb);
void sched_note_resume(FAR struct tcb_s *tcb);
If CONFIG_SMP is enabled, then these additional interfaces are
expected:
void sched_note_cpu_pause(FAR struct tcb_s *tcb, int cpu);
void sched_note_cpu_paused(FAR struct tcb_s *tcb);
void sched_note_cpu_resume(FAR struct tcb_s *tcb, int cpu);
void sched_note_cpu_resumed(FAR struct tcb_s *tcb);
NOTE: These are internal OS interfaces and are called at very
critical locations in the OS. There is very little that can be
done in these interfaces. For example, normal devices may not be
used; syslog output cannot be performed.
config SCHED_INSTRUMENTATION_PREEMPTION
bool "Preemption monitor hooks"
default n
---help---
Enables additional hooks for changes to pre-emption state. Board-
specific logic must provide this additional logic.
void sched_note_premption(FAR struct tcb_s *tcb, bool state);
config SCHED_INSTRUMENTATION_CSECTION
bool "Critical section monitor hooks"
default n
select IRQCOUNT
---help---
Enables additional hooks for entry and exit from critical sections.
Interrupts are disabled while within a critical section. Board-
specific logic must provide this additional logic.
void sched_note_csection(FAR struct tcb_s *tcb, bool state);
config SCHED_INSTRUMENTATION_SPINLOCKS
bool "Spinlock monitor hooks"
default n
---help---
Enables additional hooks for spinlock state. Board-specific logic
must provide this additional logic.
void sched_note_spinlock(FAR struct tcb_s *tcb, FAR volatile spinlock_t *spinlock, int type)
config SCHED_INSTRUMENTATION_SYSCALL
bool "System call monitor hooks"
default n
depends on ARCH_HAVE_SYSCALL_HOOKS
---help---
Enables additional hooks for entry and exit from system call.
Board-specific logic must provide this additional logic.
void sched_note_syscall_enter(int nr, int argc, ...);
void sched_note_syscall_leave(int nr, uintptr_t result);
config SCHED_INSTRUMENTATION_IRQHANDLER
bool "Interrupt handler monitor hooks"
default n
---help---
Enables additional hooks for interrupt handler. Board-specific logic
must provide this additional logic.
void sched_note_irqhandler(int irq, FAR void *handler, bool enter);
config SCHED_INSTRUMENTATION_DUMP
bool "Use note dump for instrumentation"
default n
---help---
Use note dump for instrumentation.
void sched_note_string(FAR const char *buf);
void sched_note_dump(uint32_t module, uint8_t event, FAR const void *buf, size_t len);
void sched_note_vprintf(FAR const char *fmt, va_list va);
void sched_note_vbprintf(uint32_t module, uint8_t event, FAR const char *fmt, va_list va);
void sched_note_printf(FAR const char *fmt, ...) printf_like(1, 2);
void sched_note_bprintf(uint32_t module, uint8_t event, FAR const char *fmt, ...);
endmenu # "System performance monitor hooks choose"
config DRIVER_NOTE
bool "Note Driver Support"
default n
if DRIVER_NOTE
config DRIVER_NOTE_MAX
int "Maximum number of sched_note drivers"
default 1
---help---
sched_note supports the maximum number of drivers
config DRIVER_NOTE_TASKNAME_BUFSIZE
int "Note task name buffer size"
default 256 if TASK_NAME_SIZE > 0
default 0 if TASK_NAME_SIZE = 0
---help---
The size of the in-memory task name buffer (in bytes).
The buffer is used to hold the name of the task during instrumentation.
Trace dump can find and show a task name corresponding to given pid in
the instrumentation data by using this buffer.
If 0 is specified, this feature is disabled and trace dump shows only
the name of the newly created task.
config DRIVER_NOTECTL
bool "Scheduler instrumentation filter control driver"
default n
depends on SCHED_INSTRUMENTATION_FILTER
---help---
If this option is selected, the instrumentation filter control device
/dev/notectl is provided.
choice
prompt "Note driver selection"
default DRIVER_NOTERAM
config DRIVER_NOTERAM
bool "Note RAM driver"
depends on !SCHED_INSTRUMENTATION_CSECTION && (!SCHED_INSTRUMENTATION_SPINLOCK || !SMP)
---help---
If this option is selected, then in-memory buffering logic is
enabled to capture scheduler instrumentation data. This has
the advantage that (1) the platform logic does not have to provide
the sched_note_* interfaces described for the previous settings.
Instead, the buffering logic catches all of these. It encodes
timestamps the scheduler note and adds the note to an in-memory,
circular buffer. And (2) buffering the scheduler instrumentation
data (versus performing some output operation) minimizes the impact
of the instrumentation on the behavior of the system. If the in-memory
buffer becomes full, then older notes are overwritten by newer notes.
A character driver is provided which can be used by an application
to read data from the in-memory, scheduler instrumentation "note"
buffer.
NOTE: This option is not available if critical sections are being
monitored (nor if spinlocks are being monitored in SMP configuration)
because there would be a logical error in the design in those cases.
That error is that these interfaces call enter_ and leave_critical_section
(which use spinlocks in SMP mode). That means that each call to
sched_note_get() causes several additional entries to be added from
the note buffer in order to remove one entry.
config DRIVER_NOTEARCH
bool "Note Arch driver"
---help---
The note driver is provided by arch specific code.
config DRIVER_NOTELOG
bool "Note syslog driver"
select SCHED_INSTRUMENTATION_EXTERNAL
---help---
The note driver output to syslog.
config SEGGER_SYSVIEW
bool "Note SEGGER SystemView driver"
select SEGGER_RTT
select SCHED_INSTRUMENTATION_EXTERNAL
---help---
SystemView is a real-time recording and visualization tool for embedded
systems that reveals the true runtime behavior of an application,
going far deeper than the system insights provided by debuggers. This is
particularly effective when developing and working with complex embedded
systems comprising multiple threads and interrupts. SystemView can ensure
unintended interactions and resource conflicts.
endchoice
config DRIVER_NOTERAM_BUFSIZE
int "Note RAM buffer size"
depends on DRIVER_NOTERAM
default 2048
---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.
endif # DRIVER_NOTE
endif # SCHED_INSTRUMENTATION