Zephyr API Documentation 4.2.0-rc1
A Scalable Open Source RTOS
|
|
4.2.0-rc1 |
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. | |
Module for monitoring CPU Load
This module allow monitoring of the CPU load.
typedef void(* cpu_load_cb_t) (uint8_t percent) |
#include <zephyr/debug/cpu_load.h>
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.
cb | Pointer to the callback function. NULL will cancel the callback. |
threshold_percent | Threshold [0...100]. CPU load equal or greater that this will trigger the callback. |
0 | - Callback registered/cancelled. |
-EINVAL | if the threshold is invalid. |
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.
reset | Reset the measurement after reading. |
Positive | number - CPU load in per mille. |
Negative | number - error code. |
void cpu_load_log_control | ( | bool | enable | ) |
#include <zephyr/debug/cpu_load.h>
Control periodic CPU statistics report.
Report logging is by default enabled.
enable | true to enable report logging and false to disable. |
void cpu_load_on_enter_idle | ( | void | ) |
#include <zephyr/debug/cpu_load.h>
Hook called by the application specific hook on entering CPU 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.