aras-p / ClangBuildAnalyzer

Clang build analysis tool using -ftime-trace
The Unlicense
995 stars 64 forks source link

Display template instantiation origin #93

Open vittorioromeo opened 5 months ago

vittorioromeo commented 5 months ago

In the report, we can see:

**** Templates that took longest to instantiate:
  1079 ms: std::variant<sf::Event::Empty, sf::Event::Closed, sf::Event::Resized... (18 times, avg 59 ms)
   961 ms: std::__detail::__variant::_Variant_base<sf::Event::Empty, sf::Event:... (18 times, avg 53 ms)
   ...

**** Template sets that took longest to instantiate:
  1582 ms: std::vector<$> (740 times, avg 2 ms)
  1273 ms: std::unique_ptr<$> (115 times, avg 11 ms)
  ...

It would be nice if we could somehow figure out where the bulk of these instantiations come from. For example, it would be useful if the report showed something like the following:

  1079 ms: std::variant<sf::Event::Empty, sf::Event::Closed, sf::Event::Resized... (18 times, avg 59 ms)
       - 12 times in Foo.cpp
       - 6 times in Bar.cpp
   ...

**** Template sets that took longest to instantiate:
  1582 ms: std::vector<$> (740 times, avg 2 ms)
      - 420 times in Baz.cpp
      - 320 times in Abc.cpp
  ...

Not sure how feasible/difficult this would be to implement.