MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/TriangleMeshDistance / BenchmarkLooper

Class BenchmarkLooper

tests/catch.hpp:2550–2581  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2548namespace Catch {
2549
2550 class BenchmarkLooper {
2551
2552 std::string m_name;
2553 std::size_t m_count = 0;
2554 std::size_t m_iterationsToRun = 1;
2555 uint64_t m_resolution;
2556 Timer m_timer;
2557
2558 static auto getResolution() -> uint64_t;
2559 public:
2560 // Keep most of this inline as it's on the code path that is being timed
2561 BenchmarkLooper( StringRef name )
2562 : m_name( name ),
2563 m_resolution( getResolution() )
2564 {
2565 reportStart();
2566 m_timer.start();
2567 }
2568
2569 explicit operator bool() {
2570 if( m_count < m_iterationsToRun )
2571 return true;
2572 return needsMoreIterations();
2573 }
2574
2575 void increment() {
2576 ++m_count;
2577 }
2578
2579 void reportStart();
2580 auto needsMoreIterations() -> bool;
2581 };
2582
2583} // end namespace Catch
2584

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected