Content  


Using custom Writers and Timers

If the supplemented classes for use as MyDBImpl and MyTimerImpl are not sufficient, a guide for own implementations is given.

MyDBImpl

MyDBImpl needs two member functions. The first reads a host from the database and the second stores a test and its associated parameters in the database.

Custom Writer
  1. class MyDBImpl
  2. {
  3. public:
  4. // Reads a host from the HOST-table with the given HostName
  5. const viennaprofiler::Host getHost(std::string hostName) {...}
  6. // Inserts the given benchmark and the given parameters in
  7. // the TEST-table respectively the PARAMETER-table
  8. void insertTest(Benchmark const & test, std::vector<Parameter> parameters) {...}
  9. };

MyTimerImpl

The concept for MyTimerImpl requires three member-functions. The first one to start the timer, the second one to stop the timer and the last one to acquire the elapsed time.

Custom Timer
  1. class MyTimerImpl
  2. {
  3. public:
  4. // Starts the timer
  5. void start() {...}
  6.  
  7. // Stops the timer
  8. void stop() {...}
  9.  
  10. // Gives the elapsed time between start() and stop() in "seconds"
  11. double elapsed() const {...}
  12. };