Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Evaluate total impact of template library #24

Open
stgatilov opened this issue Jun 13, 2021 · 3 comments
Open

Evaluate total impact of template library #24

stgatilov opened this issue Jun 13, 2021 · 3 comments

Comments

@stgatilov
Copy link

stgatilov commented Jun 13, 2021

First of all, thank you very much for C++ Build Insights!
I had to analyze build times in the past, but usually had to estimate template issues using object files (with SymbolSort).

I have a project, where Eigen template library was added recently. I'm trying to understand how much build time its template code takes. The same question can be asked for std::* code, boost::* or any other template library.


Parsing library headers is easy to take into account: open "Files" view, filter table data by "Included Path" containing "Eigen" as substring, then look at "Exclusive Duration" of root node "Parsing". Unfortunately, it is not easy to do the same for template instantiations.

First of all, vcperf removes some template instantiations, as noticed in #16. As far as I understand, the raw trace contains all template instantiations, but the analysis removes small ones to make analyzed trace smaller and more responsive when opened in WPA. I worked around this problem by hacking ExpensiveTemplateInstantiationCache::DetermineTopPrimaryTemplates.

Second, only "Duration" is displayed for template instantiations in WPA. It is inclusive, so it cannot be aggregated. I can workaround it by replacing td.WallClockTimeResponsibility with td.ExclusiveDuration in TemplateInstantiationsView::OnTemplateInstantiationStart. Perhaps ExclusiveCPUTime makes even more sense here.

The last inconvenience is that I don't know how to compute sum of column value over all selected/filtered entries in WPA table (except for copying everything to csv and writing simple script). The "Files" view allows summation by having "Activity Name" = "Parsing" key column, but there is no such column in "Template Instantiations" view. Perhaps the most useful additional key column would be "root namespace" (prefix of "Primary Template Name" before ::) like "Eigen", "std" or "boost".


Is it possible to configure the columns displayed in WPA views?
I see that I can add more fields in vcperf code, but WPA does not display them. I tried editing CppBuildInsightsEtw.xml, but it did not help.

P.S. I guess the best approach would be to write a custom analyzer which will aggregate data on-the-fly, without creating massive traces with all template instantiations.

@stgatilov
Copy link
Author

I implemented a custom analyzer for the purpose in my fork.
It filters parsing/instantiation activities by wildcard and displays total time.

In the end, it was rather simple to write the code, although I'm not sure I did everything correctly...

@helena-gregg
Copy link
Contributor

This looks great! What parts do you think might be incorrect? If this would be useful to lots of users, we might want to add this into the product.

@stgatilov
Copy link
Author

For example, if you look at readme, you will see three numbers in reports. The first two numbers should match in theory, but they don't match in reality. Somehow, exclusive time is not equal to inclusive time minus inclusive time or all children (common parts?)
I must admit that the whole inclusive/exclusive thing is a bit complicated, and it is easy to make an error somewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants