Line data Source code
1 0 : /*
2 : * Copyright (c) 2021,2023, Intel Corporation
3 : *
4 : * SPDX-License-Identifier: Apache-2.0
5 : */
6 :
7 : #ifndef ZEPHYR_INCLUDE_KERNEL_STATS_H_
8 : #define ZEPHYR_INCLUDE_KERNEL_STATS_H_
9 :
10 : #include <stdint.h>
11 : #include <stdbool.h>
12 :
13 : /**
14 : * Structure used to track internal statistics about both thread
15 : * and CPU usage.
16 : */
17 :
18 1 : struct k_cycle_stats {
19 1 : uint64_t total; /**< total usage in cycles */
20 : #if defined(CONFIG_SCHED_THREAD_USAGE_ANALYSIS) || defined(__DOXYGEN__)
21 : /**
22 : * @name Fields available when CONFIG_SCHED_THREAD_USAGE_ANALYSIS is selected.
23 : * @{
24 : */
25 1 : uint64_t current; /**< \# of cycles in current usage window */
26 1 : uint64_t longest; /**< \# of cycles in longest usage window */
27 1 : uint32_t num_windows; /**< \# of usage windows */
28 : /** @} */
29 : #endif /* CONFIG_SCHED_THREAD_USAGE_ANALYSIS */
30 1 : bool track_usage; /**< true if gathering usage stats */
31 : };
32 :
33 : #endif /* ZEPHYR_INCLUDE_KERNEL_STATS_H_ */
|