2011-02-19 00:15:24 +02:00
|
|
|
#ifndef __CXXMPH_BENCHMARK_H__
|
|
|
|
#define __CXXMPH_BENCHMARK_H__
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <typeinfo>
|
|
|
|
|
|
|
|
namespace cxxmph {
|
|
|
|
|
|
|
|
class Benchmark {
|
|
|
|
public:
|
2011-05-23 21:01:08 +03:00
|
|
|
Benchmark() {}
|
|
|
|
virtual ~Benchmark() {}
|
|
|
|
|
2011-02-19 00:15:24 +02:00
|
|
|
const std::string& name() { return name_; }
|
|
|
|
void set_name(const std::string& name) { name_ = name; }
|
|
|
|
|
|
|
|
static void Register(Benchmark* bm);
|
|
|
|
static void RunAll();
|
|
|
|
|
|
|
|
protected:
|
2011-05-24 03:18:24 +03:00
|
|
|
virtual bool SetUp() { return true; };
|
2011-05-23 21:01:08 +03:00
|
|
|
virtual void Run() = 0;
|
2011-05-24 03:18:24 +03:00
|
|
|
virtual bool TearDown() { return true; };
|
2011-02-19 00:15:24 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
std::string name_;
|
|
|
|
void MeasureRun();
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace cxxmph
|
|
|
|
|
|
|
|
#endif
|