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.
Diff: main.cpp
- Revision:
- 1:2f4f6ea93f6b
- Parent:
- 0:ae9de0bbe204
diff -r ae9de0bbe204 -r 2f4f6ea93f6b main.cpp
--- a/main.cpp Thu Apr 30 08:48:57 2020 +0000
+++ b/main.cpp Thu Apr 30 09:09:15 2020 +0000
@@ -27,8 +27,8 @@
int main()
{
- int Repetitions = 100;
- int FxToCall = 50;
+ int Repetitions = 10000;
+ int FxToCall = 100;
float x[20];
int count = 0;
@@ -39,7 +39,6 @@
clock_t start, end;
double cpu_time_used;
start = clock();
-
count = 0;
for (int r=0; r<Repetitions; r++) {
@@ -49,8 +48,10 @@
}
end = clock();
- cpu_time_used = ((double) (end - start)) / (CLOCKS_PER_SEC * 1000);
- pc.printf("Ticks elapsed: %d - Millisecs: %f",(end-start),cpu_time_used);
+ long double diff = end-start;
+ cpu_time_used = diff / ((long double)CLOCKS_PER_SEC / 1000.0);
+ pc.printf("Elapsed time ms: %f\r\n",cpu_time_used);
+ pc.printf("Elapsed time (ms) x repetition: %f\r\n",cpu_time_used/Repetitions);
}