From e592104cf05d7f80d0d0ca83f67b36bb029bbb89 Mon Sep 17 00:00:00 2001 From: Roman Lebedev Date: Wed, 16 May 2018 18:16:01 +0000 Subject: [Timers] TimerGroup: add constructor from StringMap 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 --- llvm/lib/Support/Timer.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'llvm/lib/Support/Timer.cpp') 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 &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. -- cgit v1.2.3