# Alternatives to flame graphs for profiler

**URL:** <https://discourse.julialang.org/t/alternatives-to-flame-graphs-for-profiler/103328>\
**Category:** Profiling\
**Tags:** vscode, profiling\
**Created:** [August 29, 2023, 12:36pm UTC](https://discourse.julialang.org/t/alternatives-to-flame-graphs-for-profiler/103328 "2023-08-29T12:36:44Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![pjuergens](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pjuergens/32/28380_2.png) [@pjuergens](https://discourse.julialang.org/u/pjuergens)\
**Post date:** [August 29, 2023, 12:36pm UTC](https://discourse.julialang.org/t/alternatives-to-flame-graphs-for-profiler/103328/1 "2023-08-29T12:36:44Z")

</div>

Hello there,

I am wondering if there is an alternative way to show profiler results (at best in VS Code) than a simple flame graph. What I’m basically looking for is a way to see cumulated time spend in a function/line of code that might have been called multiple times from different functions. So e.g. I have a function `foo` which is called from `function_1`, `function_2` and `function_3` - the flame graph will show me how much time was spent for function 1-3, but it’s hard to see when `foo` was indeed the bottleneck as it’s split up between the three functions.

I tried to illustrate my problem in my real world profiling results

 ![tempsnip](https://global.discourse-cdn.com/julialang/original/3X/f/7/f734e5092002c3210a17758c4c72fbeca097bc8f.png)

So I’m wondering if there is a function in these many small bars that occurs many times and where it’s worth to improve performance or which might give me a hint to e.g. if it’s worth using StaticArrays. The overall model is many thousand lines of code.

---

<div class="post-metadata">

**Author:** ![oxinabox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oxinabox/32/206603_2.png) [@oxinabox](https://discourse.julialang.org/u/oxinabox)\
**Post date:** [August 29, 2023, 12:58pm UTC](https://discourse.julialang.org/t/alternatives-to-flame-graphs-for-profiler/103328/2 "2023-08-29T12:58:53Z")

</div>

You can use PProf’s directed graph view,  
by using [PProf.jl](https://github.com/JuliaPerf/PProf.jl)

 ![](https://global.discourse-cdn.com/julialang/original/3X/a/8/a802b6fca138191f4732b0b3c61db0262b786a63.png)

---

<div class="post-metadata">

**Author:** ![hendri54](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hendri54/32/9621_2.png) [@hendri54](https://discourse.julialang.org/u/hendri54)\
**Post date:** [August 29, 2023, 1:46pm UTC](https://discourse.julialang.org/t/alternatives-to-flame-graphs-for-profiler/103328/3 "2023-08-29T13:46:03Z")

</div>

This may address your problem:

> **[GitHub - KristofferC/TimerOutputs.jl: Formatted output of timed sections in...](https://github.com/KristofferC/TimerOutputs.jl)**
>
> Formatted output of timed sections in Julia. Contribute to KristofferC/TimerOutputs.jl development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![albheim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/albheim/32/34660_2.png) [@albheim](https://discourse.julialang.org/u/albheim)\
**Post date:** [August 29, 2023, 2:03pm UTC](https://discourse.julialang.org/t/alternatives-to-flame-graphs-for-profiler/103328/4 "2023-08-29T14:03:06Z")

</div>

> [@pjuergens](#):
>
> What I’m basically looking for is a way to see cumulated time spend in a function/line of code that might have been called multiple times from different functions.

To me it sounds like it should be solved by the builtin `@profview` in vscode which has both the flame graph and an inline view.  
[https://www.julia-vscode.org/docs/stable/userguide/profiler/](https://www.julia-vscode.org/docs/stable/userguide/profiler/)  
The inline view can show how many samples were collected for any single row of code IIUC.

---

<div class="post-metadata">

**Author:** ![pjuergens](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pjuergens/32/28380_2.png) [@pjuergens](https://discourse.julialang.org/u/pjuergens)\
**Post date:** [August 29, 2023, 2:06pm UTC](https://discourse.julialang.org/t/alternatives-to-flame-graphs-for-profiler/103328/5 "2023-08-29T14:06:29Z")

</div>

Thanks already for the replies! PProfs top-view is what I was searching for. I would really like to see a view like that implemented in the vscode profiler as well.

---

<div class="post-metadata">

**Author:** ![mpeters2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mpeters2/32/202247_2.png) [@mpeters2](https://discourse.julialang.org/u/mpeters2)\
**Post date:** [November 19, 2023, 11:30pm UTC](https://discourse.julialang.org/t/alternatives-to-flame-graphs-for-profiler/103328/6 "2023-11-19T23:30:48Z")

</div>

To revive a dead thread:

I find the flamegraphs baffling, and I “profile” by hand by wrapping chunks of code in “startTime = time()” and “stopTime = time() - startTime” and printing the results.

It would be nice if the profiler’s output looked more like TimerOutputs.jl (which doesn’t actually seem to work with the profiler), or allowed you to drill down like in Spyder:

 ![Screenshot 2023-11-19 at 6.28.04 PM](https://global.discourse-cdn.com/julialang/original/3X/9/b/9b7b39331888fcdb9157456f5693ca41619acc9f.png)

Right off the bat, I can see that iterativeTukeyRegression() is taking up the most time, and if I drill down, I can see the median() is the culprit:

 ![Screenshot 2023-11-19 at 6.32.03 PM](https://global.discourse-cdn.com/julialang/original/3X/6/c/6c771d3d158a901225264d99b73b11a0fc20c19d.png)

---

<div class="post-metadata">

**Author:** ![ericphanson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ericphanson/32/215186_2.png) [@ericphanson](https://discourse.julialang.org/u/ericphanson)\
**Post date:** [November 20, 2023, 12:03am UTC](https://discourse.julialang.org/t/alternatives-to-flame-graphs-for-profiler/103328/7 "2023-11-20T00:03:59Z")

</div>

TimerOutputs is a tracing profiler as opposed to the sampling profiler in the julia stdlib, and the screenshot looks like a tracing profiler as well. For fancier tracing profilers, I’ve had success with [NVTX.jl](https://github.com/JuliaGPU/NVTX.jl) (it works on CPU too, but you need to download nvidia’s software to view the profiles). I think [Tracy.jl](https://github.com/topolarity/Tracy.jl) should work as well (and there is a build option to integrate with the Julia runtime to view time spent within the runtime itself), but I wasn’t able to figure out how to use it / view the right profiles. There is also [IntelITT.jl](https://github.com/JuliaPerf/IntelITT.jl) but I haven’t used it.
