Web lists-archives.com

Re: I made a flame graph renderer for git's trace2 output




On 5/10/2019 11:09 AM, Ævar Arnfjörð Bjarmason wrote:
> Here's a flamegraph of where git's test suite spends its time on my box:
> https://vm.nix.is/~avar/noindex/git-tests.svg
> 
> I hacked up a script for this today to plot trace2 production data, as
> noted there it's at:
> https://github.com/avar/FlameGraph/tree/stackcollapse-git-tr2-event
> 
> What are flamegraphs? See http://www.brendangregg.com/flamegraphs.html
> 
> As noted in TODOs in the script there's various stuff I'd like to do
> better, and this also shows how we need a lot more trace regions to get
> granular data.
> 
> But it's already quite cool, and I'll keep improving it. I'll submit a
> PR to Brendan's parent repo once I'm happy enough with it, I figure it
> makes more sense there than in git.git, but maybe we'd eventually want
> to teach the test suite to optionally use something like this.

This is a neat idea. Thanks!

For anyone else giving this a try, here are the steps I took to create
my own [1], much smaller test:

# run some tests
export GIT_TR2_EVENT=~/git-tr2-event.txt
git fetch --all
git gc
git push

# get the FlameGraph repo
git clone https://github.com/avar/FlameGraph.git
cd FlameGraph

(
    # Get the proper perl packages, if you don't have them
    sudo apt install cpanminus
    sudo cpanm install JSON::XS
)

./stackcollapse-git-tr2-event.pl ~/git-tr2-event.txt | ./flamegraph.pl >git-test.svg


[1] https://github.com/derrickstolee/FlameGraph/blob/git-test/git-test.svg