Zephyr API Documentation 4.3.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Thread analyzer

Module for analyzing threads. More...

Data Structures

struct  thread_analyzer_info

Macros

#define THREAD_ANALYZE_STACK_SAFETY_NO_ISSUES   0
 Stack safety issue codes.
#define THREAD_ANALYZE_STACK_SAFETY_THRESHOLD_EXCEEDED   1
#define THREAD_ANALYZE_STACK_SAFETY_AT_LIMIT   2
#define THREAD_ANALYZE_STACK_SAFETY_OVERFLOW   3

Typedefs

typedef void(* thread_analyzer_stack_safety_handler) (struct k_thread *thread, size_t unused_space, uint32_t *stack_issue)
 Thread analyzer stack safety callback function.
typedef void(* thread_analyzer_cb) (struct thread_analyzer_info *info)
 Thread analyzer stack size callback function.

Functions

void thread_analyzer_stack_safety_handler_set (thread_analyzer_stack_safety_handler handler)
 Change the thread analyzer stack safety callback function.
void thread_analyzer_run (thread_analyzer_cb cb, unsigned int cpu)
 Run the thread analyzer and provide information to the callback.
void thread_analyzer_print (unsigned int cpu)
 Run the thread analyzer and print stack size statistics.

Detailed Description

Module for analyzing threads.

This module implements functions and the configuration that simplifies thread analysis.

Macro Definition Documentation

◆ THREAD_ANALYZE_STACK_SAFETY_AT_LIMIT

#define THREAD_ANALYZE_STACK_SAFETY_AT_LIMIT   2

◆ THREAD_ANALYZE_STACK_SAFETY_NO_ISSUES

#define THREAD_ANALYZE_STACK_SAFETY_NO_ISSUES   0

#include <zephyr/debug/thread_analyzer.h>

Stack safety issue codes.

◆ THREAD_ANALYZE_STACK_SAFETY_OVERFLOW

#define THREAD_ANALYZE_STACK_SAFETY_OVERFLOW   3

◆ THREAD_ANALYZE_STACK_SAFETY_THRESHOLD_EXCEEDED

#define THREAD_ANALYZE_STACK_SAFETY_THRESHOLD_EXCEEDED   1

Typedef Documentation

◆ thread_analyzer_cb

typedef void(* thread_analyzer_cb) (struct thread_analyzer_info *info)

#include <zephyr/debug/thread_analyzer.h>

Thread analyzer stack size callback function.

Callback function with thread analysis information.

Parameters
infoThread analysis information.

◆ thread_analyzer_stack_safety_handler

typedef void(* thread_analyzer_stack_safety_handler) (struct k_thread *thread, size_t unused_space, uint32_t *stack_issue)

#include <zephyr/debug/thread_analyzer.h>

Thread analyzer stack safety callback function.

Stack safety callback function.

Parameters
threadPointer to the thread being analyzed.
unused_spaceAmount of unused stack space.
stack_issuePointer to variable to store stack safety issue code

Function Documentation

◆ thread_analyzer_print()

void thread_analyzer_print ( unsigned int cpu)

#include <zephyr/debug/thread_analyzer.h>

Run the thread analyzer and print stack size statistics.

This function runs the thread analyzer and prints the output in standard form. In the special case when Kconfig option THREAD_ANALYZER_AUTO_SEPARATE_CORES is set, the function analyzes only the threads running on the specified cpu.

Parameters
cpucpu to analyze, ignored if THREAD_ANALYZER_AUTO_SEPARATE_CORES=n

◆ thread_analyzer_run()

void thread_analyzer_run ( thread_analyzer_cb cb,
unsigned int cpu )

#include <zephyr/debug/thread_analyzer.h>

Run the thread analyzer and provide information to the callback.

This function analyzes the current state for all threads and calls a given callback on every thread found. In the special case when Kconfig option THREAD_ANALYZER_AUTO_SEPARATE_CORES is set, the function analyzes only the threads running on the specified cpu.

Parameters
cbThe callback function handler
cpucpu to analyze, ignored if THREAD_ANALYZER_AUTO_SEPARATE_CORES=n

◆ thread_analyzer_stack_safety_handler_set()

void thread_analyzer_stack_safety_handler_set ( thread_analyzer_stack_safety_handler handler)

#include <zephyr/debug/thread_analyzer.h>

Change the thread analyzer stack safety callback function.

This function changes the thread analyzer's stack safety handler. This allows an application to customize behavior when a thread's unused stack drops below its configured threshold.

Parameters
handlerFunction pointer to the new handler (NULL for default)