bugGNU Octave - Bugs: bug #60005, Flame graphs for profiler output

 
 

bug #60005: Flame graphs for profiler output

Submitted by:  CH <atcl>
Submitted on:  Thu 04 Feb 2021 07:43:46 PM UTC  
 
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Feature Request
Status:  None Assigned to:  None
Originator Name:  Open/Closed:  Open
Release:  dev Operating System:  Any

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Mon 08 Feb 2021 10:17:15 AM UTC, comment #4: 

I will investigate and test this thoroughly on large code bases, and if problems arise, I will report them.

I assuem this implicitly means flamegraph visualization is not too interesting at the moement. However, come back to me if this picks up interest.

CH <atcl>
Mon 08 Feb 2021 12:24:44 AM UTC, comment #3: 

Please do report whether there has been an improvement in memory usage.

If memory usage is still excessive then I think that this would need to be the subject of a separate bug report.  Octave is organized around matrices, and it is possible that structs are not as efficient internally and need more optimization.

Rik <rik5>
Project Administrator
Sat 06 Feb 2021 11:47:06 AM UTC, comment #2: 

Thank you for the ideas, I was not even aware of patch. The combination of patch() and text() is the fastest, which looks reasonable to me since the code for rectangle calls patch and is also more complicated. This reduces the runtime to a quarter of before. The biggest problem though was not the runtime but the memory consumption, growing beyond the 16G of my machine for a larger code base profiling. I will test if this is fixed too by using patch() instead.

PS: I updated the gist accordingly

CH <atcl>
Fri 05 Feb 2021 10:13:26 PM UTC, comment #1: 

I collected some profile data, and then ran the profiler on flamegraph.m itself.  It looks like the the annotation calls consume most of the time.

Top
  flamegraph: 1 calls, 1.725 total, 0.000 self
    dissect: 1 calls, 1.610 total, 0.000 self
      dissect: 2 calls, 1.453 total, 0.002 self
        1) annotation: 18 calls, 1.181 total, 0.004 self
        2) dissect: 18 calls, 0.270 total, 0.001 self
        3) cell2mat: 4 calls, 0.000 total, 0.000 self
        4) strrep: 18 calls, 0.000 total, 0.000 self
        5) sort: 2 calls, 0.000 total, 0.000 self
        6) binary *: 18 calls, 0.000 total, 0.000 self
        7) binary +: 36 calls, 0.000 total, 0.000 self
        8) binary /: 36 calls, 0.000 total, 0.000 self
        9) sum: 2 calls, 0.000 total, 0.000 self
        10) binary -: 36 calls, 0.000 total, 0.000 self

At this level, 81% of the 1.453 total run time is because of annotation.

If you wanted to speed this part up you could probably replace annotation() with either rectangle() or patch() combined with a text() call for labeling.

Although, since profiling code is used infrequently it doesn't need to be especially high performance.  I can wait 5 seconds for a plot to render if I only need to do it every few months.

Rik <rik5>
Project Administrator
Thu 04 Feb 2021 07:43:46 PM UTC, original submission:  

MATLAB has a flame graph visualization since 2020a. Way before, in January 2019, I wrote a flame graph visualization for Octave's profiler output, see:

https://git.io/flamegraph

It uses text box annotations for the flames, and recursively traverses the profile data. Thus, it is rather slow and requires a lot of memory.

I would be happy if this could be the basis for a flame graph visualization in Octave, but I lack understanding of the Octave internals to accelerate this code. Maybe doing this inside a plot is the wrong approach altogether, but it seems convenient; or there may be a more efficient way to draw the boxes?

CH <atcl>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by atcl (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    No changes have been made to this item

    Back to the top


    Powered by Savane 3.5