minor fix of cpuusage.c in example
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1632 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
be5f855a44
commit
c9a5379a0c
|
@ -15,26 +15,25 @@ static void cpu_usage_idle_hook()
|
||||||
|
|
||||||
if (total_count == 0)
|
if (total_count == 0)
|
||||||
{
|
{
|
||||||
loop = 0;
|
|
||||||
|
|
||||||
/* get total count */
|
/* get total count */
|
||||||
rt_enter_critical();
|
rt_enter_critical();
|
||||||
tick = rt_tick_get();
|
tick = rt_tick_get();
|
||||||
while(rt_tick_get() - tick < CPU_USAGE_CALC_TICK)
|
while(rt_tick_get() - tick < CPU_USAGE_CALC_TICK)
|
||||||
{
|
{
|
||||||
total_count ++;
|
total_count ++;
|
||||||
|
loop = 0;
|
||||||
while (loop < CPU_USAGE_LOOP) loop ++;
|
while (loop < CPU_USAGE_LOOP) loop ++;
|
||||||
}
|
}
|
||||||
rt_exit_critical();
|
rt_exit_critical();
|
||||||
}
|
}
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
loop = 0;
|
|
||||||
/* get CPU usage */
|
/* get CPU usage */
|
||||||
tick = rt_tick_get();
|
tick = rt_tick_get();
|
||||||
while (rt_tick_get() - tick < CPU_USAGE_CALC_TICK)
|
while (rt_tick_get() - tick < CPU_USAGE_CALC_TICK)
|
||||||
{
|
{
|
||||||
count ++;
|
count ++;
|
||||||
|
loop = 0;
|
||||||
while (loop < CPU_USAGE_LOOP) loop ++;
|
while (loop < CPU_USAGE_LOOP) loop ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue