不韋 呂
/
UIT2_ExecutionTime
Measurment of execution time for sin() and sinf() functions for ST Nucleo F401RE.
Diff: main.cpp
- Revision:
- 1:33dad37b0caf
- Parent:
- 0:24dff9fbc559
--- a/main.cpp Wed Oct 29 07:58:27 2014 +0000 +++ b/main.cpp Wed Oct 29 08:06:05 2014 +0000 @@ -11,21 +11,24 @@ int main() { + const int COUNT = 10; while (true) { if (sw1_ == 0) { dOut_.write(1); - float x1 = sinf(0.1f); + for (int n=0; n<COUNT; n++) + volatile float x1 = sinf(0.1f); dOut_.write(0); } else { dOut_.write(1); - double x1 = sin(0.1); + for (int n=0; n<COUNT; n++) + volatile double x1 = sin(0.1); dOut_.write(0); } - wait_us(50); // 0.05 ms + wait_us(500); // 0.05 ms } }