/* ----------------------------------------------------------------------------- GSFramework Copyright 2001-2013 Emmanuel Julien. All Rights Reserved. ----------------------------------------------------------------------------- */ #ifndef __NBENCHMARK__ #define __NBENCHMARK__ #include "time/ntime.h" #include "container/smart_median_average.h" namespace GS { /*! @short Benchmark. @author Emmanuel Julien (ejulien@owloh.com) */ class Benchmark { SmartMedianAverage avg; Time r_clock, t_clock; public: void Start(); void Stop(); float GetMs() const; void Reset(); Benchmark(bool start = false); }; /// Scoped benchmark. struct ScopedBenchmark { Benchmark &bench; ScopedBenchmark(Benchmark &b) : bench(b) { bench.Start(); } ~ScopedBenchmark() { bench.Stop(); } }; } // GS #endif // __NBENCHMARK__