llvm.org GIT mirror llvm / 59e66bf
Test commit. Removes some spaces. No functionality changed. Summary: Test commit. Removes some spaces. No functionality changed. Reviewers: llvm-commits Differential Revision: http://reviews.llvm.org/D20972 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271711 91177308-0d34-0410-b5e6-96231b3b80d8 Alina Sbirlea 4 years ago
1 changed file(s) with 22 addition(s) and 22 deletion(s). Raw diff Collapse all Expand all
7878 TimerGroup *tmp = DefaultTimerGroup;
7979 sys::MemoryFence();
8080 if (tmp) return tmp;
81
81
8282 sys::SmartScopedLock Lock(*TimerLock);
8383 tmp = DefaultTimerGroup;
8484 if (!tmp) {
119119 TimeRecord TimeRecord::getCurrentTime(bool Start) {
120120 TimeRecord Result;
121121 sys::TimeValue now(0,0), user(0,0), sys(0,0);
122
122
123123 if (Start) {
124124 Result.MemUsed = getMemUsage();
125125 sys::Process::GetTimeUsage(now, user, sys);
167167 if (Total.getProcessTime())
168168 printVal(getProcessTime(), Total.getProcessTime(), OS);
169169 printVal(getWallTime(), Total.getWallTime(), OS);
170
170
171171 OS << " ";
172
172
173173 if (Total.getMemUsed())
174174 OS << format("%9" PRId64 " ", (int64_t)getMemUsed());
175175 }
191191 I = Map.begin(), E = Map.end(); I != E; ++I)
192192 delete I->second.first;
193193 }
194
194
195195 Timer &get(StringRef Name, StringRef GroupName) {
196196 sys::SmartScopedLock L(*TimerLock);
197
197
198198 std::pair &GroupEntry = Map[GroupName];
199
199
200200 if (!GroupEntry.first)
201201 GroupEntry.first = new TimerGroup(GroupName);
202
202
203203 Timer &T = GroupEntry.second[Name];
204204 if (!T.isInitialized())
205205 T.init(Name, *GroupEntry.first);
214214
215215 static Timer &getNamedRegionTimer(StringRef Name) {
216216 sys::SmartScopedLock L(*TimerLock);
217
217
218218 Timer &T = (*NamedTimers)[Name];
219219 if (!T.isInitialized())
220220 T.init(Name);
239239
240240 TimerGroup::TimerGroup(StringRef name)
241241 : Name(name.begin(), name.end()), FirstTimer(nullptr) {
242
242
243243 // Add the group to TimerGroupList.
244244 sys::SmartScopedLock L(*TimerLock);
245245 if (TimerGroupList)
254254 // print the timing data.
255255 while (FirstTimer)
256256 removeTimer(*FirstTimer);
257
257
258258 // Remove the group from the TimerGroupList.
259259 sys::SmartScopedLock L(*TimerLock);
260260 *Prev = Next;
265265
266266 void TimerGroup::removeTimer(Timer &T) {
267267 sys::SmartScopedLock L(*TimerLock);
268
268
269269 // If the timer was started, move its data to TimersToPrint.
270270 if (T.hasTriggered())
271271 TimersToPrint.emplace_back(T.Time, T.Name);
272272
273273 T.TG = nullptr;
274
274
275275 // Unlink the timer from our list.
276276 *T.Prev = T.Next;
277277 if (T.Next)
278278 T.Next->Prev = T.Prev;
279
279
280280 // Print the report when all timers in this group are destroyed if some of
281281 // them were started.
282282 if (FirstTimer || TimersToPrint.empty())
288288
289289 void TimerGroup::addTimer(Timer &T) {
290290 sys::SmartScopedLock L(*TimerLock);
291
291
292292 // Add the timer to our list.
293293 if (FirstTimer)
294294 FirstTimer->Prev = &T.Next;
300300 void TimerGroup::PrintQueuedTimers(raw_ostream &OS) {
301301 // Sort the timers in descending order by amount of time taken.
302302 std::sort(TimersToPrint.begin(), TimersToPrint.end());
303
303
304304 TimeRecord Total;
305305 for (auto &RecordNamePair : TimersToPrint)
306306 Total += RecordNamePair.first;
307
307
308308 // Print out timing header.
309309 OS << "===" << std::string(73, '-') << "===\n";
310310 // Figure out how many spaces to indent TimerGroup name.
312312 if (Padding > 80) Padding = 0; // Don't allow "negative" numbers
313313 OS.indent(Padding) << Name << '\n';
314314 OS << "===" << std::string(73, '-') << "===\n";
315
315
316316 // If this is not an collection of ungrouped times, print the total time.
317317 // Ungrouped timers don't really make sense to add up. We still print the
318318 // TOTAL line to make the percentages make sense.
320320 OS << format(" Total Execution Time: %5.4f seconds (%5.4f wall clock)\n",
321321 Total.getProcessTime(), Total.getWallTime());
322322 OS << '\n';
323
323
324324 if (Total.getUserTime())
325325 OS << " ---User Time---";
326326 if (Total.getSystemTime())
331331 if (Total.getMemUsed())
332332 OS << " ---Mem---";
333333 OS << " --- Name ---\n";
334
334
335335 // Loop through all of the timing data, printing it out.
336336 for (unsigned i = 0, e = TimersToPrint.size(); i != e; ++i) {
337337 const std::pair &Entry = TimersToPrint[e-i-1];
338338 Entry.first.print(Total, OS);
339339 OS << Entry.second << '\n';
340340 }
341
341
342342 Total.print(Total, OS);
343343 OS << "Total\n\n";
344344 OS.flush();
345
345
346346 TimersToPrint.clear();
347347 }
348348