Add profiling subsystem. Add perf util based on periodic stack unwinding. Perf from Linux was taken as a reference. The operation of module is based on frame pointer usage and saving registers during interruption handling. The unwinding function stay in timer as expiry functioin so is called during interruption handling. Thus the function have access to saved registers (program counter and frame pointer in particular) of the current thread and use it to unwind the thread stack. Timer starting and results printing function are made as shell commands for conveniency. Originally-by: Yonatan Goldschmidt <yon.goldschmidt@gmail.com> Signed-off-by: Mikhail Kushnerov <m.kushnerov@yadro.com>
24 lines
457 B
Plaintext
24 lines
457 B
Plaintext
# Copyright (c) 2023 KNS Group LLC (YADRO)
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
config PROFILING_PERF
|
|
bool "Perf support"
|
|
depends on THREAD_STACK_INFO
|
|
depends on !SMP
|
|
depends on FRAME_POINTER
|
|
depends on SHELL
|
|
depends on RISCV || X86
|
|
help
|
|
Enable perf shell command.
|
|
|
|
if PROFILING_PERF
|
|
|
|
config PROFILING_PERF_BUFFER_SIZE
|
|
int "Perf buffer size"
|
|
default 2048
|
|
help
|
|
Size of buffer, that used by perf to save samples from stack tracing.
|
|
|
|
endif
|