TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Flame Graphs: Making the opaque obvious (2017)

98 pointsby davikr11 months ago

6 comments

zlurkerz11 months ago
How do flame graphs handle the case where most of the time is spent in some leaf function that is called from all over the program? In this case, each individual stack would not take much time but in aggregate, a lot of time is spent in the function at the top of all of the call stacks. This should not be that uncommon to have hotspots in things like copying routines, compression, encryption etc that are not associated with any particular stack.<p>pprof from <a href="https:&#x2F;&#x2F;github.com&#x2F;google&#x2F;pprof">https:&#x2F;&#x2F;github.com&#x2F;google&#x2F;pprof</a> can produce a DAG view of a profile where nodes are sized proportional to their cumulative time, e.g., <a href="https:&#x2F;&#x2F;slcjordan.github.io&#x2F;images&#x2F;pprof&#x2F;graphviz.png" rel="nofollow">https:&#x2F;&#x2F;slcjordan.github.io&#x2F;images&#x2F;pprof&#x2F;graphviz.png</a> and such a view would seem to cover the case above and subsume the usual use cases for a flame graph, would it not?<p>Although I guess a flat text profile of functions sorted by time would also highlight these kinds of hot spots. Still, if we want a single graphical view as a go-to, it&#x27;s not clear that flame graphs are all that much better than pprof DAGs.
评论 #40813668 未加载
评论 #40814252 未加载
评论 #40820539 未加载
评论 #40818590 未加载
评论 #40813343 未加载
评论 #40821058 未加载
评论 #40819326 未加载
irogers11 months ago
Just to advertise the perf tool has inbuilt flamegraph generation code these days (well leaning on D3.js). So `perf script report flamegraph` will convert a perf.data file into a flamegraph.html. Similarly there is `perf script report gecko` to write out the firefox profiler&#x27;s json format.
PreInternet0111 months ago
OK, shameful confession time here: I just <i>cannot</i> grasp flame charts, no matter how hard I try. And yes: that&#x27;s just me, I&#x27;m dumb, etc. etc. (and I freely admit all of that, including the et-ceteras!)<p>I tried to follow along with things that are relevant to my job, like <a href="https:&#x2F;&#x2F;randomascii.wordpress.com&#x2F;2016&#x2F;09&#x2F;05&#x2F;etw-flame-graphs-made-easy&#x2F;" rel="nofollow">https:&#x2F;&#x2F;randomascii.wordpress.com&#x2F;2016&#x2F;09&#x2F;05&#x2F;etw-flame-graph...</a> ...And totally failed? I look at the reddest part of the chart, I look at the peaks, and none of that matches the conclusion reached in the blog post?<p>And then I tried to grok all the knowledge conveyed in <a href="https:&#x2F;&#x2F;www.brendangregg.com&#x2F;flamegraphs.html" rel="nofollow">https:&#x2F;&#x2F;www.brendangregg.com&#x2F;flamegraphs.html</a> and... came away similarly confused? Sure, I see patterns, but when asked to identify which of those patterns indicate problems, I would still score &lt;50%?<p>And, I mean, I do memory&#x2F;CPU traces like all day every day, and I fix code all the time based on that, but that&#x27;s all just based on hierarchical bar charts, which are NOT the same as inverted flame graphs, as far as I can tell?<p>Anyway, thanks for coming to my therapy session, and feel free to leave your helpful-comment-that-will-finally-enlighten-me and&#x2F;or downvote at the door.
评论 #40812621 未加载
评论 #40812929 未加载
评论 #40817593 未加载
评论 #40821280 未加载
评论 #40818304 未加载
评论 #40824000 未加载
评论 #40819499 未加载
评论 #40812437 未加载
评论 #40812534 未加载
评论 #40814298 未加载
评论 #40824255 未加载
评论 #40813165 未加载
danielodievich11 months ago
Back in 2018, I built a flame graph generator for AppDynamics APM-captured snapshots which are traces of call stacks captured over execution time with stack frame timing. Those would typically come from java or clr, although other types like node and ruby and php were also supported.<p>My tool could handle one snapshot or hundreds of thousands of them and it was more useful to aggregate many snapshots I used on Brandan Gregg perl script implementation as reference but wrote all the code myself from scratch to produce just what I wanted. One of the more key things I felt was different was was adding color coding of the TYPE of the call frame based off the code namespace - like green for Oracle jdbc driver or blue for websphere entry or light azure for the clr internals. With multiple contrasting colors one could see the important transitions from own code to library code and back to own code.<p>It was one of the most fun coding challenges I&#x27;ve ever done. Pretty much the only time I had to refactor recursion into stack because some of the call graphs (looking at you java) were so ridiculously deep<p><a href="https:&#x2F;&#x2F;github.com&#x2F;Appdynamics&#x2F;AppDynamics.DEXTER&#x2F;wiki&#x2F;Flame-Graph-Report">https:&#x2F;&#x2F;github.com&#x2F;Appdynamics&#x2F;AppDynamics.DEXTER&#x2F;wiki&#x2F;Flame...</a>
zubspace11 months ago
Do colors have any significance in those flame graphs? It&#x27;s unfortunate that a post about them does not mention anything about colors. If you look at at the examples, there are bars, which have the same length, but the colors look random to me.
评论 #40820384 未加载
MontagFTB11 months ago
For C++ applications, nothing beats Tracy’s flame graphs in value per dollar. We are using it at Adobe with great effect. It can handle mutex lock contention, runtime values and notes, arbitrary value graphs, and more. Highly recommended: <a href="https:&#x2F;&#x2F;github.com&#x2F;wolfpld&#x2F;tracy">https:&#x2F;&#x2F;github.com&#x2F;wolfpld&#x2F;tracy</a>