10 #ifndef LLVM_SUPPORT_TIMER_H
11 #define LLVM_SUPPORT_TIMER_H
14 #include "llvm/Support/DataTypes.h"
32 TimeRecord() : WallTime(0), UserTime(0), SystemTime(0), MemUsed(0) {}
50 return WallTime < T.WallTime;
54 WallTime += RHS.WallTime;
55 UserTime += RHS.UserTime;
56 SystemTime += RHS.SystemTime;
57 MemUsed += RHS.MemUsed;
60 WallTime -= RHS.WallTime;
61 UserTime -= RHS.UserTime;
62 SystemTime -= RHS.SystemTime;
63 MemUsed -= RHS.MemUsed;
90 assert(!RHS.TG &&
"Can only copy uninitialized timers");
93 assert(!TG && !T.TG &&
"Can only assign uninit timers");
99 explicit Timer() : TG(nullptr) {}
103 const std::string &
getName()
const {
return Name; }
134 if (
T)
T->startTimer();
137 if (
T)
T->stopTimer();
163 std::vector<std::pair<TimeRecord, std::string> > TimersToPrint;
167 void operator=(
const TimerGroup &TG) =
delete;
183 void removeTimer(
Timer &
T);
bool isInitialized() const
void print(const TimeRecord &Total, raw_ostream &OS) const
print - Print the current timer to standard error, and reset the "Started" flag.
const std::string & getName() const
static TimeRecord getCurrentTime(bool Start=true)
getCurrentTime - Get the current time and memory usage.
void stopTimer()
stopTimer - Stop the timer.
NamedRegionTimer(StringRef Name, bool Enabled=true)
The TimeRegion class is used as a helper class to call the startTimer() and stopTimer() methods of th...
NamedRegionTimer - This class is basically a combination of TimeRegion and Timer. ...
double getProcessTime() const
static cl::opt< bool > Enabled("stats", cl::desc("Enable statistics output from program (available with Asserts)"))
-stats - Command line option to cause transformations to emit stats about what they did...
double getWallTime() const
void setName(StringRef name)
Timer - This class is used to track the amount of time spent between invocations of its startTimer()/...
Timer(StringRef N, TimerGroup &tg)
double getUserTime() const
ssize_t getMemUsed() const
void print(raw_ostream &OS)
print - Print any started timers in this group and zero them.
double getSystemTime() const
void startTimer()
startTimer - Start the timer running.
void operator+=(const TimeRecord &RHS)
The TimerGroup class is used to group together related timers into a single report that is printed wh...
const Timer & operator=(const Timer &T)
bool operator<(const TimeRecord &T) const
static void printAll(raw_ostream &OS)
printAll - This static method prints all timers and clears them all out.
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.