KSeExpr  4.0.4.0
PerformanceTimer.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2020 L. E. Segovia <amy@amyspark.me>
2 // SPDX-License-Identifier: GPL-3.0-or-later
3 
4 #include <cstring>
5 #include <iostream>
6 
7 #include "Timer.h"
8 
9 namespace KSeExpr {
11  public:
12  PerformanceTimer(std::string l)
13  : label(std::move(l))
14  {
15  clock.start();
16  }
17 
19  std::cout << label << " (" << clock.elapsedTime() << " ms)" << std::endl;
20  }
21 
26 
27  private:
29  std::string label;
30  };
31 } // namespace KSeExpr
PerformanceTimer(std::string l)
PerformanceTimer & operator=(const PerformanceTimer &)=default
PerformanceTimer & operator=(PerformanceTimer &&)=default
PerformanceTimer(PerformanceTimer &)=default
PerformanceTimer(PerformanceTimer &&)=default
void start()
Definition: Timer.h:15
std::chrono::steady_clock::rep elapsedTime()
Definition: Timer.h:26