Zephyr API Documentation 4.2.0-rc3
A Scalable Open Source RTOS
 4.2.0-rc3
cpu_load.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024, Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_INCLUDE_DEBUG_CPU_LOAD_H_
8#define ZEPHYR_INCLUDE_DEBUG_CPU_LOAD_H_
9
10#include <stdbool.h>
11#include <stdint.h>
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
24
27
30
42int cpu_load_get(bool reset);
43
50void cpu_load_log_control(bool enable);
51
52/* Optional callback for cpu_load_cb_reg
53 *
54 * This will be called from the k_timer expiry_fn used for periodic logging.
55 * CONFIG_CPU_LOAD_LOG_PERIODICALLY must be configured to a positive value.
56 * Time spent in this callback must be kept to a minimum.
57 */
58typedef void (*cpu_load_cb_t)(uint8_t percent);
59
69int cpu_load_cb_reg(cpu_load_cb_t cb, uint8_t threshold_percent);
70
74
75#ifdef __cplusplus
76}
77#endif
78
79
80#endif /* ZEPHYR_INCLUDE_DEBUG_CPU_LOAD_H_ */
void cpu_load_on_enter_idle(void)
Hook called by the application specific hook on entering CPU idle.
void(* cpu_load_cb_t)(uint8_t percent)
Definition cpu_load.h:58
void cpu_load_on_exit_idle(void)
Hook called by the application specific hook on exiting CPU idle.
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.
int cpu_load_get(bool reset)
Get CPU load.
__UINT8_TYPE__ uint8_t
Definition stdint.h:88