NAGASH 0.9.8
Next Generation Analysis System
Loading...
Searching...
No Matches
Timer.h
Go to the documentation of this file.
1//***************************************************************************************
4//***************************************************************************************
5
6#pragma once
7
8#include "NAGASH/Global.h"
9#include "NAGASH/Tool.h"
10
11namespace NAGASH
12{
13 class Timer : public Tool
14 {
15 public:
19 Timer(std::shared_ptr<MSGTool> msg, const TString &name = "Timer") : Tool(msg), TimerName(name) {}
20 void PrintCurrent(const TString &prefix = "");
21 void Record(const TString &Name);
22 void Duration(const TString &Name1, const TString &Name2);
23 void Clear();
24
25 private:
26 std::vector<std::chrono::time_point<std::chrono::system_clock>> TimeRecord;
27 std::map<TString, int> TimeIndexMap;
28 std::vector<TString> TimeRecordName;
29 TString TimerName;
30 };
31
32} // namespace NAGASH
Some global definitions.
calculate the time interval between two time stamps.
Definition Timer.h:14
std::vector< TString > TimeRecordName
Definition Timer.h:28
void PrintCurrent(const TString &prefix="")
Print the current time.
Definition Timer.cxx:18
void Duration(const TString &Name1, const TString &Name2)
Print the time interval between two time stamps.
Definition Timer.cxx:46
std::map< TString, int > TimeIndexMap
Definition Timer.h:27
std::vector< std::chrono::time_point< std::chrono::system_clock > > TimeRecord
Definition Timer.h:26
TString TimerName
Definition Timer.h:29
void Record(const TString &Name)
Record the current time.
Definition Timer.cxx:28
Timer(std::shared_ptr< MSGTool > msg, const TString &name="Timer")
Constructor.
Definition Timer.h:19
void Clear()
Clear all the time stamps.
Definition Timer.cxx:101
Provide interface for all tools in NAGASH.
Definition Tool.h:72
std::shared_ptr< MSGTool > msg
Definition Tool.h:88