linbox
TimeWatcher Class Reference

Helper. More...

#include <benchmark.h>

Public Member Functions

 TimeWatcher (dvector_t &pts, dvector_t &vals)
 constructor.
 
 TimeWatcher ()
 Null Constructor. The pointers are intialised to NULL.
 
void init (dvector_t &pts, dvector_t &vals)
 
dvector_trefX ()
 returns the vector of abscissa (points)
 
dvector_trefY ()
 returns the vector of ordiantes (values)
 
double predict (double x)
 Prediction for the next experiment time.
 
bool keepon (size_t &repet, double tim, bool usePrediction=false)
 Watches a timer and a number and repet and signals if over.
 
size_t size () const
 size
 
void clear ()
 clear the pointers (not the settings)
 

Detailed Description

Helper.

This helper has several functions :

  • Records the timings
  • predict the execution time for the next experiment
  • helps producing enough experiments (but not too much and not too time consuming) for producing a valid measure.
Warning
if the timings are too short, this may not be accurate.

See member function help for more information.

Constructor & Destructor Documentation

◆ TimeWatcher() [1/2]

TimeWatcher ( dvector_t & pts,
dvector_t & vals )

constructor.

Inits the time watcher with a pair of points/values

Parameters
ptsvector of points
valsvector of times

◆ TimeWatcher() [2/2]

Null Constructor. The pointers are intialised to NULL.

Member Function Documentation

◆ init()

void init ( dvector_t & pts,
dvector_t & vals )

◆ refX()

dvector_t & refX ( )

returns the vector of abscissa (points)

◆ refY()

dvector_t & refY ( )

returns the vector of ordiantes (values)

◆ predict()

double predict ( double x)

Prediction for the next experiment time.

It is assumed that predict(0)=0. If Curent_<3, a linear, then quadratic fit is done. Other wise, a cubic fit is performed.

Parameters
xthe next evaluation point.
Returns
f(x) where f tries to fit the points : \( f(\mathtt{Data\_}[0][0..\mathtt{Current\_}-1]) \approx refY()[0..\mathtt{Current\_}-1]\)

◆ keepon()

bool keepon ( size_t & repet,
double tim,
bool usePrediction = false )

Watches a timer and a number and repet and signals if over.

We want at least 2 repetions but not more than maxtime spent on timing.

Parameters
repetnumber of previous repetitions. Should be 0 on the first time keepon is called.
timtimer to watch
maxtimemaximum time (in seconds) until watchon tells stop.
Returns
true if we conditions are not met to stop, false otherwise.
Precondition
tim should have been started previously !

◆ size()

size_t size ( ) const

size

◆ clear()

void clear ( )

clear the pointers (not the settings)


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