File indexing completed on 2026-06-02 08:17:15
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include "apfel/messages.h"
0010
0011 #include <chrono>
0012
0013 namespace apfel
0014 {
0015
0016
0017
0018
0019 class Timer
0020 {
0021 public:
0022
0023
0024
0025 Timer() { start(); }
0026
0027
0028
0029
0030 void start() { _startTime = std::chrono::steady_clock::now(); }
0031
0032
0033
0034
0035
0036 void stop(bool const& ForceDisplay = false)
0037 {
0038 auto end = std::chrono::steady_clock::now();
0039 auto diff = end - _startTime;
0040 if (GetVerbosityLevel() > 1 || ForceDisplay)
0041 printf("Time elapsed: %5.6f seconds\n", std::chrono::duration <double, std::milli> (diff).count() * 1e-3);
0042 }
0043
0044 private:
0045 std::chrono::time_point<std::chrono::steady_clock> _startTime;
0046 };
0047 }