[PATCH] D36492: [time-report] Add preprocessor timer

Erik Pilkington via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 16 13:43:24 PDT 2017


erik.pilkington added a comment.

This looks really usefull, thanks for working on this!



================
Comment at: lib/Lex/Preprocessor.cpp:746
 void Preprocessor::Lex(Token &Result) {
+  llvm::TimeRegion(PPOpts->getTimer());
+
----------------
Doesn't this just start a timer and immediately end the timer? Shouldn't we do: `llvm::TimeRegion LexTime(PPOpts->getTimer())` so that the dtor gets called when this function returns and we track the time spent in this function?

Also: this is a pretty hot function, and it looks like TimeRegion does some non-trivial work if time is being tracked. Have you tried testing this on a big c++ file with and without this patch and seeing what the difference in compile time looks like?


https://reviews.llvm.org/D36492





More information about the cfe-commits mailing list