diff options
author | Russell Gallop <russell.gallop@sony.com> | 2019-11-28 16:20:59 +0000 |
---|---|---|
committer | Russell Gallop <russell.gallop@sony.com> | 2019-12-03 09:45:37 +0000 |
commit | df943a7a08102ed3d1f632e88b24a024a7c4ba81 (patch) | |
tree | 43af9e2880865f3afab0227325c0837bd2af7f57 /llvm/lib/Support/TimeProfiler.cpp | |
parent | 4fd8f11901b5bfb13a5fef597626dde31835873b (diff) | |
download | llvm-df943a7a08102ed3d1f632e88b24a024a7c4ba81.zip llvm-df943a7a08102ed3d1f632e88b24a024a7c4ba81.tar.gz llvm-df943a7a08102ed3d1f632e88b24a024a7c4ba81.tar.bz2 |
[NFC] Tidy-ups to TimeProfiler.cpp
Remove unused include
Make fields const where possible
Move initialisation to initialiser list
Differential Revision: https://reviews.llvm.org/D70904
Diffstat (limited to 'llvm/lib/Support/TimeProfiler.cpp')
-rw-r--r-- | llvm/lib/Support/TimeProfiler.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/llvm/lib/Support/TimeProfiler.cpp b/llvm/lib/Support/TimeProfiler.cpp index c3d7423..fc9ad16 100644 --- a/llvm/lib/Support/TimeProfiler.cpp +++ b/llvm/lib/Support/TimeProfiler.cpp @@ -13,7 +13,6 @@ #include "llvm/Support/TimeProfiler.h" #include "llvm/ADT/StringMap.h" #include "llvm/Support/CommandLine.h" -#include "llvm/Support/FileSystem.h" #include "llvm/Support/JSON.h" #include <cassert> #include <chrono> @@ -33,14 +32,14 @@ typedef std::pair<std::string, CountAndDurationType> NameAndCountAndDurationType; struct Entry { - TimePointType Start; + const TimePointType Start; TimePointType End; - std::string Name; - std::string Detail; + const std::string Name; + const std::string Detail; Entry(TimePointType &&S, TimePointType &&E, std::string &&N, std::string &&Dt) : Start(std::move(S)), End(std::move(E)), Name(std::move(N)), - Detail(std::move(Dt)){}; + Detail(std::move(Dt)) {} // Calculate timings for FlameGraph. Cast time points to microsecond precision // rather than casting duration. This avoid truncation issues causing inner @@ -60,9 +59,8 @@ struct Entry { struct TimeTraceProfiler { TimeTraceProfiler(unsigned TimeTraceGranularity = 0) - : TimeTraceGranularity(TimeTraceGranularity) { - StartTime = steady_clock::now(); - } + : StartTime(steady_clock::now()), + TimeTraceGranularity(TimeTraceGranularity) {} void begin(std::string Name, llvm::function_ref<std::string()> Detail) { Stack.emplace_back(steady_clock::now(), TimePointType(), std::move(Name), @@ -180,10 +178,10 @@ struct TimeTraceProfiler { SmallVector<Entry, 16> Stack; SmallVector<Entry, 128> Entries; StringMap<CountAndDurationType> CountAndTotalPerName; - TimePointType StartTime; + const TimePointType StartTime; // Minimum time granularity (in microseconds) - unsigned TimeTraceGranularity; + const unsigned TimeTraceGranularity; }; void timeTraceProfilerInitialize(unsigned TimeTraceGranularity) { |