Electroneum
test_runner< T > Class Template Reference

#include <performance_tests.h>

Public Member Functions

 test_runner (const Params &params)
 
bool run ()
 
int elapsed_time () const
 
size_t get_size () const
 
int time_per_call (int scale=1) const
 
uint64_t get_min () const
 
uint64_t get_max () const
 
double get_mean () const
 
uint64_t get_median () const
 
double get_stddev () const
 
double get_non_parametric_skew () const
 
std::vector< uint64_tget_quantiles (size_t n) const
 
bool is_same_distribution (size_t npoints, double mean, double stddev) const
 

Detailed Description

template<typename T>
class test_runner< T >

Definition at line 80 of file performance_tests.h.

Constructor & Destructor Documentation

◆ test_runner()

template<typename T>
test_runner< T >::test_runner ( const Params params)
inline

Definition at line 83 of file performance_tests.h.

84  : m_elapsed(0)
85  , m_params(params)
86  , m_per_call_timers(T::loop_count * params.loop_multiplier, {true})
87  {
88  }
unsigned loop_multiplier

Member Function Documentation

◆ elapsed_time()

template<typename T>
int test_runner< T >::elapsed_time ( ) const
inline

Definition at line 120 of file performance_tests.h.

120 { return m_elapsed; }
Here is the caller graph for this function:

◆ get_max()

template<typename T>
uint64_t test_runner< T >::get_max ( ) const
inline

Definition at line 130 of file performance_tests.h.

130 { return m_stats->get_max(); }
Here is the caller graph for this function:

◆ get_mean()

template<typename T>
double test_runner< T >::get_mean ( ) const
inline

Definition at line 131 of file performance_tests.h.

131 { return m_stats->get_mean(); }
Here is the caller graph for this function:

◆ get_median()

template<typename T>
uint64_t test_runner< T >::get_median ( ) const
inline

Definition at line 132 of file performance_tests.h.

132 { return m_stats->get_median(); }
Here is the caller graph for this function:

◆ get_min()

template<typename T>
uint64_t test_runner< T >::get_min ( ) const
inline

Definition at line 129 of file performance_tests.h.

129 { return m_stats->get_min(); }
Here is the caller graph for this function:

◆ get_non_parametric_skew()

template<typename T>
double test_runner< T >::get_non_parametric_skew ( ) const
inline

Definition at line 134 of file performance_tests.h.

134 { return m_stats->get_non_parametric_skew(); }
Here is the caller graph for this function:

◆ get_quantiles()

template<typename T>
std::vector<uint64_t> test_runner< T >::get_quantiles ( size_t  n) const
inline

Definition at line 135 of file performance_tests.h.

135 { return m_stats->get_quantiles(n); }
Here is the caller graph for this function:

◆ get_size()

template<typename T>
size_t test_runner< T >::get_size ( ) const
inline

Definition at line 121 of file performance_tests.h.

121 { return m_stats->get_size(); }
Here is the caller graph for this function:

◆ get_stddev()

template<typename T>
double test_runner< T >::get_stddev ( ) const
inline

Definition at line 133 of file performance_tests.h.

133 { return m_stats->get_standard_deviation(); }
Here is the caller graph for this function:

◆ is_same_distribution()

template<typename T>
bool test_runner< T >::is_same_distribution ( size_t  npoints,
double  mean,
double  stddev 
) const
inline

Definition at line 137 of file performance_tests.h.

138  {
139  return m_stats->is_same_distribution_99(npoints, mean, stddev);
140  }
Here is the caller graph for this function:

◆ run()

template<typename T>
bool test_runner< T >::run ( )
inline

Definition at line 90 of file performance_tests.h.

91  {
92  static_assert(0 < T::loop_count, "T::loop_count must be greater than 0");
93 
94  T test;
95  if (!test.init())
96  return false;
97 
98  performance_timer timer;
99  timer.start();
100  warm_up();
101  if (m_params.verbose)
102  std::cout << "Warm up: " << timer.elapsed_ms() << " ms" << std::endl;
103 
104  timer.start();
105  for (size_t i = 0; i < T::loop_count * m_params.loop_multiplier; ++i)
106  {
107  if (m_params.stats)
108  m_per_call_timers[i].resume();
109  if (!test.test())
110  return false;
111  if (m_params.stats)
112  m_per_call_timers[i].pause();
113  }
114  m_elapsed = timer.elapsed_ms();
115  m_stats.reset(new Stats<tools::PerformanceTimer, uint64_t>(m_per_call_timers));
116 
117  return true;
118  }
const uint32_t T[512]
unsigned loop_multiplier
Here is the caller graph for this function:

◆ time_per_call()

template<typename T>
int test_runner< T >::time_per_call ( int  scale = 1) const
inline

Definition at line 123 of file performance_tests.h.

124  {
125  static_assert(0 < T::loop_count, "T::loop_count must be greater than 0");
126  return m_elapsed * scale / (T::loop_count * m_params.loop_multiplier);
127  }
unsigned loop_multiplier
Here is the caller graph for this function:

The documentation for this class was generated from the following file: