timing: add kconfig CONFIG_TIMING_FUNCTIONS_NEED_AT_BOOT

This adds a new kconfig CONFIG_TIMING_FUNCTIONS_NEED_AT_BOOT so
that the timing subsystem can be initialized at boot, instead of
being #ifdef under thread runtime statistics. This will allow
other part of kernel and other subsystems to utilize the timing
functions.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2021-03-31 13:40:01 -07:00 committed by Anas Nashif
parent 70d0a1b6ef
commit 1559712b22
3 changed files with 13 additions and 2 deletions

View file

@ -369,7 +369,7 @@ if THREAD_RUNTIME_STATS
config THREAD_RUNTIME_STATS_USE_TIMING_FUNCTIONS
bool "Use timing functions to gather statistics"
select TIMING_FUNCTIONS
select TIMING_FUNCTIONS_NEED_AT_BOOT
help
Use timing functions to gather thread runtime statistics.

View file

@ -33,6 +33,7 @@
#include <stdbool.h>
#include <debug/gcov.h>
#include <kswap.h>
#include <timing/timing.h>
#include <logging/log.h>
LOG_MODULE_REGISTER(os, CONFIG_KERNEL_LOG_LEVEL);
@ -400,7 +401,7 @@ FUNC_NORETURN void z_cstart(void)
__stack_chk_guard <<= 8;
#endif /* CONFIG_STACK_CANARIES */
#ifdef CONFIG_THREAD_RUNTIME_STATS_USE_TIMING_FUNCTIONS
#ifdef CONFIG_TIMING_FUNCTIONS_NEED_AT_BOOT
timing_init();
timing_start();
#endif

View file

@ -7,3 +7,13 @@ config TIMING_FUNCTIONS
help
When enabled, timing related functions are compiled. This is
useful for gathering timing on code execution.
config TIMING_FUNCTIONS_NEED_AT_BOOT
bool
select TIMING_FUNCTIONS
help
Hidden option to indicate that timing functions need to be
initialized at boot.
To be selected by kernel and other subsystems which need
to use timing functions.