CMS 3D CMS Logo

BenchmarkGrd.h
Go to the documentation of this file.
1 #ifndef DETECTOR_DESCRIPTION_BENCHMARK_GRD_H
2 #define DETECTOR_DESCRIPTION_BENCHMARK_GRD_H
3 
5 
6 #include <string>
7 #include <chrono>
8 
9 class BenchmarkGrd {
10 public:
11  BenchmarkGrd(const std::string &name) : m_start(std::chrono::high_resolution_clock::now()), m_name(name) {}
12 
14  std::chrono::duration<double, std::milli> diff = std::chrono::high_resolution_clock::now() - m_start;
15  edm::LogVerbatim("Geometry") << "Benchmark '" << m_name << "' took " << diff.count() << " millis\n";
16  }
17 
18 private:
19  std::chrono::time_point<std::chrono::high_resolution_clock> m_start;
21 };
22 
23 #ifdef BENCHMARK_ON
24 #define BENCHMARK_START(X) \
25  { \
26  BenchmarkGrd(#X)
27 #define BENCHMARK_END }
28 #else
29 #define BENCHMARK_START(X)
30 #define BENCHMARK_END
31 #endif
32 
33 #endif
change_name.diff
diff
Definition: change_name.py:13
MessageLogger.h
fileCollector.now
now
Definition: fileCollector.py:207
BenchmarkGrd::BenchmarkGrd
BenchmarkGrd(const std::string &name)
Definition: BenchmarkGrd.h:11
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LogVerbatim
Definition: MessageLogger.h:297
BenchmarkGrd::m_start
std::chrono::time_point< std::chrono::high_resolution_clock > m_start
Definition: BenchmarkGrd.h:19
BenchmarkGrd::m_name
std::string m_name
Definition: BenchmarkGrd.h:20
BenchmarkGrd::~BenchmarkGrd
~BenchmarkGrd()
Definition: BenchmarkGrd.h:13
std
Definition: JetResolutionObject.h:76
BenchmarkGrd
Definition: BenchmarkGrd.h:9
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17