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

Unified Diff: src/IceGlobalContext.cpp

Issue 1784243006: Subzero: Improve the use of timers. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review changes Created 4 years, 9 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') | src/IceTargetLowering.cpp » ('j') | 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 15cc40d2c5ad278e954c084b5cd773117ddc021a..af85cac10920a0ba98c5deceafe5aeff5fd63ac2 100644
--- a/src/IceGlobalContext.cpp
+++ b/src/IceGlobalContext.cpp
@@ -276,7 +276,7 @@ GlobalContext::GlobalContext(Ostream *OsDump, Ostream *OsEmit, Ostream *OsError,
AllThreadContexts.push_back(MyTLS);
ICE_TLS_SET_FIELD(TLS, MyTLS);
// Pre-register built-in stack names.
- if (BuildDefs::dump()) {
+ if (BuildDefs::timers()) {
// TODO(stichnot): There needs to be a strong relationship between
// the newTimerStackID() return values and TSK_Default/TSK_Funcs.
newTimerStackID("Total across all functions");
@@ -807,7 +807,7 @@ GlobalContext::addJumpTable(const IceString &FuncName, SizeT Id,
}
TimerStackIdT GlobalContext::newTimerStackID(const IceString &Name) {
- if (!BuildDefs::dump())
+ if (!BuildDefs::timers())
return 0;
auto Timers = getTimers();
TimerStackIdT NewID = Timers->size();
@@ -853,23 +853,31 @@ void GlobalContext::setTimerName(TimerStackIdT StackID,
// such as the use of atomics to modify queue elements.
void GlobalContext::optQueueBlockingPush(std::unique_ptr<Cfg> Func) {
assert(Func);
- OptQ.blockingPush(Func.release());
+ {
+ TimerMarker _(TimerStack::TT_qTransPush, this);
+ OptQ.blockingPush(Func.release());
+ }
if (getFlags().isSequential())
translateFunctions();
}
std::unique_ptr<Cfg> GlobalContext::optQueueBlockingPop() {
+ TimerMarker _(TimerStack::TT_qTransPop, this);
return std::unique_ptr<Cfg>(OptQ.blockingPop());
}
void GlobalContext::emitQueueBlockingPush(EmitterWorkItem *Item) {
assert(Item);
- EmitQ.blockingPush(Item);
+ {
+ TimerMarker _(TimerStack::TT_qEmitPush, this);
+ EmitQ.blockingPush(Item);
+ }
if (getFlags().isSequential())
emitItems();
}
EmitterWorkItem *GlobalContext::emitQueueBlockingPop() {
+ TimerMarker _(TimerStack::TT_qEmitPop, this);
return EmitQ.blockingPop();
}
@@ -884,7 +892,7 @@ void GlobalContext::dumpStats(const IceString &Name, bool Final) {
}
void GlobalContext::dumpTimers(TimerStackIdT StackID, bool DumpCumulative) {
- if (!BuildDefs::dump())
+ if (!BuildDefs::timers())
return;
auto Timers = getTimers();
assert(Timers->size() > StackID);
@@ -895,6 +903,15 @@ void GlobalContext::dumpTimers(TimerStackIdT StackID, bool DumpCumulative) {
ClFlags GlobalContext::Flags;
ClFlagsExtra GlobalContext::ExtraFlags;
+TimerIdT TimerMarker::getTimerIdFromFuncName(GlobalContext *Ctx,
+ const IceString &FuncName) {
+ if (!BuildDefs::timers())
+ return 0;
+ if (!Ctx->getFlags().getTimeEachFunction())
+ return 0;
+ return Ctx->getTimerID(GlobalContext::TSK_Funcs, FuncName);
+}
+
void TimerMarker::push() {
switch (StackID) {
case GlobalContext::TSK_Default:
« no previous file with comments | « src/IceGlobalContext.h ('k') | src/IceTargetLowering.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698