mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-12-26 17:18:24 +00:00
[smart] add CPU/thread usage tracing config (#8947)
* [smart] add CPU usage tracing config This patch introduces following features: - Added CPU usage tracing functionality, enabled by default, for applications like 'top' - update time as smart independent Signed-off-by: Shell <smokewood@qq.com> * fixup: add ump idle thread --------- Signed-off-by: Shell <smokewood@qq.com>
This commit is contained in:
@@ -686,37 +686,3 @@ rt_err_t lwp_backtrace_frame(rt_thread_t uthread, struct rt_hw_backtrace_frame *
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
void rt_update_process_times(void)
|
||||
{
|
||||
struct rt_thread *thread;
|
||||
#ifdef RT_USING_SMP
|
||||
struct rt_cpu* pcpu;
|
||||
|
||||
pcpu = rt_cpu_self();
|
||||
#endif
|
||||
|
||||
thread = rt_thread_self();
|
||||
|
||||
if (!IS_USER_MODE(thread))
|
||||
{
|
||||
thread->user_time += 1;
|
||||
#ifdef RT_USING_SMP
|
||||
pcpu->cpu_stat.user += 1;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
thread->system_time += 1;
|
||||
#ifdef RT_USING_SMP
|
||||
if (thread == pcpu->idle_thread)
|
||||
{
|
||||
pcpu->cpu_stat.idle += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
pcpu->cpu_stat.system += 1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user