MCPcopy Create free account
hub / github.com/cinder/Cinder / benchPlainCallbackLoop

Function benchPlainCallbackLoop

test/SignalsTest/src/SignalsBenchmark.cpp:109–126  ·  view source on GitHub ↗

the time of a plain callback

Source from the content-addressed store, hash-verified

107
108// the time of a plain callback
109static 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
129static void benchStdFunctionCallbackLoop()

Callers 1

mainFunction · 0.85

Calls 3

timestampBenchmarkFunction · 0.85
assertFunction · 0.85
getFunction · 0.50

Tested by

no test coverage detected