lebedev.ri created this revision. lebedev.ri added reviewers: george.karpenkov, NoQ, alexfh, sbenza. Herald added a subscriber: llvm-commits. lebedev.ri added a dependency: D46938: [Timers] TimerGroup: make printJSONValues() method public. lebedev.ri added a dependent revision: D46602: [clang-tidy] Store checks profiling info as YAML files.
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/D46939 Files: include/llvm/Support/Timer.h lib/Support/Timer.cpp Index: lib/Support/Timer.cpp =================================================================== --- lib/Support/Timer.cpp +++ lib/Support/Timer.cpp @@ -236,6 +236,15 @@ TimerGroupList = this; } +TimerGroup::TimerGroup(StringRef Name, StringRef Description, + const StringMap<TimeRecord> &Records) + : TimerGroup(Name, Description) { + TimersToPrint.reserve(Records.size()); + for (const auto &P : Records) + TimersToPrint.emplace_back(P.getValue(), P.getKey(), P.getKey()); + assert(TimersToPrint.size() == Records.size() && "Size mismatch"); +} + TimerGroup::~TimerGroup() { // If the timer group is destroyed before the timers it owns, accumulate and // print the timing data. Index: include/llvm/Support/Timer.h =================================================================== --- include/llvm/Support/Timer.h +++ include/llvm/Support/Timer.h @@ -10,6 +10,7 @@ #ifndef LLVM_SUPPORT_TIMER_H #define LLVM_SUPPORT_TIMER_H +#include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/DataTypes.h" #include <cassert> @@ -194,6 +195,10 @@ public: explicit TimerGroup(StringRef Name, StringRef Description); + + explicit TimerGroup(StringRef Name, StringRef Description, + const StringMap<TimeRecord> &Records); + ~TimerGroup(); void setName(StringRef NewName, StringRef NewDescription) {
Index: lib/Support/Timer.cpp =================================================================== --- lib/Support/Timer.cpp +++ lib/Support/Timer.cpp @@ -236,6 +236,15 @@ TimerGroupList = this; } +TimerGroup::TimerGroup(StringRef Name, StringRef Description, + const StringMap<TimeRecord> &Records) + : TimerGroup(Name, Description) { + TimersToPrint.reserve(Records.size()); + for (const auto &P : Records) + TimersToPrint.emplace_back(P.getValue(), P.getKey(), P.getKey()); + assert(TimersToPrint.size() == Records.size() && "Size mismatch"); +} + TimerGroup::~TimerGroup() { // If the timer group is destroyed before the timers it owns, accumulate and // print the timing data. Index: include/llvm/Support/Timer.h =================================================================== --- include/llvm/Support/Timer.h +++ include/llvm/Support/Timer.h @@ -10,6 +10,7 @@ #ifndef LLVM_SUPPORT_TIMER_H #define LLVM_SUPPORT_TIMER_H +#include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/DataTypes.h" #include <cassert> @@ -194,6 +195,10 @@ public: explicit TimerGroup(StringRef Name, StringRef Description); + + explicit TimerGroup(StringRef Name, StringRef Description, + const StringMap<TimeRecord> &Records); + ~TimerGroup(); void setName(StringRef NewName, StringRef NewDescription) {
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits