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.
main.cpp
00001 #include "mbed.h" 00002 extern "C" { 00003 #include "fx.h" 00004 } 00005 00006 #include <time.h> 00007 void sleepcp(int milliseconds); 00008 00009 void sleepcp(int milliseconds) // Cross-platform sleep function 00010 { 00011 clock_t time_end; 00012 time_end = clock() + milliseconds * CLOCKS_PER_SEC/1000; 00013 while (clock() < time_end) { 00014 } 00015 } 00016 00017 00018 //------------------------------------ 00019 // Hyperterminal configuration 00020 // 9600 bauds, 8-bit data, no parity 00021 //------------------------------------ 00022 00023 Serial pc(SERIAL_TX, SERIAL_RX); 00024 00025 DigitalOut myled(LED1); 00026 00027 int main() 00028 { 00029 00030 int Repetitions = 10000; 00031 int FxToCall = 100; 00032 00033 float x[20]; 00034 int count = 0; 00035 00036 while(1) { 00037 pc.printf("Starting %d repetitions\r\n",Repetitions); 00038 00039 clock_t start, end; 00040 double cpu_time_used; 00041 start = clock(); 00042 count = 0; 00043 00044 for (int r=0; r<Repetitions; r++) { 00045 for(int i=0; i<FxToCall; i++) { 00046 count += fxList[i](x); 00047 } 00048 } 00049 00050 end = clock(); 00051 long double diff = end-start; 00052 cpu_time_used = diff / ((long double)CLOCKS_PER_SEC / 1000.0); 00053 pc.printf("Elapsed time ms: %f\r\n",cpu_time_used); 00054 pc.printf("Elapsed time (ms) x repetition: %f\r\n",cpu_time_used/Repetitions); 00055 00056 00057 } 00058 }
Generated on Wed Jul 20 2022 17:17:04 by
1.7.2