[PATCH] D47196: [Time-report ](2): Recursive timers in Clang

Andrew V. Tischenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 17 01:16:33 PDT 2018


avt77 added a comment.

In https://reviews.llvm.org/D47196#1162321, @efriedma wrote:

> Adding startFrontendTimer/stopFrontendTimer helps a little, but it's still difficult to match a given startFrontendTimer to the corresponding stopFrontendTimer because they're in completely different functions in some cases.  Do they really need to be scattered like that?  If they do, please add comments so someone reading the code can match them up.


I'll do it.

> Does getFrontendFunctionTimeCtx need to be a template, given it's always instantiated with `const FunctionDecl *`?

Initially there were 2 types of instantiations: std::string and const FunctionDecl *.  Trying to simplify the patch (and to make it shorter) I removed string instantiations (hoping to return them back later). And I thought it could be useful to have some other types of instantiations in the future. Do you think it's redundant? I used std::string in places where we don't have FunctionDecl yet. And this counter infrastructure could be used in general with any other data types.



================
Comment at: include/clang/Frontend/Utils.h:338
+      }
+      if (isFirstValid(Result.first) && Result.second > 0.00001) {
+        FrontendTimes.push_back(Result);
----------------
efriedma wrote:
> Why 0.00001? Should it be configurable?
Yes, of course. I'll do it.


================
Comment at: include/clang/Frontend/Utils.h:385
+          range.first++;
+        }
+        FinalTimes.push_back({E, dist});
----------------
efriedma wrote:
> This is merging together the times for functions with the same name? Why is that necessary?
> 
> This function could use a few comments describing what it's doing.
We merge times for the funcs with the same name because we'd like to get the total time spending for every function. The idea of this report is to collect all time pieces for separate functions and to show the longest times. As result we'll be able to see functions with longest compilation times and that's exactly our goal.
And, yes I'll add comments soon.


https://reviews.llvm.org/D47196





More information about the cfe-commits mailing list