[PATCH] D41915: [lldCOFF] Print detailed timing information with /VERBOSE

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 12 14:18:45 PST 2018


ruiu added inline comments.


================
Comment at: lld/COFF/Driver.cpp:50
 
+static Timer InputFileTimer("Input File Reading");
+
----------------
zturner wrote:
> ruiu wrote:
> > Can you remove `addChildTimer` if you pass a parent timer to the constructor?
> No because we don't want every timer to be enabled always.  Only if a certain branch of code is run (for example we only want to add PDB timers if /DEBUG is specified)
But I don't think we need a separate flag. It seems you can show timing information only when a timer has non-zero time duration (which means the timer has activated and deactivated).


================
Comment at: lld/COFF/PDB.cpp:998
+
+  ScopedTimer T(TotalPdbLinkTimer);
   PDBLinker PDB(Symtab);
----------------
T1 and T2?


================
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);
----------------
zturner wrote:
> ruiu wrote:
> >   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?
> This isn't quite the same.  printf right justifies `%30s`, I want it left justified.  I also don't want it left justified to 30, because the indentation would have changed that.  I think it's easier to just explicitly pad on the left and pad on the right.
  std::string S = (std::string(' ', Depth * 2) + Name).str();

indents the string, no?


https://reviews.llvm.org/D41915





More information about the llvm-commits mailing list