the time of a plain callback
| 107 | |
| 108 | // the time of a plain callback |
| 109 | static void benchPlainCallbackLoop() |
| 110 | { |
| 111 | void (*counterIncrement) (void*, uint64_t) = testCounterAdd2; |
| 112 | |
| 113 | const uint64_t startCounter = TestCounter::get(); |
| 114 | const uint64_t benchStart = timestampBenchmark(); |
| 115 | |
| 116 | uint64_t i; |
| 117 | for( i = 0; i < 1000000; i++ ) |
| 118 | counterIncrement( nullptr, 1 ); |
| 119 | |
| 120 | const uint64_t benchDone = timestampBenchmark(); |
| 121 | const uint64_t endCounter = TestCounter::get(); |
| 122 | assert( endCounter - startCounter == i ); |
| 123 | |
| 124 | cout << "OK" << endl; |
| 125 | cout << "\tper round: " << double( benchDone - benchStart ) / double( i ) << "ns" << endl; |
| 126 | } |
| 127 | |
| 128 | // the time of a std::function callback |
| 129 | static void benchStdFunctionCallbackLoop() |
no test coverage detected