mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
[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
This commit is contained in:
parent
e01f705d97
commit
8f67a027ed
@ -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 @@ class TimerGroup {
|
||||
|
||||
public:
|
||||
explicit TimerGroup(StringRef Name, StringRef Description);
|
||||
|
||||
explicit TimerGroup(StringRef Name, StringRef Description,
|
||||
const StringMap<TimeRecord> &Records);
|
||||
|
||||
~TimerGroup();
|
||||
|
||||
void setName(StringRef NewName, StringRef NewDescription) {
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user