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

Side by Side Diff: src/IceTimerTree.cpp

Issue 640713003: Subzero: Improve the output with the --timing-focus=xxx option. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: 80-col Created 6 years, 2 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 unified diff | Download patch
« no previous file with comments | « src/IceTimerTree.h ('k') | src/IceTimerTree.def » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceTimerTree.cpp - Pass timer defs ---------------------===// 1 //===- subzero/src/IceTimerTree.cpp - Pass timer defs ---------------------===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 // 9 //
10 // This file defines the TimerTree class, which tracks flat and 10 // This file defines the TimerTree class, which tracks flat and
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 } 90 }
91 TTindex Prefix = StackTop; 91 TTindex Prefix = StackTop;
92 while (Prefix) { 92 while (Prefix) {
93 Nodes[Prefix].Time += Delta; 93 Nodes[Prefix].Time += Delta;
94 TTindex Next = Nodes[Prefix].Parent; 94 TTindex Next = Nodes[Prefix].Parent;
95 assert(Next < Prefix); 95 assert(Next < Prefix);
96 Prefix = Next; 96 Prefix = Next;
97 } 97 }
98 } 98 }
99 99
100 void TimerStack::reset() {
101 StateChangeCount = 0;
102 FirstTimestamp = LastTimestamp = timestamp();
103 LeafTimes.assign(LeafTimes.size(), 0);
104 for (TimerTreeNode &Node : Nodes) {
105 Node.Time = 0;
106 }
107 }
108
100 namespace { 109 namespace {
101 110
102 typedef std::multimap<double, IceString> DumpMapType; 111 typedef std::multimap<double, IceString> DumpMapType;
103 112
104 // Dump the Map items in reverse order of their time contribution. 113 // Dump the Map items in reverse order of their time contribution.
105 void dumpHelper(Ostream &Str, const DumpMapType &Map, double TotalTime) { 114 void dumpHelper(Ostream &Str, const DumpMapType &Map, double TotalTime) {
106 // TODO(stichnot): Use llvm::make_range with LLVM 3.5. 115 // TODO(stichnot): Use llvm::make_range with LLVM 3.5.
107 for (auto I = Map.rbegin(), E = Map.rend(); I != E; ++I) { 116 for (auto I = Map.rbegin(), E = Map.rend(); I != E; ++I) {
108 char buf[80]; 117 char buf[80];
109 snprintf(buf, llvm::array_lengthof(buf), " %10.6f (%4.1f%%): ", I->first, 118 snprintf(buf, llvm::array_lengthof(buf), " %10.6f (%4.1f%%): ", I->first,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 dumpHelper(Str, FlatMap, TotalTime); 153 dumpHelper(Str, FlatMap, TotalTime);
145 Str << "Number of timer updates: " << StateChangeCount << "\n"; 154 Str << "Number of timer updates: " << StateChangeCount << "\n";
146 } 155 }
147 156
148 double TimerStack::timestamp() { 157 double TimerStack::timestamp() {
149 // TODO: Implement in terms of std::chrono for C++11. 158 // TODO: Implement in terms of std::chrono for C++11.
150 return llvm::TimeRecord::getCurrentTime(false).getWallTime(); 159 return llvm::TimeRecord::getCurrentTime(false).getWallTime();
151 } 160 }
152 161
153 } // end of namespace Ice 162 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceTimerTree.h ('k') | src/IceTimerTree.def » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698