<div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><i>Ideas on how to improve the backend situation:<br></i></div><div><i>- Let FPPassManager::runOnFunction() call</i></div><div><div><i>    if (ProfileTime)</i></div><div><i>        llvm::timeTraceProfilerBegin("RunPass", FP->getPassName());</i></div></div><div><i>  for each pass so that it's visible which path the time goes into</i></div></div></div></div></blockquote><div><br></div><div>In my tests (which I admittedly only tried for "slow to compile things" at work), even the one single timer scope per function was already "not terribly useful" -- most of our code ends up being lots of functions, but at that point there's no easy way to e.g. group them by class/namespace/etc. Digging deep into individual passes inside each function might be useful for very slow to compile functions, but I haven't ran into that yet -- that's the only reason why I haven't added the scopes.</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><i>- Have a thing _somewhere_ (in clang? in chrome's about:tracing? a standalone tool?) that makes it possible to look at a flame graph view of the trace. A flame graph is a trace that's sorted by call stack, not by time, so that all the same stacks are next to each other, which makes it easy to see things like "30% of time is spent in function X" – together with the first suggestion it'd make the slowest path visible.</i></div></div></div></div></blockquote><div><br></div><div>The excellent <a href="https://www.speedscope.app/">https://www.speedscope.app/</a> can already do that for any Chrome Tracing profile file -- just switch to "Left Heavy" view.</div><div><br></div><div><br></div></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Aras Pranckevičius<br>work: <a href="https://unity3d.com" target="_blank">https://unity3d.com</a><br>home: <a href="https://aras-p.info" target="_blank">https://aras-p.info</a></div><div><br></div></div></div></div>