summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRbb666 <[email protected]>2026-03-16 13:28:12 +0800
committerRbb666 <[email protected]>2026-04-07 14:49:15 +0800
commit4025c514075387813e76d959d7b43f530725705c (patch)
treeaffdaf9d257dcfa224afb546f83d014037e915dc /include
parent29e5f61fb9a03722c5fba65a963b2d7840587de0 (diff)
[kernel]Rewrite rt_thread_get_usage to use incremental statistics based on sampling windows.
Diffstat (limited to 'include')
-rw-r--r--include/rtdef.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/rtdef.h b/include/rtdef.h
index 0dc919e77e..db711aadff 100644
--- a/include/rtdef.h
+++ b/include/rtdef.h
@@ -935,6 +935,8 @@ struct rt_thread
#ifdef RT_USING_CPU_USAGE_TRACER
rt_ubase_t user_time; /**< Ticks on user */
rt_ubase_t system_time; /**< Ticks on system */
+ rt_ubase_t total_time_prev; /**< Previous total ticks snapshot */
+ rt_uint8_t cpu_usage; /**< Recent CPU usage in percent */
#endif /* RT_USING_CPU_USAGE_TRACER */
#ifdef RT_USING_MEM_PROTECTION