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.
Fork of benchmark by
Revision 3:ec2e20a9bd03, committed 2017-02-28
- Comitter:
- mcx
- Date:
- Tue Feb 28 20:54:35 2017 +0000
- Parent:
- 2:fc68d524dd7d
- Commit message:
- Now prints out clock speed in MHz
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r fc68d524dd7d -r ec2e20a9bd03 main.cpp
--- a/main.cpp Thu Nov 19 21:41:58 2015 +0000
+++ b/main.cpp Tue Feb 28 20:54:35 2017 +0000
@@ -13,17 +13,25 @@
*/
#define ITERATIONS 1000000 // Number of calculations.
-#define CLOCK 48 // Clock freqency in MHz
+#define CLOCK 64 // Clock freqency in MHz
Timer timer; // Timer..
Serial pc(USBTX, USBRX);
float number_of_cycles, single_operation_time;
-volatile int a, b, c; // Int operands and result. Must be volatile!
-//volatile float a, b, c; // Float operands and result. Must be volatile!
+//volatile int a, b, c; // Int operands and result. Must be volatile!
+volatile float a, b, c; // Float operands and result. Must be volatile!
//volatile double a, b, c; // Float operands and result. Must be volatile!
int main() {
+ // Apparently I'm not getting full speed!?
+ // https://developer.mbed.org/forum/mbed/topic/229/?page=1
+ // https://developer.mbed.org/questions/55557/CPU-clock-of-upto-100MHz/
+ printf("SystemCoreClock = %d MHz\r\n", SystemCoreClock/1000000);
+ // Need external crystal to make it run faster?
+ // https://developer.mbed.org/users/dreschpe/code/ST_401_84MHZ/
+ // https://developer.mbed.org/users/oliverb/notebook/crystal-oscillator-notes/
+
unsigned int i, for_time, total_time, operation_time;
a=2.3;
b=5.33;
@@ -44,14 +52,15 @@
this for loop. */
for (i=0; i<ITERATIONS; i++){
- a = b;
+// a = b;
// c = a+b;
// c = a*b;
// c = a/b;
// a = sqrt(b);
// a = log(b);
// a = tanh(b);
-
+// a = (10*pow(b,3) + 105*b)/(pow(b,4) + 45*pow(b,2) + 105);
+ a = (10*b*b*b + 105*b)/(b*b*b*b + 45* + 105);
}
total_time=timer.read_us();
diff -r fc68d524dd7d -r ec2e20a9bd03 mbed.bld --- a/mbed.bld Thu Nov 19 21:41:58 2015 +0000 +++ b/mbed.bld Tue Feb 28 20:54:35 2017 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/9296ab0bfc11 \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/d75b3fe1f5cb \ No newline at end of file
