再裸机跑的情况下怎么计算RM48L952 CPU的使用率? 我需要对此芯片做测试和评估....
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi Renton ,
如下是大致例程,请再次帮我确认:
uint32 CPU = 0; //全局变量,用于计算CPU的使用率;
uint32 Save_CPU = 0; //进入定时器中断后,用于保存CPU的使用率值;
#define CPU_100 1000 //假设CPU空闲时,CPU值为1000;
int main(void)
{
while(1)
{
CPU ++;
其他处理函数;
中断处理:
等等; //均在主函数下运行;
}
}
void rtiNotification(uint32 notification) //定时器中断函数,如每1S中断一次;
{
Save_CPU = CPU;
CPU使用率(100%) = Save_CPU / 1000 ; //CPU 使用率;
CPU = 0;
}
这样处理可以吗??