[llvm] r366911 - [Support] Fix `-ftime-trace-granularity` option
Anton Afanasyev via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 24 07:55:40 PDT 2019
Author: anton-afanasyev
Date: Wed Jul 24 07:55:40 2019
New Revision: 366911
URL: http://llvm.org/viewvc/llvm-project?rev=366911&view=rev
Log:
[Support] Fix `-ftime-trace-granularity` option
Summary:
Move `-ftime-trace-granularity` option to frontend options. Without patch
this option is showed up in the help for any tool that links libSupport.
Reviewers: sammccall
Subscribers: hiraditya, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D65202
Modified:
llvm/trunk/include/llvm/Support/TimeProfiler.h
llvm/trunk/lib/Support/TimeProfiler.cpp
Modified: llvm/trunk/include/llvm/Support/TimeProfiler.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/TimeProfiler.h?rev=366911&r1=366910&r2=366911&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/TimeProfiler.h (original)
+++ llvm/trunk/include/llvm/Support/TimeProfiler.h Wed Jul 24 07:55:40 2019
@@ -19,7 +19,7 @@ extern TimeTraceProfiler *TimeTraceProfi
/// Initialize the time trace profiler.
/// This sets up the global \p TimeTraceProfilerInstance
/// variable to be the profiler instance.
-void timeTraceProfilerInitialize();
+void timeTraceProfilerInitialize(unsigned TimeTraceGranularity);
/// Cleanup the time trace profiler, if it was initialized.
void timeTraceProfilerCleanup();
Modified: llvm/trunk/lib/Support/TimeProfiler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/TimeProfiler.cpp?rev=366911&r1=366910&r2=366911&view=diff
==============================================================================
--- llvm/trunk/lib/Support/TimeProfiler.cpp (original)
+++ llvm/trunk/lib/Support/TimeProfiler.cpp Wed Jul 24 07:55:40 2019
@@ -24,12 +24,6 @@ using namespace std::chrono;
namespace llvm {
-static cl::opt<unsigned> TimeTraceGranularity(
- "time-trace-granularity",
- cl::desc(
- "Minimum time granularity (in microseconds) traced by time profiler"),
- cl::init(500));
-
TimeTraceProfiler *TimeTraceProfilerInstance = nullptr;
typedef duration<steady_clock::rep, steady_clock::period> DurationType;
@@ -161,12 +155,16 @@ struct TimeTraceProfiler {
SmallVector<Entry, 128> Entries;
StringMap<CountAndDurationType> CountAndTotalPerName;
time_point<steady_clock> StartTime;
+
+ // Minimum time granularity (in microseconds)
+ unsigned TimeTraceGranularity;
};
-void timeTraceProfilerInitialize() {
+void timeTraceProfilerInitialize(unsigned TimeTraceGranularity) {
assert(TimeTraceProfilerInstance == nullptr &&
"Profiler should not be initialized");
TimeTraceProfilerInstance = new TimeTraceProfiler();
+ TimeTraceProfilerInstance->TimeTraceGranularity = TimeTraceGranularity;
}
void timeTraceProfilerCleanup() {
More information about the llvm-commits
mailing list