@@ -366,15 +366,12 @@ class measurements {
366366 }
367367 measurements (int iterations) {
368368 _time_intervals.reserve (iterations);
369- clear ();
370- }
371- void clear () {
372- _time_intervals.clear ();
373369 }
374- void start () {
370+
371+ inline void start () {
375372 _startTime = std::chrono::steady_clock::now ();
376373 }
377- void stop () {
374+ inline void stop () {
378375 auto _endTime = std::chrono::steady_clock::now ();
379376 // store the end time and start time
380377 _time_intervals.push_back (std::make_pair (_startTime, _endTime));
@@ -388,21 +385,25 @@ class measurements {
388385 auto total_duration = std::accumulate (
389386 _time_intervals.begin (),
390387 _time_intervals.end (),
391- 0 , // Start with 0 count
388+ 0 , // Start with 0 count
392389 [](long long total, const std::pair<time_point, time_point>& interval) {
393390 // Compute the difference and add it to the total
394- return total + std::chrono::duration_cast<std::chrono::microseconds>(interval.second - interval.first ).count ();
395- }
396- );
391+ return total + std::chrono::duration_cast<std::chrono::microseconds>(
392+ interval.second - interval.first )
393+ .count ();
394+ });
397395 long long averageTimePerFrame = total_duration / _time_intervals.size ();
398396 long long sumOfSquareDiff = 0 ;
399397 std::for_each (_time_intervals.begin (),
400398 _time_intervals.end (),
401- [&](const std::pair<time_point, time_point>& interval) {
402- long long duration = std::chrono::duration_cast<std::chrono::microseconds>(interval.second - interval.first ).count ();
403- long long diff = duration - averageTimePerFrame;
404- sumOfSquareDiff += diff * diff;
405- });
399+ [&](const std::pair<time_point, time_point>& interval) {
400+ long long duration =
401+ std::chrono::duration_cast<std::chrono::microseconds>(
402+ interval.second - interval.first )
403+ .count ();
404+ long long diff = duration - averageTimePerFrame;
405+ sumOfSquareDiff += diff * diff;
406+ });
406407 double stdDev = std::sqrt (sumOfSquareDiff / _time_intervals.size ());
407408 double relError = 100 * (stdDev / averageTimePerFrame);
408409 return relError;
@@ -411,7 +412,7 @@ class measurements {
411412private:
412413 using time_point = std::chrono::steady_clock::time_point;
413414 time_point _startTime;
414- std::vector< std::pair<time_point, time_point> > _time_intervals;
415+ std::vector<std::pair<time_point, time_point>> _time_intervals;
415416};
416417
417418namespace internal {
0 commit comments