2#ifndef STORMM_BENCHMARK_TEST_H
3#define STORMM_BENCHMARK_TEST_H
8#include "Constants/behavior.h"
13using constants::ExceptionResponse;
31 StopWatch(
const std::string &title_in = std::string(
"Timer"));
140 ExceptionResponse policy = ExceptionResponse::DIE)
const;
158 void assignTime(
int target,
double reference_time);
161 void assignTime(
const std::string &target,
double reference_time);
194 const std::string &referring_function = std::string(
""))
const;
197 const std::string &referring_function = std::string(
""))
const;
203 double time_at_last_test;
205 std::vector<double> category_start_times;
206 std::vector<double> category_total_times;
207 std::vector<double> category_squared_times;
209 std::vector<double> category_last_times;
210 std::vector<double> category_min_interval;
211 std::vector<double> category_max_interval;
212 std::vector<int> category_samples;
214 std::vector<std::string> category_names;
218 double translateCurrentTime()
const;
225 double2 computeDifferential(
int catg_a,
int catg_b)
const;
231 void validateCategoryIndex(
int index,
const std::string &referring_function)
const;
238 int validateCategoryName(
const std::string &query,
const std::string &referring_function)
const;
StopWatch(const std::string &title_in=std::string("Timer"))
The basic constructor records the time at which initialization was called and creates a section calle...
Definition stopwatch.cpp:25
double getCategoryDuration(int query_index) const
Get the duration recorded under any one category.
Definition stopwatch.cpp:75
double getTimeSinceStart() const
Get the time since this StopWatch was first started.
Definition stopwatch.cpp:65
double getTimeAtStart() const
Get the time at which this StopWatch was first started.
Definition stopwatch.cpp:55
~StopWatch()=default
Default destructor.
void assignTime(int target, double reference_time)
Assign an amount of time to this StopWatch.
Definition stopwatch.cpp:159
double2 timeDifferential(const std::string &catg_a, const std::string &catg_b, const std::string &referring_function=std::string("")) const
Obtain the time taken as the difference of two categories, catg_a - catg_b. The result is returned as...
Definition stopwatch.cpp:290
int getCategorySamples(int query_index) const
Get the maximum stretch of time recorded under any one category.
Definition stopwatch.cpp:119
std::string getCategoryName(int query_index) const
Get the name of a timing category based on its index in the program.
Definition stopwatch.cpp:130
double getCategoryAverageInterval(int query_index) const
Get the average interval of time observed for any given category.
Definition stopwatch.cpp:86
double getCategoryMaximumTime(int query_index) const
Get the maximum stretch of time recorded under any one category.
Definition stopwatch.cpp:108
StopWatch(const std::string &title_in=std::string("Timer"))
The basic constructor records the time at which initialization was called and creates a section calle...
Definition stopwatch.cpp:25
int addCategory(const std::string &name)
Add a section to the current StopWatch, if no such section already exists. Return the index of the se...
Definition stopwatch.cpp:193
double getTotalDuration() const
Report the total duration recorded by this stopwatch under all sections.
Definition stopwatch.cpp:154
StopWatch(const StopWatch &original)=default
With no const members or points to repair, the default copy and move constructors,...
double getTimeAtLastTest() const
Get the time at which this StopWatch last recorded a test (this is not necessarily the last time this...
Definition stopwatch.cpp:60
int getCategoryIndex(const std::string &query, ExceptionResponse policy=ExceptionResponse::DIE) const
Get the index of category based on its name. Returns -1 or an error if the named category is not pres...
Definition stopwatch.cpp:136
double getTimeSinceLastTest() const
Get the time since this StopWatch was last tested (see above for lengthier explanation).
Definition stopwatch.cpp:70
double getCategoryMinimumTime(int query_index) const
Get the minimum stretch of time recorded under any one category.
Definition stopwatch.cpp:98
void printResults(double precision=1.0e6)
Print the timings for this StopWatch.
Definition stopwatch.cpp:212
Definition stormm_vector_types.h:112