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

Unified Diff: src/IceTimerTree.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/IceTargetLoweringX86BaseImpl.h ('k') | src/IceTimerTree.def » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceTimerTree.cpp
diff --git a/src/IceTimerTree.cpp b/src/IceTimerTree.cpp
index a9baf4721ccb2a8a9bf7fe2b3c702e780cbdb55c..1ae4e536155e5e09a261ddbbda1f1ea25f9b6ace 100644
--- a/src/IceTimerTree.cpp
+++ b/src/IceTimerTree.cpp
@@ -32,7 +32,7 @@ namespace Ice {
TimerStack::TimerStack(const IceString &Name)
: Name(Name), FirstTimestamp(timestamp()), LastTimestamp(FirstTimestamp) {
- if (!BuildDefs::dump())
+ if (!BuildDefs::timers())
return;
Nodes.resize(1); // Reserve Nodes[0] for the root node (sentinel).
IDs.resize(TT__num);
@@ -49,7 +49,7 @@ TimerStack::TimerStack(const IceString &Name)
// Returns the unique timer ID for the given Name, creating a new ID if needed.
TimerIdT TimerStack::getTimerID(const IceString &Name) {
- if (!BuildDefs::dump())
+ if (!BuildDefs::timers())
return 0;
if (IDsIndex.find(Name) == IDsIndex.end()) {
IDsIndex[Name] = IDs.size();
@@ -76,7 +76,7 @@ TimerStack::translateIDsFrom(const TimerStack &Src) {
// Merges two timer stacks, by combining and summing corresponding entries.
// This timer stack is updated from Src.
void TimerStack::mergeFrom(const TimerStack &Src) {
- if (!BuildDefs::dump())
+ if (!BuildDefs::timers())
return;
TranslationType Mapping = translateIDsFrom(Src);
TTindex SrcIndex = 0;
@@ -146,7 +146,7 @@ TimerStack::TTindex TimerStack::findPath(const PathType &Path) {
// Pushes a new marker onto the timer stack.
void TimerStack::push(TimerIdT ID) {
- if (!BuildDefs::dump())
+ if (!BuildDefs::timers())
return;
constexpr bool UpdateCounts = false;
update(UpdateCounts);
@@ -157,7 +157,7 @@ void TimerStack::push(TimerIdT ID) {
// Pops the top marker from the timer stack. Validates via assert() that the
// expected marker is popped.
void TimerStack::pop(TimerIdT ID) {
- if (!BuildDefs::dump())
+ if (!BuildDefs::timers())
return;
constexpr bool UpdateCounts = true;
update(UpdateCounts);
@@ -174,7 +174,7 @@ void TimerStack::pop(TimerIdT ID) {
// At a state change (e.g. push or pop), updates the flat and cumulative
// timings for everything on the timer stack.
void TimerStack::update(bool UpdateCounts) {
- if (!BuildDefs::dump())
+ if (!BuildDefs::timers())
return;
++StateChangeCount;
// Whenever the stack is about to change, we grab the time delta since the
@@ -210,7 +210,7 @@ void TimerStack::update(bool UpdateCounts) {
}
void TimerStack::reset() {
- if (!BuildDefs::dump())
+ if (!BuildDefs::timers())
return;
StateChangeCount = 0;
FirstTimestamp = LastTimestamp = timestamp();
@@ -228,7 +228,7 @@ using DumpMapType = std::multimap<double, IceString>;
// Dump the Map items in reverse order of their time contribution.
void dumpHelper(Ostream &Str, const DumpMapType &Map, double TotalTime) {
- if (!BuildDefs::dump())
+ if (!BuildDefs::timers())
return;
for (auto &I : reverse_range(Map)) {
char buf[80];
@@ -244,7 +244,7 @@ void dumpHelper(Ostream &Str, const DumpMapType &Map, double TotalTime) {
// MaxVal=5 ==> "[%1lu] "
// MaxVal=9876 ==> "[%4lu] "
void makePrintfFormatString(char *Buf, size_t BufLen, size_t MaxVal) {
- if (!BuildDefs::dump())
+ if (!BuildDefs::timers())
return;
int NumDigits = 0;
do {
@@ -257,7 +257,7 @@ void makePrintfFormatString(char *Buf, size_t BufLen, size_t MaxVal) {
} // end of anonymous namespace
void TimerStack::dump(Ostream &Str, bool DumpCumulative) {
- if (!BuildDefs::dump())
+ if (!BuildDefs::timers())
return;
constexpr bool UpdateCounts = true;
update(UpdateCounts);
« no previous file with comments | « src/IceTargetLoweringX86BaseImpl.h ('k') | src/IceTimerTree.def » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698