summaryrefslogtreecommitdiff
path: root/examples/kernel/cpuusage.c
diff options
context:
space:
mode:
author[email protected] <[email protected]>2011-07-15 14:45:08 +0000
committer[email protected] <[email protected]>2011-07-15 14:45:08 +0000
commitc9a5379a0c60814f071cf2a1cda59533d18f8668 (patch)
treed0ee50e5c4afe0f16b1209af4b0703f9df598e00 /examples/kernel/cpuusage.c
parentbe5f855a44ff118c12f6ac99893f3c6213b89df4 (diff)
minor fix of cpuusage.c in example
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1632 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'examples/kernel/cpuusage.c')
-rw-r--r--examples/kernel/cpuusage.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/examples/kernel/cpuusage.c b/examples/kernel/cpuusage.c
index 899d7cc20d..15666300b5 100644
--- a/examples/kernel/cpuusage.c
+++ b/examples/kernel/cpuusage.c
@@ -15,26 +15,25 @@ static void cpu_usage_idle_hook()
if (total_count == 0)
{
- loop = 0;
-
/* get total count */
rt_enter_critical();
tick = rt_tick_get();
while(rt_tick_get() - tick < CPU_USAGE_CALC_TICK)
{
total_count ++;
+ loop = 0;
while (loop < CPU_USAGE_LOOP) loop ++;
}
rt_exit_critical();
}
count = 0;
- loop = 0;
/* get CPU usage */
tick = rt_tick_get();
while (rt_tick_get() - tick < CPU_USAGE_CALC_TICK)
{
count ++;
+ loop = 0;
while (loop < CPU_USAGE_LOOP) loop ++;
}