Zephyr API Documentation 4.2.0-rc1
A Scalable Open Source RTOS
 4.2.0-rc1
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
CPU load monitor

Module for monitoring CPU Load More...

Typedefs

typedef void(* cpu_load_cb_t) (uint8_t percent)
 

Functions

void cpu_load_on_enter_idle (void)
 Hook called by the application specific hook on entering CPU idle.
 
void cpu_load_on_exit_idle (void)
 Hook called by the application specific hook on exiting CPU idle.
 
int cpu_load_get (bool reset)
 Get CPU load.
 
void cpu_load_log_control (bool enable)
 Control periodic CPU statistics report.
 
int cpu_load_cb_reg (cpu_load_cb_t cb, uint8_t threshold_percent)
 Optional registration of callback when load is greater or equal to the threshold.
 

Detailed Description

Module for monitoring CPU Load

This module allow monitoring of the CPU load.

Typedef Documentation

◆ cpu_load_cb_t

typedef void(* cpu_load_cb_t) (uint8_t percent)

Function Documentation

◆ cpu_load_cb_reg()

int cpu_load_cb_reg ( cpu_load_cb_t cb,
uint8_t threshold_percent )

#include <zephyr/debug/cpu_load.h>

Optional registration of callback when load is greater or equal to the threshold.

Parameters
cbPointer to the callback function. NULL will cancel the callback.
threshold_percentThreshold [0...100]. CPU load equal or greater that this will trigger the callback.
Return values
0- Callback registered/cancelled.
-EINVALif the threshold is invalid.

◆ cpu_load_get()

int cpu_load_get ( bool reset)

#include <zephyr/debug/cpu_load.h>

Get CPU load.

CPU load is measured using a timer which tracks amount of time spent in the CPU idle. Since it is a software tracking there is some small overhead. Precision depends on the frequency of the timer in relation to the CPU frequency.

Parameters
resetReset the measurement after reading.
Return values
Positivenumber - CPU load in per mille.
Negativenumber - error code.

◆ cpu_load_log_control()

void cpu_load_log_control ( bool enable)

#include <zephyr/debug/cpu_load.h>

Control periodic CPU statistics report.

Report logging is by default enabled.

Parameters
enabletrue to enable report logging and false to disable.

◆ cpu_load_on_enter_idle()

void cpu_load_on_enter_idle ( void )

#include <zephyr/debug/cpu_load.h>

Hook called by the application specific hook on entering CPU idle.

◆ cpu_load_on_exit_idle()

void cpu_load_on_exit_idle ( void )

#include <zephyr/debug/cpu_load.h>

Hook called by the application specific hook on exiting CPU idle.