diff options
author | Anton Afanasyev <anton.a.afanasyev@gmail.com> | 2019-03-30 08:42:48 +0000 |
---|---|---|
committer | Anton Afanasyev <anton.a.afanasyev@gmail.com> | 2019-03-30 08:42:48 +0000 |
commit | 95c1c41b493540625a7909316ac46229aa75b9e1 (patch) | |
tree | 564bfedc1cc763f2d1b4bbe03d2aa5b8cb2035df /lib/Sema/SemaTemplateInstantiate.cpp | |
parent | 428045a8d83527487a23f11c7cf4413395dedf14 (diff) |
Adds `-ftime-trace` option to clang that produces Chrome `chrome://tracing` compatible JSON profiling output dumps.
This change adds hierarchical "time trace" profiling blocks that can be visualized in Chrome, in a "flame chart" style. Each profiling block can have a "detail" string that for example indicates the file being processed, template name being instantiated, function being optimized etc.
This is taken from GitHub PR: https://github.com/aras-p/llvm-project-20170507/pull/2
Patch by Aras Pranckevičius.
Differential Revision: https://reviews.llvm.org/D58675
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@357340 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiate.cpp')
-rw-r--r-- | lib/Sema/SemaTemplateInstantiate.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp index bc4d9e0845..a7d03ddff3 100644 --- a/lib/Sema/SemaTemplateInstantiate.cpp +++ b/lib/Sema/SemaTemplateInstantiate.cpp @@ -25,6 +25,7 @@ #include "clang/Sema/Template.h" #include "clang/Sema/TemplateDeduction.h" #include "clang/Sema/TemplateInstCallback.h" +#include "llvm/Support/TimeProfiler.h" using namespace clang; using namespace sema; @@ -2008,6 +2009,11 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation, Instantiation->getInstantiatedFromMemberClass(), Pattern, PatternDef, TSK, Complain)) return true; + + llvm::TimeTraceScope TimeScope("InstantiateClass", [&]() { + return Instantiation->getQualifiedNameAsString(); + }); + Pattern = PatternDef; // Record the point of instantiation. |