Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed-rtos mbed QEI
Diff: System/system.cpp
- Revision:
- 42:6504d85d85b4
- Parent:
- 28:4e20b44251c6
diff -r 26e5f24b55b3 -r 6504d85d85b4 System/system.cpp
--- a/System/system.cpp Thu Apr 11 18:49:08 2013 +0000
+++ b/System/system.cpp Thu Apr 11 19:49:46 2013 +0000
@@ -7,7 +7,7 @@
Ticker CPUIdleMeasureTicker;
volatile unsigned int nopctr = 0;
-const float s_per_nopcycle = 1.0f/24000000.0f;
+const float s_per_nopcycle = 1.0f/16000000.0f;
float CpuUsage = 0;
@@ -17,9 +17,11 @@
}
void PostAndResetCPUIdle(){
- CpuUsage = 1.0f - (s_per_nopcycle * nopctr);
+ static int oldnopctr = 0;
+ int deltanop = nopctr - oldnopctr;
+ oldnopctr = nopctr;
+ CpuUsage = 1.0f - (s_per_nopcycle * deltanop);
Printing::updateval(10,CpuUsage);
- nopctr = 0;
}
void measureCPUidle (void const*){