9#ifndef LLVM_SUPPORT_TIMER_H
10#define LLVM_SUPPORT_TIMER_H
28 double WallTime = 0.0;
29 double UserTime = 0.0;
30 double SystemTime = 0.0;
51 return WallTime <
T.WallTime;
55 WallTime +=
RHS.WallTime;
56 UserTime +=
RHS.UserTime;
57 SystemTime +=
RHS.SystemTime;
58 MemUsed +=
RHS.MemUsed;
59 InstructionsExecuted +=
RHS.InstructionsExecuted;
62 WallTime -=
RHS.WallTime;
63 UserTime -=
RHS.UserTime;
64 SystemTime -=
RHS.SystemTime;
65 MemUsed -=
RHS.MemUsed;
66 InstructionsExecuted -=
RHS.InstructionsExecuted;
85 std::string Description;
87 bool Triggered =
false;
90 Timer **Prev =
nullptr;
91 Timer *Next =
nullptr;
94 init(TimerName, TimerDescription);
97 init(TimerName, TimerDescription, tg);
100 assert(!
RHS.TG &&
"Can only copy uninitialized timers");
103 assert(!TG && !
T.TG &&
"Can only assign uninit timers");
113 const std::string &
getName()
const {
return Name; }
157 if (
T)
T->startTimer();
160 if (
T)
T->stopTimer();
182 std::string Description;
184 PrintRecord(
const PrintRecord &
Other) =
default;
185 PrintRecord &operator=(
const PrintRecord &
Other) =
default;
186 PrintRecord(
const TimeRecord &Time,
const std::string &Name,
187 const std::string &Description)
188 : Time(Time), Name(Name), Description(Description) {}
190 bool operator <(
const PrintRecord &
Other)
const {
191 return Time <
Other.Time;
195 std::string Description;
196 Timer *FirstTimer =
nullptr;
197 std::vector<PrintRecord> TimersToPrint;
202 void operator=(
const TimerGroup &TG) =
delete;
218 Description.assign(NewDescription.
begin(), NewDescription.
end());
254 void removeTimer(
Timer &
T);
255 void prepareToPrintList(
bool reset_time =
false);
258 const char *suffix,
double Value);
This file defines the StringMap class.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
StringRef - Represent a constant reference to a string, i.e.
double getUserTime() const
double getProcessTime() const
static TimeRecord getCurrentTime(bool Start=true)
Get the current time and memory usage.
double getWallTime() const
ssize_t getMemUsed() const
void operator-=(const TimeRecord &RHS)
void operator+=(const TimeRecord &RHS)
double getSystemTime() const
bool operator<(const TimeRecord &T) const
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.
uint64_t getInstructionsExecuted() const
The TimeRegion class is used as a helper class to call the startTimer() and stopTimer() methods of th...
The TimerGroup class is used to group together related timers into a single report that is printed wh...
static void printAll(raw_ostream &OS)
This static method prints all timers.
void setName(StringRef NewName, StringRef NewDescription)
void print(raw_ostream &OS, bool ResetAfterPrint=false)
Print any started timers in this group, optionally resetting timers after printing them.
static void clearAll()
Clear out all timers.
void clear()
Clear all timers in this group.
friend void PrintStatisticsJSON(raw_ostream &OS)
Print statistics in JSON format.
static void * acquireTimerGlobals()
This makes the timer globals unmanaged, and lets the user manage the lifetime.
static const char * printAllJSONValues(raw_ostream &OS, const char *delim)
Prints all timers as JSON key/value pairs.
const char * printJSONValues(raw_ostream &OS, const char *delim)
static void constructForStatistics()
Ensure global objects required for statistics printing are initialized.
This class is used to track the amount of time spent between invocations of its startTimer()/stopTime...
bool hasTriggered() const
Check if startTimer() has ever been called on this timer.
void yieldTo(Timer &)
Stop the timer and start another timer.
bool isRunning() const
Check if the timer is currently running.
void stopTimer()
Stop the timer.
const Timer & operator=(const Timer &T)
const std::string & getDescription() const
void init(StringRef TimerName, StringRef TimerDescription)
void clear()
Clear the timer state.
const std::string & getName() const
Timer()=default
Create an uninitialized timer, client must use 'init'.
bool isInitialized() const
Timer(StringRef TimerName, StringRef TimerDescription)
Timer(StringRef TimerName, StringRef TimerDescription, TimerGroup &tg)
void startTimer()
Start the timer running.
TimeRecord getTotalTime() const
Return the duration for which this timer has been running.
LLVM Value Representation.
This class implements an extremely fast bulk output stream that can only output to a stream.
SmartMutex - A mutex with a compile time constant parameter that indicates whether this mutex should ...
This is an optimization pass for GlobalISel generic memory operations.
This class is basically a combination of TimeRegion and Timer.