]> granicus.if.org Git - llvm/commitdiff
[Support][Time profiler] Make FE codegen blocks to be inside frontend blocks
authorAnton Afanasyev <anton.a.afanasyev@gmail.com>
Mon, 19 Aug 2019 22:58:26 +0000 (22:58 +0000)
committerAnton Afanasyev <anton.a.afanasyev@gmail.com>
Mon, 19 Aug 2019 22:58:26 +0000 (22:58 +0000)
Summary:
Add `Frontend` time trace entry to `HandleTranslationUnit()` function.
Add test to check all codegen blocks are inside frontend blocks.
Also, change `--time-trace-granularity` option a bit to make sure very small
time blocks are outputed to json-file when using `--time-trace-granularity=0`.

This fixes http://llvm.org/pr41969

Reviewers: russell.gallop, lebedev.ri, thakis

Reviewed By: russell.gallop

Subscribers: vsapsai, aras-p, lebedev.ri, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D63325

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369308 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/TimeProfiler.cpp

index b2f340bf9a0456279d55ef53e879931a2e8390f0..fae8c15b6e3d53bc4802dca9ae05233858c450e4 100644 (file)
@@ -58,8 +58,8 @@ struct TimeTraceProfiler {
     auto &E = Stack.back();
     E.Duration = steady_clock::now() - E.Start;
 
-    // Only include sections longer than TimeTraceGranularity msec.
-    if (duration_cast<microseconds>(E.Duration).count() > TimeTraceGranularity)
+    // Only include sections longer or equal to TimeTraceGranularity msec.
+    if (duration_cast<microseconds>(E.Duration).count() >= TimeTraceGranularity)
       Entries.emplace_back(E);
 
     // Track total time taken by each "name", but only the topmost levels of