工具/软件:
您好:
我有一个内核、它使用 ePWM 中断以及其他中断和 ISR 来运行控制循环。
我想测量空闲状态(即不在 ISR 或任何其他代码中)花费的时间以计算 CPU 负载。
其思路是使用 WFI 测量不间断时间、如下所示:
/* Record when uC goes to idle using a free run timer. */ wfi_ticks_start = CycleCounterP_getCount32(); /* Wait here until an interrupt occurs. WFI: Wait-For-Interrupt. */ CSL_armR5SetWFIMode(); /* If here, an interrupt has occurred. */ wfi_ticks_end = CycleCounterP_getCount32(); wfi_ticks = wfi_ticks_end - wfi_ticks_start;
但是、wfi_ticks 的值太小、不能合理。 我怀疑在低功耗模式(WFI)下、循环计数器也停止为 CycleCounterP_getCount32 ()提供低返回值。
当执行 WFI 时、CycleCounterP_getCount32 ()的时钟源是否停止?
谢谢你。