[PATCH] D41915: [lldCOFF] Print detailed timing information with /VERBOSE
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 11 21:41:17 PST 2018
ruiu added inline comments.
================
Comment at: lld/COFF/Driver.cpp:50
+static Timer InputFileTimer("Input File Reading");
+
----------------
Can you remove `addChildTimer` if you pass a parent timer to the constructor?
================
Comment at: lld/COFF/PDB.cpp:897
}
+ U.stop();
----------------
I found T1, T2, ... (which you did in Writer.cpp) is better than T, U, V.
================
Comment at: lld/Common/Timer.cpp:8
+
+static bool IsTimingEnabled = false;
+
----------------
High resolution timer is very cheap on modern processors (I believe it is compiled to RSTSC instruction on x86, for example), so I think we should always enable this and just don't print out the final result if Config->ShowTiming is false.
================
Comment at: lld/Common/Timer.cpp:62
+ llvm::raw_svector_ostream Stream(Str);
+ repeat(Stream, '-', 49);
+ message(Str);
----------------
I believe this can be written without `repeat`:
Stream << std::string('-', 49);
================
Comment at: lld/Common/Timer.cpp:80-87
+ int LI = Depth * 2;
+ int RI = std::max<int>(0, 30 - Name.size() - 1 - LI);
+ SmallString<32> Str;
+ llvm::raw_svector_ostream Stream(Str);
+ repeat(Stream, ' ', LI);
+ Stream << Name << ":";
+ repeat(Stream, ' ', RI);
----------------
std::string S = (std::string(' ', Depth * 2) + Name).str();
format("% 30s (%6.2f%%) %5d ms", S, 100 * millis() / TotalDuration, (int)millis());
is perhaps a bit easier to read?
================
Comment at: lld/include/lld/Common/Timer.h:35-41
+ std::chrono::time_point<std::chrono::high_resolution_clock> StartTime;
+ std::chrono::nanoseconds Total;
+ llvm::SmallVector<Timer *, 2> Children;
+ std::string Name;
+
+ void print(int Depth, double TotalDuration, bool Recurse = true) const;
+
----------------
We usually write private members after public members.
https://reviews.llvm.org/D41915
More information about the llvm-commits
mailing list