9 #ifndef LLVM_SUPPORT_TIMER_H 10 #define LLVM_SUPPORT_TIMER_H 32 TimeRecord() : WallTime(0), UserTime(0), SystemTime(0), MemUsed(0) {}
48 return WallTime < T.WallTime;
52 WallTime += RHS.WallTime;
53 UserTime += RHS.UserTime;
54 SystemTime += RHS.SystemTime;
55 MemUsed += RHS.MemUsed;
58 WallTime -= RHS.WallTime;
59 UserTime -= RHS.UserTime;
60 SystemTime -= RHS.SystemTime;
61 MemUsed -= RHS.MemUsed;
80 std::string Description;
82 bool Triggered =
false;
85 Timer **Prev =
nullptr;
86 Timer *Next =
nullptr;
89 init(TimerName, TimerDescription);
92 init(TimerName, TimerDescription, tg);
95 assert(!RHS.TG &&
"Can only copy uninitialized timers");
98 assert(!TG && !T.TG &&
"Can only assign uninit timers");
174 std::string Description;
176 PrintRecord(
const PrintRecord &
Other) =
default;
177 PrintRecord &operator=(
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());
222 static void clearAll();
224 const char *printJSONValues(
raw_ostream &OS,
const char *delim);
227 static const char *printAllJSONValues(
raw_ostream &OS,
const char *delim);
232 static void ConstructTimerLists();
236 static std::unique_ptr<TimerGroup> aquireDefaultGroup();
242 void removeTimer(
Timer &
T);
243 void prepareToPrintList(
bool reset_time =
false);
245 void printJSONValue(
raw_ostream &OS,
const PrintRecord &
R,
246 const char *suffix,
double Value);
static TimeRecord getCurrentTime(bool Start=true)
Get the current time and memory usage.
bool operator<(const TimeRecord &T) const
This class represents lattice values for constants.
TimeRecord getTotalTime() const
Return the duration for which this timer has been running.
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
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(StringRef TimerName, StringRef TimerDescription, TimerGroup &tg)
Timer()
Create an uninitialized timer, client must use 'init'.
Timer(StringRef TimerName, StringRef TimerDescription)
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.