[PATCH] D92146: [Timer] Add the timer option -sort-timers to enable/disable report sorting

Paul C. Anagnostopoulos via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 27 11:07:43 PST 2020


Paul-C-Anagnostopoulos updated this revision to Diff 308092.
Paul-C-Anagnostopoulos retitled this revision from "[Timer] [TableGen] Add a function to TimerGroup to suppress report sorting" to "[Timer] Add the timer option -sort-timers to enable/disable report sorting".
Paul-C-Anagnostopoulos added a comment.

I eliminated the new function and replaced it with the new option -sort-timers. Nice!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92146/new/

https://reviews.llvm.org/D92146

Files:
  llvm/include/llvm/TableGen/Record.h
  llvm/lib/Support/Timer.cpp
  llvm/utils/TableGen/DAGISelEmitter.cpp


Index: llvm/utils/TableGen/DAGISelEmitter.cpp
===================================================================
--- llvm/utils/TableGen/DAGISelEmitter.cpp
+++ llvm/utils/TableGen/DAGISelEmitter.cpp
@@ -189,6 +189,7 @@
 namespace llvm {
 
 void EmitDAGISel(RecordKeeper &RK, raw_ostream &OS) {
+  RK.startTimer("Parse patterns");
   DAGISelEmitter(RK).run(OS);
 }
 
Index: llvm/lib/Support/Timer.cpp
===================================================================
--- llvm/lib/Support/Timer.cpp
+++ llvm/lib/Support/Timer.cpp
@@ -53,6 +53,11 @@
   InfoOutputFilename("info-output-file", cl::value_desc("filename"),
                      cl::desc("File to append -stats and -timer output to"),
                    cl::Hidden, cl::location(getLibSupportInfoOutputFilename()));
+
+  static cl::opt<bool>
+  SortTimers("sort-timers", cl::desc("In the report, sort the timers in each group "
+                                     "in wall clock time order"),
+             cl::init(true), cl::Hidden);
 }
 
 std::unique_ptr<raw_fd_ostream> llvm::CreateInfoOutputFile() {
@@ -301,8 +306,9 @@
 }
 
 void TimerGroup::PrintQueuedTimers(raw_ostream &OS) {
-  // Sort the timers in descending order by amount of time taken.
-  llvm::sort(TimersToPrint);
+  // Perhaps sort the timers in descending order by amount of time taken.
+  if (SortTimers)
+    llvm::sort(TimersToPrint);
 
   TimeRecord Total;
   for (const PrintRecord &Record : TimersToPrint)
Index: llvm/include/llvm/TableGen/Record.h
===================================================================
--- llvm/include/llvm/TableGen/Record.h
+++ llvm/include/llvm/TableGen/Record.h
@@ -1829,7 +1829,7 @@
   /// Stop timing a phase.
   void stopTimer();
 
-  /// Start timing the overall backend. If the backend starts a timer,
+  /// Start timing the overall backend. If the backend itself starts a timer,
   /// then this timer is cleared.
   void startBackendTimer(StringRef Name);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92146.308092.patch
Type: text/x-patch
Size: 1943 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201127/972b030c/attachment.bin>


More information about the llvm-commits mailing list