Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: src/IceGlobalContext.cpp

Issue 1867473002: Subzero: Fix -timing-focus . (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review changes Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceGlobalContext.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceGlobalContext.cpp
diff --git a/src/IceGlobalContext.cpp b/src/IceGlobalContext.cpp
index 25e1cc6027d11c20984b3072aded9345504d5113..b61873d6a3f8a41600c1763509aaf8e6def73608 100644
--- a/src/IceGlobalContext.cpp
+++ b/src/IceGlobalContext.cpp
@@ -887,32 +887,38 @@ TimerStackIdT GlobalContext::newTimerStackID(const std::string &Name) {
TimerIdT GlobalContext::getTimerID(TimerStackIdT StackID,
const std::string &Name) {
- auto Timers = &ICE_TLS_GET_FIELD(TLS)->Timers;
+ auto *Timers = &ICE_TLS_GET_FIELD(TLS)->Timers;
assert(StackID < Timers->size());
return Timers->at(StackID).getTimerID(Name);
}
void GlobalContext::pushTimer(TimerIdT ID, TimerStackIdT StackID) {
- auto Timers = &ICE_TLS_GET_FIELD(TLS)->Timers;
+ auto *Timers = &ICE_TLS_GET_FIELD(TLS)->Timers;
assert(StackID < Timers->size());
Timers->at(StackID).push(ID);
}
void GlobalContext::popTimer(TimerIdT ID, TimerStackIdT StackID) {
- auto Timers = &ICE_TLS_GET_FIELD(TLS)->Timers;
+ auto *Timers = &ICE_TLS_GET_FIELD(TLS)->Timers;
assert(StackID < Timers->size());
Timers->at(StackID).pop(ID);
}
void GlobalContext::resetTimer(TimerStackIdT StackID) {
- auto Timers = &ICE_TLS_GET_FIELD(TLS)->Timers;
+ auto *Timers = &ICE_TLS_GET_FIELD(TLS)->Timers;
assert(StackID < Timers->size());
Timers->at(StackID).reset();
}
+std::string GlobalContext::getTimerName(TimerStackIdT StackID) {
+ auto *Timers = &ICE_TLS_GET_FIELD(TLS)->Timers;
+ assert(StackID < Timers->size());
+ return Timers->at(StackID).getName();
+}
+
void GlobalContext::setTimerName(TimerStackIdT StackID,
const std::string &NewName) {
- auto Timers = &ICE_TLS_GET_FIELD(TLS)->Timers;
+ auto *Timers = &ICE_TLS_GET_FIELD(TLS)->Timers;
assert(StackID < Timers->size());
Timers->at(StackID).setName(NewName);
}
@@ -962,10 +968,6 @@ void GlobalContext::dumpStats(const Cfg *Func) {
}
}
-void GlobalContext::mergeTimersFromTLS() {
- getTimers()->mergeFrom(ICE_TLS_GET_FIELD(TLS)->Timers);
-}
-
void GlobalContext::dumpTimers(TimerStackIdT StackID, bool DumpCumulative) {
if (!BuildDefs::timers())
return;
@@ -975,6 +977,25 @@ void GlobalContext::dumpTimers(TimerStackIdT StackID, bool DumpCumulative) {
Timers->at(StackID).dump(getStrDump(), DumpCumulative);
}
+void GlobalContext::dumpLocalTimers(const std::string &TimerNameOverride,
+ TimerStackIdT StackID,
+ bool DumpCumulative) {
+ if (!BuildDefs::timers())
+ return;
+ auto *Timers = &ICE_TLS_GET_FIELD(TLS)->Timers;
+ assert(Timers->size() > StackID);
+ // Temporarily override the thread-local timer name with the given name.
+ // Don't do it permanently because the final timer merge at the end expects
+ // the thread-local timer names to be the same as the global timer name.
+ auto OrigName = getTimerName(StackID);
+ setTimerName(StackID, TimerNameOverride);
+ {
+ OstreamLocker _(this);
+ Timers->at(StackID).dump(getStrDump(), DumpCumulative);
+ }
+ setTimerName(StackID, OrigName);
+}
+
LockedPtr<StringPool>
GlobalStringPoolTraits::getStrings(const GlobalContext *PoolOwner) {
return PoolOwner->getStrings();
« no previous file with comments | « src/IceGlobalContext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698