Skip to content

Using Flamegraph.pl to create Flame Graphs for SQL Server Profiler, Extended Events, and more

A friend of mine was recently discussing using Flame Graphs in a project of his, and it inspired me to see how I could abuse the format to present a visual model of SQL execution.

Originally I had thought of building my own interface, but apparently the author of the above site also maintains a great repo which allows you to skip some of the more difficult steps: https://github.com/brendangregg/FlameGraph.

There is a lot of detail there about profiling software with specific tools and how to convert their output to something the tool understands, but at its core the “folded” format is fairly easy to target and if you are fine with some text manipulation you can produce your own FGs and re-use the SVG generation, search, and zoom components of this tool.

What’s the format?
It doesnt take too much effort to suss out from flamegraph’s source:
From https://github.com/brendangregg/FlameGraph/blob/master/flamegraph.pl
# frame in the stack is semicolon separated, with a space and count at the end
# of the line.

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *