summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Timer.cpp
diff options
context:
space:
mode:
authorRoman Lebedev <lebedev.ri@gmail.com>2018-05-16 18:16:01 +0000
committerRoman Lebedev <lebedev.ri@gmail.com>2018-05-16 18:16:01 +0000
commite592104cf05d7f80d0d0ca83f67b36bb029bbb89 (patch)
tree32ff28354763a9b3b52429e9acb2093983bb92f7 /llvm/lib/Support/Timer.cpp
parentd9ade38d4eda40dba34e545c47f121fc1d95e517 (diff)
downloadbcm5719-llvm-e592104cf05d7f80d0d0ca83f67b36bb029bbb89.tar.gz
bcm5719-llvm-e592104cf05d7f80d0d0ca83f67b36bb029bbb89.zip
[Timers] TimerGroup: add constructor from StringMap<TimeRecord>
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/D46939 llvm-svn: 332506
Diffstat (limited to 'llvm/lib/Support/Timer.cpp')
-rw-r--r--llvm/lib/Support/Timer.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Support/Timer.cpp b/llvm/lib/Support/Timer.cpp
index fd587fb80bb..61d3b6c6e31 100644
--- a/llvm/lib/Support/Timer.cpp
+++ b/llvm/lib/Support/Timer.cpp
@@ -236,6 +236,15 @@ TimerGroup::TimerGroup(StringRef Name, StringRef Description)
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.
OpenPOWER on IntegriCloud