Sha256: 7665364eb9ebca579736f72bcf636317649c7745f24145d86d46c0667e23cd20
Contents?: true
Size: 1.05 KB
Versions: 30
Compression:
Stored size: 1.05 KB
Contents
// // Benchmark.h // DictionarySort // // Created by Samuel Williams on 2/11/11. // Copyright, 2014, by Samuel G. D. Williams. <http://www.codeotaku.com> // #pragma once #include <ctime> // A timer class for quickly checking the wall-clock performance of code. namespace Benchmark { typedef double TimeT; class WallTime { protected: mutable TimeT _last, _total; public: WallTime (); void reset (); TimeT total () const; }; class ProcessorTime { protected: mutable std::clock_t _last, _total; public: ProcessorTime(); void reset (); TimeT total () const; }; class Timer { protected: WallTime _wall_time; ProcessorTime _processor_time; public: Timer(); const WallTime & wall_time() const { return _wall_time; } const ProcessorTime & processor_time() const { return _processor_time; } void reset (); struct Sample { TimeT wall_time_total; TimeT processor_time_total; TimeT approximate_processor_usage() const { return processor_time_total / wall_time_total; } }; Sample sample() const; }; }
Version data entries
30 entries across 30 versions & 1 rubygems