LLVM  13.0.0git
Timer.cpp
Go to the documentation of this file.
1 //===-- Timer.cpp - Interval Timing Support -------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 /// \file Interval Timing implementation.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "llvm/Support/Timer.h"
14 
15 #include "DebugOptions.h"
16 
17 #include "llvm/ADT/Statistic.h"
18 #include "llvm/ADT/StringMap.h"
19 #include "llvm/Config/config.h"
22 #include "llvm/Support/Format.h"
24 #include "llvm/Support/Mutex.h"
25 #include "llvm/Support/Process.h"
26 #include "llvm/Support/Signposts.h"
29 #include <limits>
30 
31 #if HAVE_UNISTD_H
32 #include <unistd.h>
33 #endif
34 
35 #ifdef HAVE_PROC_PID_RUSAGE
36 #include <libproc.h>
37 #endif
38 
39 using namespace llvm;
40 
41 // This ugly hack is brought to you courtesy of constructor/destructor ordering
42 // being unspecified by C++. Basically the problem is that a Statistic object
43 // gets destroyed, which ends up calling 'GetLibSupportInfoOutputFile()'
44 // (below), which calls this function. LibSupportInfoOutputFilename used to be
45 // a global variable, but sometimes it would get destroyed before the Statistic,
46 // causing havoc to ensue. We "fix" this by creating the string the first time
47 // it is needed and never destroying it.
49 static std::string &getLibSupportInfoOutputFilename() {
51 }
52 
54 
55 /// Allows llvm::Timer to emit signposts when supported.
57 
58 namespace {
59 struct CreateTrackSpace {
60  static void *call() {
61  return new cl::opt<bool>("track-memory",
62  cl::desc("Enable -time-passes memory "
63  "tracking (this may be slow)"),
64  cl::Hidden);
65  }
66 };
67 static ManagedStatic<cl::opt<bool>, CreateTrackSpace> TrackSpace;
68 struct CreateInfoOutputFilename {
69  static void *call() {
70  return new cl::opt<std::string, true>(
71  "info-output-file", cl::value_desc("filename"),
72  cl::desc("File to append -stats and -timer output to"), cl::Hidden,
74  }
75 };
76 static ManagedStatic<cl::opt<std::string, true>, CreateInfoOutputFilename>
77  InfoOutputFilename;
78 struct CreateSortTimers {
79  static void *call() {
80  return new cl::opt<bool>(
81  "sort-timers",
82  cl::desc("In the report, sort the timers in each group "
83  "in wall clock time order"),
84  cl::init(true), cl::Hidden);
85  }
86 };
87 ManagedStatic<cl::opt<bool>, CreateSortTimers> SortTimers;
88 } // namespace
89 
91  *TrackSpace;
92  *InfoOutputFilename;
93  *SortTimers;
94 }
95 
96 std::unique_ptr<raw_fd_ostream> llvm::CreateInfoOutputFile() {
97  const std::string &OutputFilename = getLibSupportInfoOutputFilename();
98  if (OutputFilename.empty())
99  return std::make_unique<raw_fd_ostream>(2, false); // stderr.
100  if (OutputFilename == "-")
101  return std::make_unique<raw_fd_ostream>(1, false); // stdout.
102 
103  // Append mode is used because the info output file is opened and closed
104  // each time -stats or -time-passes wants to print output to it. To
105  // compensate for this, the test-suite Makefiles have code to delete the
106  // info output file before running commands which write to it.
107  std::error_code EC;
108  auto Result = std::make_unique<raw_fd_ostream>(
110  if (!EC)
111  return Result;
112 
113  errs() << "Error opening info-output-file '"
114  << OutputFilename << " for appending!\n";
115  return std::make_unique<raw_fd_ostream>(2, false); // stderr.
116 }
117 
118 namespace {
119 struct CreateDefaultTimerGroup {
120  static void *call() {
121  return new TimerGroup("misc", "Miscellaneous Ungrouped Timers");
122  }
123 };
124 } // namespace
127 
128 //===----------------------------------------------------------------------===//
129 // Timer Implementation
130 //===----------------------------------------------------------------------===//
131 
132 void Timer::init(StringRef TimerName, StringRef TimerDescription) {
133  init(TimerName, TimerDescription, *getDefaultTimerGroup());
134 }
135 
136 void Timer::init(StringRef TimerName, StringRef TimerDescription,
137  TimerGroup &tg) {
138  assert(!TG && "Timer already initialized");
139  Name.assign(TimerName.begin(), TimerName.end());
140  Description.assign(TimerDescription.begin(), TimerDescription.end());
141  Running = Triggered = false;
142  TG = &tg;
143  TG->addTimer(*this);
144 }
145 
147  if (!TG) return; // Never initialized, or already cleared.
148  TG->removeTimer(*this);
149 }
150 
151 static inline size_t getMemUsage() {
152  if (!*TrackSpace)
153  return 0;
155 }
156 
157 static uint64_t getCurInstructionsExecuted() {
158 #if defined(HAVE_UNISTD_H) && defined(HAVE_PROC_PID_RUSAGE) && \
159  defined(RUSAGE_INFO_V4)
160  struct rusage_info_v4 ru;
161  if (proc_pid_rusage(getpid(), RUSAGE_INFO_V4, (rusage_info_t *)&ru) == 0) {
162  return ru.ri_instructions;
163  }
164 #endif
165  return 0;
166 }
167 
169  using Seconds = std::chrono::duration<double, std::ratio<1>>;
170  TimeRecord Result;
172  std::chrono::nanoseconds user, sys;
173 
174  if (Start) {
175  Result.MemUsed = getMemUsage();
176  Result.InstructionsExecuted = getCurInstructionsExecuted();
177  sys::Process::GetTimeUsage(now, user, sys);
178  } else {
179  sys::Process::GetTimeUsage(now, user, sys);
180  Result.InstructionsExecuted = getCurInstructionsExecuted();
181  Result.MemUsed = getMemUsage();
182  }
183 
184  Result.WallTime = Seconds(now.time_since_epoch()).count();
185  Result.UserTime = Seconds(user).count();
186  Result.SystemTime = Seconds(sys).count();
187  return Result;
188 }
189 
191  assert(!Running && "Cannot start a running timer");
192  Running = Triggered = true;
193  Signposts->startInterval(this, getName());
194  StartTime = TimeRecord::getCurrentTime(true);
195 }
196 
198  assert(Running && "Cannot stop a paused timer");
199  Running = false;
200  Time += TimeRecord::getCurrentTime(false);
201  Time -= StartTime;
202  Signposts->endInterval(this);
203 }
204 
205 void Timer::clear() {
206  Running = Triggered = false;
207  Time = StartTime = TimeRecord();
208 }
209 
210 static void printVal(double Val, double Total, raw_ostream &OS) {
211  if (Total < 1e-7) // Avoid dividing by zero.
212  OS << " ----- ";
213  else
214  OS << format(" %7.4f (%5.1f%%)", Val, Val*100/Total);
215 }
216 
217 void TimeRecord::print(const TimeRecord &Total, raw_ostream &OS) const {
218  if (Total.getUserTime())
219  printVal(getUserTime(), Total.getUserTime(), OS);
220  if (Total.getSystemTime())
221  printVal(getSystemTime(), Total.getSystemTime(), OS);
222  if (Total.getProcessTime())
223  printVal(getProcessTime(), Total.getProcessTime(), OS);
224  printVal(getWallTime(), Total.getWallTime(), OS);
225 
226  OS << " ";
227 
228  if (Total.getMemUsed())
229  OS << format("%9" PRId64 " ", (int64_t)getMemUsed());
230  if (Total.getInstructionsExecuted())
231  OS << format("%9" PRId64 " ", (int64_t)getInstructionsExecuted());
232 }
233 
234 
235 //===----------------------------------------------------------------------===//
236 // NamedRegionTimer Implementation
237 //===----------------------------------------------------------------------===//
238 
239 namespace {
240 
241 typedef StringMap<Timer> Name2TimerMap;
242 
243 class Name2PairMap {
245 public:
246  ~Name2PairMap() {
247  for (StringMap<std::pair<TimerGroup*, Name2TimerMap> >::iterator
248  I = Map.begin(), E = Map.end(); I != E; ++I)
249  delete I->second.first;
250  }
251 
252  Timer &get(StringRef Name, StringRef Description, StringRef GroupName,
253  StringRef GroupDescription) {
255 
256  std::pair<TimerGroup*, Name2TimerMap> &GroupEntry = Map[GroupName];
257 
258  if (!GroupEntry.first)
259  GroupEntry.first = new TimerGroup(GroupName, GroupDescription);
260 
261  Timer &T = GroupEntry.second[Name];
262  if (!T.isInitialized())
263  T.init(Name, Description, *GroupEntry.first);
264  return T;
265  }
266 };
267 
268 }
269 
271 
273  StringRef GroupName,
274  StringRef GroupDescription, bool Enabled)
275  : TimeRegion(!Enabled ? nullptr
276  : &NamedGroupedTimers->get(Name, Description, GroupName,
277  GroupDescription)) {}
278 
279 //===----------------------------------------------------------------------===//
280 // TimerGroup Implementation
281 //===----------------------------------------------------------------------===//
282 
283 /// This is the global list of TimerGroups, maintained by the TimerGroup
284 /// ctor/dtor and is protected by the TimerLock lock.
285 static TimerGroup *TimerGroupList = nullptr;
286 
287 TimerGroup::TimerGroup(StringRef Name, StringRef Description)
288  : Name(Name.begin(), Name.end()),
289  Description(Description.begin(), Description.end()) {
290  // Add the group to TimerGroupList.
292  if (TimerGroupList)
293  TimerGroupList->Prev = &Next;
294  Next = TimerGroupList;
295  Prev = &TimerGroupList;
296  TimerGroupList = this;
297 }
298 
299 TimerGroup::TimerGroup(StringRef Name, StringRef Description,
300  const StringMap<TimeRecord> &Records)
301  : TimerGroup(Name, Description) {
302  TimersToPrint.reserve(Records.size());
303  for (const auto &P : Records)
304  TimersToPrint.emplace_back(P.getValue(), std::string(P.getKey()),
305  std::string(P.getKey()));
306  assert(TimersToPrint.size() == Records.size() && "Size mismatch");
307 }
308 
310  // If the timer group is destroyed before the timers it owns, accumulate and
311  // print the timing data.
312  while (FirstTimer)
313  removeTimer(*FirstTimer);
314 
315  // Remove the group from the TimerGroupList.
317  *Prev = Next;
318  if (Next)
319  Next->Prev = Prev;
320 }
321 
322 
323 void TimerGroup::removeTimer(Timer &T) {
325 
326  // If the timer was started, move its data to TimersToPrint.
327  if (T.hasTriggered())
328  TimersToPrint.emplace_back(T.Time, T.Name, T.Description);
329 
330  T.TG = nullptr;
331 
332  // Unlink the timer from our list.
333  *T.Prev = T.Next;
334  if (T.Next)
335  T.Next->Prev = T.Prev;
336 
337  // Print the report when all timers in this group are destroyed if some of
338  // them were started.
339  if (FirstTimer || TimersToPrint.empty())
340  return;
341 
342  std::unique_ptr<raw_ostream> OutStream = CreateInfoOutputFile();
343  PrintQueuedTimers(*OutStream);
344 }
345 
346 void TimerGroup::addTimer(Timer &T) {
348 
349  // Add the timer to our list.
350  if (FirstTimer)
351  FirstTimer->Prev = &T.Next;
352  T.Next = FirstTimer;
353  T.Prev = &FirstTimer;
354  FirstTimer = &T;
355 }
356 
357 void TimerGroup::PrintQueuedTimers(raw_ostream &OS) {
358  // Perhaps sort the timers in descending order by amount of time taken.
359  if (*SortTimers)
360  llvm::sort(TimersToPrint);
361 
362  TimeRecord Total;
363  for (const PrintRecord &Record : TimersToPrint)
364  Total += Record.Time;
365 
366  // Print out timing header.
367  OS << "===" << std::string(73, '-') << "===\n";
368  // Figure out how many spaces to indent TimerGroup name.
369  unsigned Padding = (80-Description.length())/2;
370  if (Padding > 80) Padding = 0; // Don't allow "negative" numbers
371  OS.indent(Padding) << Description << '\n';
372  OS << "===" << std::string(73, '-') << "===\n";
373 
374  // If this is not an collection of ungrouped times, print the total time.
375  // Ungrouped timers don't really make sense to add up. We still print the
376  // TOTAL line to make the percentages make sense.
377  if (this != getDefaultTimerGroup())
378  OS << format(" Total Execution Time: %5.4f seconds (%5.4f wall clock)\n",
379  Total.getProcessTime(), Total.getWallTime());
380  OS << '\n';
381 
382  if (Total.getUserTime())
383  OS << " ---User Time---";
384  if (Total.getSystemTime())
385  OS << " --System Time--";
386  if (Total.getProcessTime())
387  OS << " --User+System--";
388  OS << " ---Wall Time---";
389  if (Total.getMemUsed())
390  OS << " ---Mem---";
391  if (Total.getInstructionsExecuted())
392  OS << " ---Instr---";
393  OS << " --- Name ---\n";
394 
395  // Loop through all of the timing data, printing it out.
396  for (const PrintRecord &Record : make_range(TimersToPrint.rbegin(),
397  TimersToPrint.rend())) {
398  Record.Time.print(Total, OS);
399  OS << Record.Description << '\n';
400  }
401 
402  Total.print(Total, OS);
403  OS << "Total\n\n";
404  OS.flush();
405 
406  TimersToPrint.clear();
407 }
408 
409 void TimerGroup::prepareToPrintList(bool ResetTime) {
410  // See if any of our timers were started, if so add them to TimersToPrint.
411  for (Timer *T = FirstTimer; T; T = T->Next) {
412  if (!T->hasTriggered()) continue;
413  bool WasRunning = T->isRunning();
414  if (WasRunning)
415  T->stopTimer();
416 
417  TimersToPrint.emplace_back(T->Time, T->Name, T->Description);
418 
419  if (ResetTime)
420  T->clear();
421 
422  if (WasRunning)
423  T->startTimer();
424  }
425 }
426 
427 void TimerGroup::print(raw_ostream &OS, bool ResetAfterPrint) {
428  {
429  // After preparing the timers we can free the lock
431  prepareToPrintList(ResetAfterPrint);
432  }
433 
434  // If any timers were started, print the group.
435  if (!TimersToPrint.empty())
436  PrintQueuedTimers(OS);
437 }
438 
441  for (Timer *T = FirstTimer; T; T = T->Next)
442  T->clear();
443 }
444 
447 
448  for (TimerGroup *TG = TimerGroupList; TG; TG = TG->Next)
449  TG->print(OS);
450 }
451 
454  for (TimerGroup *TG = TimerGroupList; TG; TG = TG->Next)
455  TG->clear();
456 }
457 
458 void TimerGroup::printJSONValue(raw_ostream &OS, const PrintRecord &R,
459  const char *suffix, double Value) {
460  assert(yaml::needsQuotes(Name) == yaml::QuotingType::None &&
461  "TimerGroup name should not need quotes");
462  assert(yaml::needsQuotes(R.Name) == yaml::QuotingType::None &&
463  "Timer name should not need quotes");
464  constexpr auto max_digits10 = std::numeric_limits<double>::max_digits10;
465  OS << "\t\"time." << Name << '.' << R.Name << suffix
466  << "\": " << format("%.*e", max_digits10 - 1, Value);
467 }
468 
469 const char *TimerGroup::printJSONValues(raw_ostream &OS, const char *delim) {
471 
472  prepareToPrintList(false);
473  for (const PrintRecord &R : TimersToPrint) {
474  OS << delim;
475  delim = ",\n";
476 
477  const TimeRecord &T = R.Time;
478  printJSONValue(OS, R, ".wall", T.getWallTime());
479  OS << delim;
480  printJSONValue(OS, R, ".user", T.getUserTime());
481  OS << delim;
482  printJSONValue(OS, R, ".sys", T.getSystemTime());
483  if (T.getMemUsed()) {
484  OS << delim;
485  printJSONValue(OS, R, ".mem", T.getMemUsed());
486  }
487  if (T.getInstructionsExecuted()) {
488  OS << delim;
489  printJSONValue(OS, R, ".instr", T.getInstructionsExecuted());
490  }
491  }
492  TimersToPrint.clear();
493  return delim;
494 }
495 
496 const char *TimerGroup::printAllJSONValues(raw_ostream &OS, const char *delim) {
498  for (TimerGroup *TG = TimerGroupList; TG; TG = TG->Next)
499  delim = TG->printJSONValues(OS, delim);
500  return delim;
501 }
502 
504  (void)*NamedGroupedTimers;
505 }
506 
507 std::unique_ptr<TimerGroup> TimerGroup::aquireDefaultGroup() {
508  return std::unique_ptr<TimerGroup>(DefaultTimerGroup.claim());
509 }
Signposts
static ManagedStatic< SignpostEmitter > Signposts
Allows llvm::Timer to emit signposts when supported.
Definition: Timer.cpp:56
llvm::Timer::clear
void clear()
Clear the timer state.
Definition: Timer.cpp:205
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::TimerGroup::aquireDefaultGroup
static std::unique_ptr< TimerGroup > aquireDefaultGroup()
This makes the default group unmanaged, and lets the user manage the group's lifetime.
Definition: Timer.cpp:507
llvm::TimerGroup::printAllJSONValues
static const char * printAllJSONValues(raw_ostream &OS, const char *delim)
Prints all timers as JSON key/value pairs.
Definition: Timer.cpp:496
llvm::make_range
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
Definition: iterator_range.h:53
FileSystem.h
llvm::cl::location
LocationClass< Ty > location(Ty &L)
Definition: CommandLine.h:459
P
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
Definition: README-SSE.txt:411
llvm::TimerGroup::print
void print(raw_ostream &OS, bool ResetAfterPrint=false)
Print any started timers in this group, optionally resetting timers after printing them.
Definition: Timer.cpp:427
llvm::TimerGroup::clear
void clear()
Clear all timers in this group.
Definition: Timer.cpp:439
Statistic.h
llvm::TimerGroup::printAll
static void printAll(raw_ostream &OS)
This static method prints all timers.
Definition: Timer.cpp:445
ManagedStatic.h
llvm::Timer::init
void init(StringRef TimerName, StringRef TimerDescription)
Definition: Timer.cpp:132
llvm::cl::Hidden
@ Hidden
Definition: CommandLine.h:143
llvm::Timer
This class is used to track the amount of time spent between invocations of its startTimer()/stopTime...
Definition: Timer.h:82
DebugOptions.h
llvm::sys::path::end
const_iterator end(StringRef path)
Get end iterator over path.
Definition: Path.cpp:233
llvm::sys::path::begin
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
Definition: Path.cpp:224
T
#define T
Definition: Mips16ISelLowering.cpp:341
llvm::errs
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
Definition: raw_ostream.cpp:892
Format.h
llvm::TimerGroup::~TimerGroup
~TimerGroup()
Definition: Timer.cpp:309
printVal
static void printVal(double Val, double Total, raw_ostream &OS)
Definition: Timer.cpp:210
llvm::Timer::startTimer
void startTimer()
Start the timer running.
Definition: Timer.cpp:190
llvm::CreateInfoOutputFile
std::unique_ptr< raw_fd_ostream > CreateInfoOutputFile()
Return a file stream to print our output on.
Definition: Timer.cpp:96
llvm::sys::TimePoint
std::chrono::time_point< std::chrono::system_clock, D > TimePoint
A time point on the system clock.
Definition: Chrono.h:33
TimerGroupList
static TimerGroup * TimerGroupList
This is the global list of TimerGroups, maintained by the TimerGroup ctor/dtor and is protected by th...
Definition: Timer.cpp:285
llvm::TimeRecord::getCurrentTime
static TimeRecord getCurrentTime(bool Start=true)
Get the current time and memory usage.
Definition: Timer.cpp:168
CommandLine.h
Process.h
NamedGroupedTimers
static ManagedStatic< Name2PairMap > NamedGroupedTimers
Definition: Timer.cpp:270
llvm::TimeRegion
The TimeRegion class is used as a helper class to call the startTimer() and stopTimer() methods of th...
Definition: Timer.h:146
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Signposts.h
llvm::ManagedStatic
ManagedStatic - This transparently changes the behavior of global statics to be lazily constructed on...
Definition: ManagedStatic.h:83
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
llvm::sys::Process::GetTimeUsage
static void GetTimeUsage(TimePoint<> &elapsed, std::chrono::nanoseconds &user_time, std::chrono::nanoseconds &sys_time)
This static function will set user_time to the amount of CPU time spent in user (non-kernel) mode and...
llvm::raw_ostream::flush
void flush()
Definition: raw_ostream.h:186
StringMap.h
getCurInstructionsExecuted
static uint64_t getCurInstructionsExecuted()
Definition: Timer.cpp:157
llvm::None
const NoneType None
Definition: None.h:23
now
static sys::TimePoint< std::chrono::seconds > now(bool Deterministic)
Definition: ArchiveWriter.cpp:259
llvm::TimerGroup::clearAll
static void clearAll()
Clear out all timers.
Definition: Timer.cpp:452
llvm::StringMap
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition: StringMap.h:108
llvm::sys::fs::OF_TextWithCRLF
@ OF_TextWithCRLF
The file should be opened in text mode and use a carriage linefeed '\r '.
Definition: FileSystem.h:770
llvm::TimerGroup::ConstructTimerLists
static void ConstructTimerLists()
Ensure global timer group lists are initialized.
Definition: Timer.cpp:503
Timer.h
DefaultTimerGroup
static ManagedStatic< TimerGroup, CreateDefaultTimerGroup > DefaultTimerGroup
Definition: Timer.cpp:125
llvm::cl::opt< bool >
llvm::StringRef::end
iterator end() const
Definition: StringRef.h:130
llvm::TimerGroup::printJSONValues
const char * printJSONValues(raw_ostream &OS, const char *delim)
Definition: Timer.cpp:469
llvm::numbers::e
constexpr double e
Definition: MathExtras.h:57
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::TimeRecord::getProcessTime
double getProcessTime() const
Definition: Timer.h:43
llvm::sys::SmartScopedLock
std::lock_guard< SmartMutex< mt_only > > SmartScopedLock
Definition: Mutex.h:71
call
S is passed via registers r2 But gcc stores them to the and then reload them to and r3 before issuing the call(r0 contains the address of the format string)
Definition: README.txt:190
llvm::cl::init
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:443
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::Timer::stopTimer
void stopTimer()
Stop the timer.
Definition: Timer.cpp:197
llvm::Record
Definition: Record.h:1472
llvm::StringMapImpl::size
unsigned size() const
Definition: StringMap.h:93
llvm::TimeRecord::print
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.
Definition: Timer.cpp:217
llvm::Timer::~Timer
~Timer()
Definition: Timer.cpp:146
llvm::TimeRecord::getWallTime
double getWallTime() const
Definition: Timer.h:46
YAMLTraits.h
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::TimeRecord
Definition: Timer.h:26
LibSupportInfoOutputFilename
static ManagedStatic< std::string > LibSupportInfoOutputFilename
Definition: Timer.cpp:48
llvm::format
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
Definition: Format.h:124
Mutex.h
TimerLock
static ManagedStatic< sys::SmartMutex< true > > TimerLock
Definition: Timer.cpp:53
llvm::NamedRegionTimer::NamedRegionTimer
NamedRegionTimer(StringRef Name, StringRef Description, StringRef GroupName, StringRef GroupDescription, bool Enabled=true)
Definition: Timer.cpp:272
llvm::TimeRecord::getUserTime
double getUserTime() const
Definition: Timer.h:44
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
llvm::TimeRecord::getMemUsed
ssize_t getMemUsed() const
Definition: Timer.h:47
llvm::initTimerOptions
void initTimerOptions()
Definition: Timer.cpp:90
llvm::TimerGroup
The TimerGroup class is used to group together related timers into a single report that is printed wh...
Definition: Timer.h:176
get
Should compile to something r4 addze r3 instead we get
Definition: README.txt:24
getMemUsage
static size_t getMemUsage()
Definition: Timer.cpp:151
Enabled
static bool Enabled
Definition: Statistic.cpp:46
llvm::sort
void sort(IteratorTy Start, IteratorTy End)
Definition: STLExtras.h:1475
llvm::cl::value_desc
Definition: CommandLine.h:424
getDefaultTimerGroup
static TimerGroup * getDefaultTimerGroup()
Definition: Timer.cpp:126
OutputFilename
static cl::opt< std::string > OutputFilename("o", cl::desc("Output filename"), cl::value_desc("filename"), cl::init("-"))
llvm::raw_ostream::indent
raw_ostream & indent(unsigned NumSpaces)
indent - Insert 'NumSpaces' spaces.
Definition: raw_ostream.cpp:497
llvm::sys::fs::OF_Append
@ OF_Append
The file should be opened in append mode.
Definition: FileSystem.h:773
llvm::Timer::getName
const std::string & getName() const
Definition: Timer.h:114
llvm::cl::desc
Definition: CommandLine.h:414
llvm::sys::Process::GetMallocUsage
static size_t GetMallocUsage()
Return process memory usage.
raw_ostream.h
llvm::StringRef::begin
iterator begin() const
Definition: StringRef.h:128
llvm::TimeRecord::getInstructionsExecuted
uint64_t getInstructionsExecuted() const
Definition: Timer.h:48
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
getLibSupportInfoOutputFilename
static std::string & getLibSupportInfoOutputFilename()
Definition: Timer.cpp:49
llvm::TimeRecord::getSystemTime
double getSystemTime() const
Definition: Timer.h:45