Jörg Mehring
/
Dhrystone
Dhrystone Benchmark Program C/1 12/01/84
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 #include "dhry.h" 00003 00004 DigitalOut myled(LED1); 00005 Timer timer; 00006 Serial pc(USBTX, USBRX); //serial channel over HDK USB interface 00007 00008 int main() { 00009 double benchtime, dps; 00010 unsigned long loops; 00011 00012 pc.baud(9600); 00013 printf("Dhrystone Benchmark Program C/1 12/01/84\r\n"); 00014 timer.start(); 00015 while(1) { 00016 loops = 0l; 00017 myled = 1; 00018 timer.reset(); 00019 do { 00020 Proc0(); 00021 loops += LOOPS; 00022 benchtime = timer.read(); 00023 } while (benchtime <= 60.000); 00024 myled = 0; 00025 dps = (double)loops / benchtime; 00026 printf("Dhrystone time for %ld passes = %.3f sek\r\n", loops, benchtime); 00027 printf("This machine benchmarks at %.0f dhrystones/second\r\n", dps); 00028 00029 wait(1.0); 00030 } 00031 }
Generated on Mon Jul 25 2022 04:12:17 by 1.7.2