[llvm] r332505 - [Timers] TimerGroup: make printJSONValues() method public

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Wed May 16 11:15:56 PDT 2018


Author: lebedevri
Date: Wed May 16 11:15:56 2018
New Revision: 332505

URL: http://llvm.org/viewvc/llvm-project?rev=332505&view=rev
Log:
[Timers] TimerGroup: make printJSONValues() method public

Summary:
This is needed for the continuation of D46504,
to be able to store the timings.

Reviewers: george.karpenkov, NoQ, alexfh, sbenza

Reviewed By: alexfh

Subscribers: llvm-commits, cfe-commits

Differential Revision: https://reviews.llvm.org/D46938

Modified:
    llvm/trunk/include/llvm/Support/Timer.h
    llvm/trunk/lib/Support/Timer.cpp

Modified: llvm/trunk/include/llvm/Support/Timer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Timer.h?rev=332505&r1=332504&r2=332505&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Timer.h (original)
+++ llvm/trunk/include/llvm/Support/Timer.h Wed May 16 11:15:56 2018
@@ -207,6 +207,8 @@ public:
   /// This static method prints all timers and clears them all out.
   static void printAll(raw_ostream &OS);
 
+  const char *printJSONValues(raw_ostream &OS, const char *delim);
+
   /// Prints all timers as JSON key/value pairs, and clears them all out.
   static const char *printAllJSONValues(raw_ostream &OS, const char *delim);
 
@@ -223,7 +225,6 @@ private:
   void PrintQueuedTimers(raw_ostream &OS);
   void printJSONValue(raw_ostream &OS, const PrintRecord &R,
                       const char *suffix, double Value);
-  const char *printJSONValues(raw_ostream &OS, const char *delim);
 };
 
 } // end namespace llvm

Modified: llvm/trunk/lib/Support/Timer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Timer.cpp?rev=332505&r1=332504&r2=332505&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Timer.cpp (original)
+++ llvm/trunk/lib/Support/Timer.cpp Wed May 16 11:15:56 2018
@@ -378,6 +378,8 @@ void TimerGroup::printJSONValue(raw_ostr
 }
 
 const char *TimerGroup::printJSONValues(raw_ostream &OS, const char *delim) {
+  sys::SmartScopedLock<true> L(*TimerLock);
+
   prepareToPrintList();
   for (const PrintRecord &R : TimersToPrint) {
     OS << delim;




More information about the llvm-commits mailing list