Display Probe-Events as Tree

Questions about YourKit Java Profiler
Post Reply
meysholdt
Posts: 2
Joined: Fri May 03, 2013 8:16 am

Display Probe-Events as Tree

Post by meysholdt »

Hi,

I've been using probes quite intensely during last weeks:
http://blog.moritz.eysholdt.de/2013/04/ ... ation.html
http://github.com/meysholdt/performance_probes

They've proved to really useful to gather performance statistics so far :-)

However, there is a scenario that I have some trouble with: Many events that I record via probes can occur in a nested fashion because implementations make use of recursion: You can think of:

Code: Select all

public void expensive(Data data) {
  internalExpensive()
  for (Data child:data.getChildren()) 
    expensive(child);
}
When I now record events for "expensive()" in a table, it is hard to make sense of the recorded data, because:
- the recorded wall time includes the wall time of child events but
- it is unclear which children these actually are.

I'd love to see the recoded events in a tree, just in the same way as yourkit already displays the "Call Tree". I'm aware that in the I can display a call three for the recorded events as well, but displaying the full call stack is too much information for my scenarios. The recorded events get lost in the sheer size of the tree.

What's the best practice to display nested events in Probe tables? Are there helpful Yourkit features that I haven't discovered yet?

thanks,
Moritz
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Display Probe-Events as Tree

Post by Anton Katilin »

Hi Moritz

Thank you very much for your interest and for sharing your experience in the blog.

Currently, there is no good way to show nested events as you described, but it definitely worth being added.

Let's discuss how to better present it in the UI. Should it be a dedicated view under Probes?

The closest view to what we need seems the Event timeline. It shows events as a sequence. It's a plain list now: there is no grouping, not indentation. The only aid is the "Time range" column which helps to (roughly) visually distinct nested events.

If we show nested events as sub-nodes, would it be enough? There would be:

Code: Select all

expensive event 1   time 100
  expensive event 2  time 10
     expensive event 3  time 5
  expensive event 4  time 20
  expensive event 5  time 15
We could also add "Own time" column, just like in the CPU profiling results. Own time of an event would be its time minus time of its nested events, i.e. time spent in the event by itself, internalExpensive() in your example:

Code: Select all

expensive event 1   time 100  own time 55 (= 100 - 10 - 20 - 15)
  expensive event 2  time 10 own time 5 (= 10 - 5)
     expensive event 3  time 5 own time 5 (nothing nested)
  expensive event 4  time 20 own time 20
  expensive event 5  time 15 own time 15
Best regards,
Anton
meysholdt
Posts: 2
Joined: Fri May 03, 2013 8:16 am

Re: Display Probe-Events as Tree

Post by meysholdt »

Hi Anton,

thank you for your reply.
Let's discuss how to better present it in the UI. Should it be a dedicated view under Probes?
Yes, probably. First I thought it's perfectly fine to look at nested events in a tree view and to look at sequential events in a list view. However, It can also make sense to look at nested events in a list view.

Example: Load files that contain import statements to load other files:

Code: Select all

public void loadFile(String name, List<String> loaded) {
  String contents = getContents(name)
  loaded.add(contents);
  for(String imported: getImportsFromFile(contents)) {
    loadFile(imported, loaded);
  }
}
Now let's imagine there is a probe on "loadFile" that also records the "name" parameter in to a column. Two interesting questions that the probe can help you with are:
- Which file (including imports) took the longest time to load and was it because of the file itself or because of imported files? For this it would be nice to see the events in a tree which can be unfolded until the time-eaters are unveiled.
- Have the same files been loaded multiple times (because the same file has been imported by two other files)? For this, Youkits "group by" feature is quite helpful already. I'd group the table by the column "filename" and see which groups contain more than one row. problem solved :) However, since the grouping-feature already turns the list view into table, I'm not sure how this can work if the view already is a table.
If we show nested events as sub-nodes, would it be enough?
Yes, I think so. And I find your idea of having an "Own time" column quite important. Actually, I find it even more important than in CPU profiling results because it tells me, as the one who implements probes, if I have created probes for all relevant nested events or if there is some time-consuming code hiding in the "dark".

regards,
Moritz
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Display Probe-Events as Tree

Post by Anton Katilin »

Hello Moritz

FYI: Event timeline now shows nested events as a tree:
http://www.yourkit.com/eap

Best regards,
Anton
Post Reply