1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-02-01 05:01:59 +01:00

[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

llvm-svn: 366911
This commit is contained in:
Anton Afanasyev 2019-07-24 14:55:40 +00:00
parent eff9ac1736
commit f6599bdb89
2 changed files with 6 additions and 8 deletions

View File

@ -19,7 +19,7 @@ extern TimeTraceProfiler *TimeTraceProfilerInstance;
/// Initialize the time trace profiler. /// Initialize the time trace profiler.
/// This sets up the global \p TimeTraceProfilerInstance /// This sets up the global \p TimeTraceProfilerInstance
/// variable to be the profiler instance. /// variable to be the profiler instance.
void timeTraceProfilerInitialize(); void timeTraceProfilerInitialize(unsigned TimeTraceGranularity);
/// Cleanup the time trace profiler, if it was initialized. /// Cleanup the time trace profiler, if it was initialized.
void timeTraceProfilerCleanup(); void timeTraceProfilerCleanup();

View File

@ -24,12 +24,6 @@ using namespace std::chrono;
namespace llvm { 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; TimeTraceProfiler *TimeTraceProfilerInstance = nullptr;
typedef duration<steady_clock::rep, steady_clock::period> DurationType; typedef duration<steady_clock::rep, steady_clock::period> DurationType;
@ -161,12 +155,16 @@ struct TimeTraceProfiler {
SmallVector<Entry, 128> Entries; SmallVector<Entry, 128> Entries;
StringMap<CountAndDurationType> CountAndTotalPerName; StringMap<CountAndDurationType> CountAndTotalPerName;
time_point<steady_clock> StartTime; time_point<steady_clock> StartTime;
// Minimum time granularity (in microseconds)
unsigned TimeTraceGranularity;
}; };
void timeTraceProfilerInitialize() { void timeTraceProfilerInitialize(unsigned TimeTraceGranularity) {
assert(TimeTraceProfilerInstance == nullptr && assert(TimeTraceProfilerInstance == nullptr &&
"Profiler should not be initialized"); "Profiler should not be initialized");
TimeTraceProfilerInstance = new TimeTraceProfiler(); TimeTraceProfilerInstance = new TimeTraceProfiler();
TimeTraceProfilerInstance->TimeTraceGranularity = TimeTraceGranularity;
} }
void timeTraceProfilerCleanup() { void timeTraceProfilerCleanup() {