APFEL 4.8.0
A PDF evolution library in C++
Loading...
Searching...
No Matches
timer.h
Go to the documentation of this file.
1//
2// APFEL++ 2017
3//
4// Author: Valerio Bertone: valerio.bertone@cern.ch
5//
6
7#pragma once
8
9#include "apfel/messages.h"
10
11#include <chrono>
12
13namespace apfel
14{
19 class Timer
20 {
21 public:
25 Timer() { start(); }
26
30 void start() { _startTime = std::chrono::steady_clock::now(); }
31
36 void stop(bool const& ForceDisplay = false)
37 {
38 auto end = std::chrono::steady_clock::now();
39 auto diff = end - _startTime;
40 if (GetVerbosityLevel() > 1 || ForceDisplay)
41 printf("Time elapsed: %5.6f seconds\n", std::chrono::duration <double, std::milli> (diff).count() * 1e-3);
42 }
43
44 private:
45 std::chrono::time_point<std::chrono::steady_clock> _startTime;
46 };
47}
The Timer class computes the time elapsed between start and stop.
Definition timer.h:20
void stop(bool const &ForceDisplay=false)
This function stops the timer and reports the elapsed time in seconds since the last time the timer w...
Definition timer.h:36
std::chrono::time_point< std::chrono::steady_clock > _startTime
Definition timer.h:45
Timer()
The Timer default constructor.
Definition timer.h:25
void start()
This function starts the timer.
Definition timer.h:30
Namespace for all APFEL++ functions and classes.
Definition alphaqcd.h:14
int GetVerbosityLevel()
Get Verbosity level.