Only access Zephyr thread stats info when it's available (#3962)

This commit is contained in:
TianlongLiang
2024-12-19 14:26:34 +08:00
committed by GitHub
parent 09c2abde4a
commit 932eb5d9e5
3 changed files with 14 additions and 1 deletions

View File

@ -14,6 +14,9 @@ os_time_get_boot_us()
uint64
os_time_thread_cputime_us(void)
{
/* On certain boards, enabling userspace could impact the collection of
* thread runtime statistics */
#ifdef CONFIG_THREAD_RUNTIME_STATS
k_tid_t tid;
struct k_thread_runtime_stats stats;
uint32 clock_freq;
@ -27,4 +30,7 @@ os_time_thread_cputime_us(void)
}
return time_in_us;
#else
return os_time_get_boot_us();
#endif
}