kernel: profiling: Expose an API call to analyze call stacks

The main, idle, interrupt and workqueue call stack definitions are not available
to applications to call stack_analyze() on, but they often require to be
measured empirically to tune their sizes in particular applications and
use cases.
This exposes a new k_call_stacks_analyze() API call that allows the
application to measure the used call stack space for the 4
kernel-defined call stacks.
Additionally for the ARC architecture the FIRQ stack is also profiled.

Change-id: I0cde149c7366cb6c4bbe8f9b0ab1cc5b56a36ed9
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
This commit is contained in:
Carles Cufi 2017-01-10 10:57:38 +01:00 committed by Anas Nashif
commit cb0cf9f5f4
3 changed files with 52 additions and 1 deletions

View file

@ -102,6 +102,34 @@ enum execution_context_types {
K_PREEMPT_THREAD,
};
/**
* @defgroup profiling_apis Profiling APIs
* @ingroup kernel_apis
* @{
*/
/**
* @brief Analyze the main, idle, interrupt and system workqueue call stacks
*
* This routine calls @ref stack_analyze on the 4 call stacks declared and
* maintained by the kernel. The sizes of those 4 call stacks are defined by:
*
* CONFIG_MAIN_STACK_SIZE
* CONFIG_IDLE_STACK_SIZE
* CONFIG_ISR_STACK_SIZE
* CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE
*
* @note CONFIG_INIT_STACKS and CONFIG_PRINTK must be set for this function to
* produce output.
*
* @return N/A
*/
extern void k_call_stacks_analyze(void);
/**
* @} end defgroup profiling_apis
*/
/**
* @defgroup thread_apis Thread APIs
* @ingroup kernel_apis