0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Namespaces | Macros | Typedefs | Functions
TestUtils.h File Reference

Helper functions to write simple benchmarks; benchmark tests can run parallel or serial. More...

#include "Config.h"
#include "SystemInfo.h"
#include "Stopwatch.h"
#include "Thread.h"
#include <boost/bind.hpp>
#include <cmath>
#include <limits>
#include <mutex>
Include dependency graph for TestUtils.h:

Go to the source code of this file.

Classes

class  Hypertable::TestStat
 Accumulates min, max, mean and stdev of the test results; based on the Welford method for numerical stability (see http://www.johndcook.com/standard_deviation.html) More...
 
struct  Hypertable::TestFun< FunT >
 Helper class wrapping the invocation of a single test function. More...
 
struct  Hypertable::Config::TestPolicy
 A Policy class for extending command line options. More...
 

Namespaces

 Hypertable
 Hypertable definitions
 
 Hypertable::Config
 

Macros

#define HT_BENCH_OUT(_label_, _n_, _w_)
 
#define HT_BENCH(_label_, _code_, _n_)
 
#define HT_BENCH1(_label_, _code_, _n_)
 

Typedefs

typedef Cons< TestPolicy,
DefaultPolicy > 
Hypertable::Config::DefaultTestPolicy
 

Functions

void Hypertable::print_proc_stat ()
 Prints statistics about the current process. More...
 
std::ostream & Hypertable::operator<< (std::ostream &out, const TestStat &stat)
 Prints a TestStat instance to a stream. More...
 
template<typename FunT >
void Hypertable::serial_run (FunT fun, size_t n, bool proc_stat=false)
 Runs a test serially n times in a row while accumulating the benchmark results. More...
 
template<typename FunT >
void Hypertable::parallel_run (FunT fun, size_t n, bool proc_stat=false)
 Runs a test in parallel n times in a row while accumulating the benchmark results. More...
 
template<typename FunT >
void Hypertable::run_test (FunT fun, bool proc_stat=false, const Properties *props=0)
 Runs a test based on command line parameters: More...
 

Detailed Description

Helper functions to write simple benchmarks; benchmark tests can run parallel or serial.

Calculates min/max/mean elapsed time.

Definition in file TestUtils.h.

Macro Definition Documentation

#define HT_BENCH (   _label_,
  _code_,
  _n_ 
)
Value:
do { \
Stopwatch _w; \
for (int i = 0, _n = (_n_); i < _n; ++i) { _code_; } \
_w.stop(); \
HT_BENCH_OUT(_label_, _n_, _w); \
} while (0)
#define HT_BENCH_OUT(_label_, _n_, _w_)
Definition: TestUtils.h:39

Definition at line 45 of file TestUtils.h.

#define HT_BENCH1 (   _label_,
  _code_,
  _n_ 
)
Value:
do { \
Stopwatch _w; _code_; _w.stop(); \
HT_BENCH_OUT(_label_, _n_, _w); \
} while (0)
#define HT_BENCH_OUT(_label_, _n_, _w_)
Definition: TestUtils.h:39

Definition at line 52 of file TestUtils.h.

#define HT_BENCH_OUT (   _label_,
  _n_,
  _w_ 
)
Value:
do { \
std::cout << ThisThread::get_id() <<": "<< (_label_) <<": " \
<< (_n_) / _w_.elapsed() <<"/s ("<< _w_.elapsed() / (_n_) * 1e6 \
<<"ns per)"<< std::endl; \
} while(0)

Definition at line 39 of file TestUtils.h.