10 #ifndef LLVM_SUPPORT_TIMER_H 11 #define LLVM_SUPPORT_TIMER_H 33 TimeRecord() : WallTime(0), UserTime(0), SystemTime(0), MemUsed(0) {}
49 return WallTime < T.WallTime;
53 WallTime += RHS.WallTime;
54 UserTime += RHS.UserTime;
55 SystemTime += RHS.SystemTime;
56 MemUsed += RHS.MemUsed;
59 WallTime -= RHS.WallTime;
60 UserTime -= RHS.UserTime;
61 SystemTime -= RHS.SystemTime;
62 MemUsed -= RHS.MemUsed;
81 std::string Description;
90 init(Name, Description);
93 init(Name, Description, tg);
96 assert(!RHS.TG &&
"Can only copy uninitialized timers");
99 assert(!TG && !T.TG &&
"Can only assign uninit timers");
175 std::string Description;
177 PrintRecord(
const PrintRecord &
Other) =
default;
178 PrintRecord(
const TimeRecord &Time,
const std::string &Name,
179 const std::string &Description)
180 : Time(Time),
Name(Name), Description(Description) {}
182 bool operator <(
const PrintRecord &Other)
const {
183 return Time < Other.Time;
187 std::string Description;
188 Timer *FirstTimer =
nullptr;
189 std::vector<PrintRecord> TimersToPrint;
194 void operator=(
const TimerGroup &TG) =
delete;
205 Name.assign(NewName.
begin(), NewName.
end());
206 Description.assign(NewDescription.
begin(), NewDescription.
end());
215 const char *printJSONValues(
raw_ostream &OS,
const char *delim);
218 static const char *printAllJSONValues(
raw_ostream &OS,
const char *delim);
223 static void ConstructTimerLists();
228 void removeTimer(
Timer &
T);
229 void prepareToPrintList();
231 void printJSONValue(
raw_ostream &OS,
const PrintRecord &
R,
232 const char *suffix,
double Value);
static TimeRecord getCurrentTime(bool Start=true)
Get the current time and memory usage.
bool operator<(const TimeRecord &T) const
Compute iterated dominance frontiers using a linear time algorithm.
TimeRecord getTotalTime() const
Return the duration for which this timer has been running.
void stopTimer()
Stop the timer.
bool isRunning() const
Check if the timer is currently running.
The TimeRegion class is used as a helper class to call the startTimer() and stopTimer() methods of th...
double getUserTime() const
This class is basically a combination of TimeRegion and Timer.
const std::string & getName() const
This class is used to track the amount of time spent between invocations of its startTimer()/stopTime...
void print(const TimeRecord &Total, raw_ostream &OS) const
Print the current time record to OS, with a breakdown showing contributions to the Total time record...
initializer< Ty > init(const Ty &Val)
Timer()
Create an uninitialized timer, client must use 'init'.
Timer(StringRef Name, StringRef Description)
Timer(StringRef Name, StringRef Description, TimerGroup &tg)
ssize_t getMemUsed() const
void PrintStatisticsJSON(raw_ostream &OS)
Print statistics in JSON format.
double getProcessTime() const
double getSystemTime() const
const std::string & getDescription() const
bool isInitialized() const
void startTimer()
Start the timer running.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings"...
void setName(StringRef NewName, StringRef NewDescription)
static void clear(coro::Shape &Shape)
void operator+=(const TimeRecord &RHS)
The TimerGroup class is used to group together related timers into a single report that is printed wh...
double getWallTime() const
const Timer & operator=(const Timer &T)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
void operator-=(const TimeRecord &RHS)
This class implements an extremely fast bulk output stream that can only output to a stream...
StringRef - Represent a constant reference to a string, i.e.
bool hasTriggered() const
Check if startTimer() has ever been called on this timer.