diff options
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/include/llvm/LTO/Config.h | 6 | ||||
-rw-r--r-- | llvm/lib/LTO/LTO.cpp | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/llvm/include/llvm/LTO/Config.h b/llvm/include/llvm/LTO/Config.h index 754e3126f8a..6db1235a692 100644 --- a/llvm/include/llvm/LTO/Config.h +++ b/llvm/include/llvm/LTO/Config.h @@ -117,6 +117,12 @@ struct Config { /// Statistics output file path. std::string StatsFile; + /// Time trace enabled + bool TimeTraceEnabled = false; + + /// Time trace granularity + unsigned TimeTraceGranularity = 500; + bool ShouldDiscardValueNames = true; DiagnosticHandlerFunction DiagHandler; diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp index 0d48090e426..e2c8aa15989 100644 --- a/llvm/lib/LTO/LTO.cpp +++ b/llvm/lib/LTO/LTO.cpp @@ -39,6 +39,7 @@ #include "llvm/Support/TargetRegistry.h" #include "llvm/Support/ThreadPool.h" #include "llvm/Support/Threading.h" +#include "llvm/Support/TimeProfiler.h" #include "llvm/Support/VCSRevision.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Target/TargetMachine.h" @@ -1133,6 +1134,9 @@ public: &ResolvedODR, const GVSummaryMapTy &DefinedGlobals, MapVector<StringRef, BitcodeModule> &ModuleMap) { + if (Conf.TimeTraceEnabled) + timeTraceProfilerInitialize(Conf.TimeTraceGranularity, + "thin backend"); Error E = runThinLTOBackendThread( AddStream, Cache, Task, BM, CombinedIndex, ImportList, ExportList, ResolvedODR, DefinedGlobals, ModuleMap); @@ -1143,6 +1147,8 @@ public: else Err = std::move(E); } + if (timeTraceProfilerEnabled()) + timeTraceProfilerFinishThread(); }, BM, std::ref(CombinedIndex), std::ref(ImportList), std::ref(ExportList), std::ref(ResolvedODR), std::ref(DefinedGlobals), std::ref(ModuleMap)); |