Coloration Schemes

The output color of ProfileSVG can be customized with the functions provided by the FlameGraphs package. See the FlameGraphs docmentation for details.

Default scheme

ProfileSVG.view()

or

using FlameGraphs
ProfileSVG.view(FlameColors())
Profile results Function: in :-1 eval in boot.jl:331 profile_test in REPL[2]:3 randn in normal.jl:190 randn in normal.jl:184 randn! in normal.jl:173 setindex! in array.jl:826 randn in normal.jl:167 randn in normal.jl:40 rand in Random.jl:253 rand in generation.jl:119 rand in Random.jl:253 rand in RNGs.jl:370 reserve_1 in RNGs.jl:190 gen_rand in RNGs.jl:186 dsfmt_fill_array_close1_open2! in DSFMT.jl:86 mt_empty in RNGs.jl:180 getproperty in Base.jl:33 rand in RNGs.jl:371 rand_inbounds in RNGs.jl:366 rand_inbounds in RNGs.jl:362 mt_pop! in RNGs.jl:183 + in int.jl:53 randn in normal.jl:43 * in promotion.jl:312 * in float.jl:405 randn in normal.jl:45 randn_unlikely in normal.jl:58 exp in exp.jl:136 - in float.jl:403 profile_test in REPL[2]:5 mapslices##kw in abstractarray.jl:1972 #mapslices#115 in abstractarray.jl:2029 inner_mapslices! in abstractarray.jl:2039 concatenate_setindex! in abstractarray.jl:2058 dotview in broadcast.jl:1138 maybeview in views.jl:124 profile_test in REPL[2]:7 mapslices##kw in abstractarray.jl:1972 #mapslices#115 in abstractarray.jl:2018 similar in abstractarray.jl:626 similar in array.jl:361 Array in boot.jl:415 Array in boot.jl:407

The default scheme uses cycling colors to distinguish different stack frames, while coloring runtime dispatch "red" and garbage-collection "orange". The run-time dispatch (aka, dynamic dispatch, run-time method lookup, or a virtual call) often has a significant impact on performance.

Stack frame category

You can colorize the stack frames based on their category, or module-of-origin.

using FlameGraphs
ProfileSVG.view(StackFrameCategory())
Profile results Function: in :-1 eval in boot.jl:331 profile_test in REPL[2]:3 randn in normal.jl:190 randn in normal.jl:184 randn! in normal.jl:173 setindex! in array.jl:826 randn in normal.jl:167 randn in normal.jl:40 rand in Random.jl:253 rand in generation.jl:119 rand in Random.jl:253 rand in RNGs.jl:370 reserve_1 in RNGs.jl:190 gen_rand in RNGs.jl:186 dsfmt_fill_array_close1_open2! in DSFMT.jl:86 mt_empty in RNGs.jl:180 getproperty in Base.jl:33 rand in RNGs.jl:371 rand_inbounds in RNGs.jl:366 rand_inbounds in RNGs.jl:362 mt_pop! in RNGs.jl:183 + in int.jl:53 randn in normal.jl:43 * in promotion.jl:312 * in float.jl:405 randn in normal.jl:45 randn_unlikely in normal.jl:58 exp in exp.jl:136 - in float.jl:403 profile_test in REPL[2]:5 mapslices##kw in abstractarray.jl:1972 #mapslices#115 in abstractarray.jl:2029 inner_mapslices! in abstractarray.jl:2039 concatenate_setindex! in abstractarray.jl:2058 dotview in broadcast.jl:1138 maybeview in views.jl:124 profile_test in REPL[2]:7 mapslices##kw in abstractarray.jl:1972 #mapslices#115 in abstractarray.jl:2018 similar in abstractarray.jl:626 similar in array.jl:361 Array in boot.jl:415 Array in boot.jl:407

In the default StackFrameCategory scheme, "gray" indicates time spent in Core.Compiler (mostly inference), "dark gray" in other Core, "yellow" in LLVM, "orange" in other ccalls, "light blue" in Base, and "red" is uncategorized (mostly package code).

Info

The colorbg and colorfont options of FlameGraphs.FlameColors and FlameGraphs.StackFrameCategory are currently not supported and ignored.