9#ifndef LLVM_SUPPORT_TIMER_H 
   10#define LLVM_SUPPORT_TIMER_H 
   29  double WallTime = 0.0;             
 
   30  double UserTime = 0.0;             
 
   31  double SystemTime = 0.0;           
 
   52    return WallTime < 
T.WallTime;
 
 
   56    WallTime += 
RHS.WallTime;
 
   57    UserTime += 
RHS.UserTime;
 
   58    SystemTime += 
RHS.SystemTime;
 
   59    MemUsed += 
RHS.MemUsed;
 
   60    InstructionsExecuted += 
RHS.InstructionsExecuted;
 
 
   63    WallTime -= 
RHS.WallTime;
 
   64    UserTime -= 
RHS.UserTime;
 
   65    SystemTime -= 
RHS.SystemTime;
 
   66    MemUsed -= 
RHS.MemUsed;
 
   67    InstructionsExecuted -= 
RHS.InstructionsExecuted;
 
 
 
   92  std::string Description;  
 
   94  bool Triggered = 
false;   
 
   97  Timer **Prev = 
nullptr;   
 
   98  Timer *Next = 
nullptr;    
 
  101    init(TimerName, TimerDescription);
 
 
  104    init(TimerName, TimerDescription, tg);
 
 
  107    assert(!
RHS.TG && 
"Can only copy uninitialized timers");
 
 
  110    assert(!TG && !
T.TG && 
"Can only assign uninit timers");
 
 
  121  const std::string &
getName()
 const { 
return Name; }
 
 
  158  TimeRegion(
const TimeRegion &) = 
delete;
 
  165    if (T) T->startTimer();
 
 
  168    if (T) T->stopTimer();
 
 
 
  196    std::string Description;
 
  198    PrintRecord(
const PrintRecord &
Other) = 
default;
 
  199    PrintRecord &operator=(
const PrintRecord &
Other) = 
default;
 
  200    PrintRecord(
const TimeRecord &Time, 
const std::string &Name,
 
  201                const std::string &Description)
 
  202      : Time(Time), Name(Name), Description(Description) {}
 
  204    bool operator <(
const PrintRecord &
Other)
 const {
 
  205      return Time < 
Other.Time;
 
  209  std::string Description;
 
  210  Timer *FirstTimer = 
nullptr; 
 
  211  std::vector<PrintRecord> TimersToPrint;
 
  216  TimerGroup(
const TimerGroup &TG) = 
delete;
 
  217  void operator=(
const TimerGroup &TG) = 
delete;
 
  225                               bool PrintOnExit = 
true);
 
  229                               bool PrintOnExit = 
true);
 
  234    Name.assign(NewName.
begin(), NewName.
end());
 
  235    Description.assign(NewDescription.
begin(), NewDescription.
end());
 
 
  272  void removeTimer(
Timer &
T);
 
  273  void prepareToPrintList(
bool reset_time = 
false);
 
  275  void printJSONValue(
raw_ostream &OS, 
const PrintRecord &R,
 
  276                      const char *suffix, 
double Value);
 
 
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the StringMap class.
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 LLVM_ABI TimeRecord getCurrentTime(bool Start=true)
Get the current time and memory usage.
double getWallTime() const
TimeRecord operator-(const TimeRecord &RHS) const
ssize_t getMemUsed() const
void operator-=(const TimeRecord &RHS)
void operator+=(const TimeRecord &RHS)
double getSystemTime() const
bool operator<(const TimeRecord &T) const
LLVM_ABI 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 TimerGroup class is used to group together related timers into a single report that is printed wh...
static LLVM_ABI void printAll(raw_ostream &OS)
This static method prints all timers.
void setName(StringRef NewName, StringRef NewDescription)
LLVM_ABI void print(raw_ostream &OS, bool ResetAfterPrint=false)
Print any started timers in this group, optionally resetting timers after printing them.
static LLVM_ABI void clearAll()
Clear out all timers.
LLVM_ABI void clear()
Clear all timers in this group.
LLVM_ABI friend void PrintStatisticsJSON(raw_ostream &OS)
Print statistics in JSON format.
friend class TimerGlobals
static LLVM_ABI void * acquireTimerGlobals()
This makes the timer globals unmanaged, and lets the user manage the lifetime.
static LLVM_ABI const char * printAllJSONValues(raw_ostream &OS, const char *delim)
Prints all timers as JSON key/value pairs.
LLVM_ABI const char * printJSONValues(raw_ostream &OS, const char *delim)
static LLVM_ABI 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.
LLVM_ABI void yieldTo(Timer &)
Stop the timer and start another timer.
bool isRunning() const
Check if the timer is currently running.
LLVM_ABI void stopTimer()
Stop the timer.
const Timer & operator=(const Timer &T)
const std::string & getDescription() const
LLVM_ABI void init(StringRef TimerName, StringRef TimerDescription)
LLVM_ABI 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)
LLVM_ABI 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.
LLVM_ABI NamedRegionTimer(StringRef Name, StringRef Description, StringRef GroupName, StringRef GroupDescription, bool Enabled=true)
static LLVM_ABI TimerGroup & getNamedTimerGroup(StringRef GroupName, StringRef GroupDescription)