Ale Mansut / Mbed 2 deprecated RF_000

Dependencies:   mbed

Revision:
1:2f4f6ea93f6b
Parent:
0:ae9de0bbe204
--- 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);
 
 
     }