timholy / SnoopCompile.jl

Provide insights about latency (TTFX) for Julia packages
https://timholy.github.io/SnoopCompile.jl/dev/
Other
309 stars 48 forks source link

Add options to flamegraph() to display as methods, functions, or as slottypes (printing Consts) #160

Closed NHDaly closed 3 years ago

NHDaly commented 3 years ago

Currently, each MethodInstance is displayed individually, but this adds other options to display them. If you display them as Methods, or Functions, this has the effect of aggregating the results. If you display them as slottypes, it shows if a MethodInstance was specialized with constants.

This also covers aggregation if you use SnoopCompile together with a flamegraphs renderer that supports displaying aggregations, like PProf.jl, and it shows a simplified view if you use it with a linear-ordered Flamegraph renderer like ProfileView.jl.

timholy commented 3 years ago

See https://github.com/JuliaLang/julia/pull/38596 for related work.

NHDaly commented 3 years ago

Ooh, thanks ~~ that looks really great! :) Yes, we should definitely base this PR on top of that work! 👍 👍

We probably won't need the slottypes option to print the Consts, then, since we can just use what you've added 👍 :)

NHDaly commented 3 years ago

Also, I like what you did here with the generators. I hadn't noticed that, we should probably copy that into this as well when generating the flamegraphs! https://github.com/JuliaLang/julia/blob/3b4b512eae901587347176c19674907a953cd0bd/base/show.jl#L1006-L1008

        if isdefined(def, :generator) && mi === def.generator
            print(io, "InferenceFrameInfo generator for ")
            show(io, def)
timholy commented 3 years ago

xref #175