lebedev.ri created this revision. lebedev.ri added reviewers: george.karpenkov, NoQ, alexfh, sbenza. Herald added a subscriber: llvm-commits. lebedev.ri added a dependent revision: D46939: [Timers] TimerGroup: add constructor from StringMap<TimeRecord>. lebedev.ri added a dependency: D46937: [Timers] TimerGroup::printJSONValue(): print doubles with no precision loss.
This is needed for the continuation of https://reviews.llvm.org/D46504, to be able to store the timings. Repository: rL LLVM https://reviews.llvm.org/D46938 Files: include/llvm/Support/Timer.h lib/Support/Timer.cpp Index: lib/Support/Timer.cpp =================================================================== --- lib/Support/Timer.cpp +++ lib/Support/Timer.cpp @@ -378,6 +378,8 @@ } const char *TimerGroup::printJSONValues(raw_ostream &OS, const char *delim) { + sys::SmartScopedLock<true> L(*TimerLock); + prepareToPrintList(); for (const PrintRecord &R : TimersToPrint) { OS << delim; Index: include/llvm/Support/Timer.h =================================================================== --- include/llvm/Support/Timer.h +++ include/llvm/Support/Timer.h @@ -207,6 +207,8 @@ /// 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 @@ 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
Index: lib/Support/Timer.cpp =================================================================== --- lib/Support/Timer.cpp +++ lib/Support/Timer.cpp @@ -378,6 +378,8 @@ } const char *TimerGroup::printJSONValues(raw_ostream &OS, const char *delim) { + sys::SmartScopedLock<true> L(*TimerLock); + prepareToPrintList(); for (const PrintRecord &R : TimersToPrint) { OS << delim; Index: include/llvm/Support/Timer.h =================================================================== --- include/llvm/Support/Timer.h +++ include/llvm/Support/Timer.h @@ -207,6 +207,8 @@ /// 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 @@ 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
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits