Software Archive
Read-only legacy content
17061 Discussions

Suggestion for Amplifier improvement: callgraph filtering

Dmitry1
Beginner
421 Views
This is a suggestion for improving viewing of Amplifier data: allow filtering of results based on callgraph structure. Here's the use case: I only case about the performance of a specific function and its descendants. I cannot reliably tell when the function starts and stops so I can't use pause|continue feature. Instead, I run full analysis, find the top-level function I care about, right-click on its name and select "Concentrate on subtree". Amplifier would remove all functions that are not called, directly or indirectly, from the top-level function I selected and re-calculate the %s for each remaining function. This is a very handy feature present in another commercial run-time analysis tool.
0 Kudos
5 Replies
Vladimir_T_Intel
Moderator
421 Views

Thanks Dmitry for the contribution. I think I know the run-time analysis tool you mentioned. There is one huge difference to Amplifier. Amplifier does not provide exact call graph unlike to other tools based on instrumentation. So, the Bottom-up and Top-down trees provided by Amplifier are based on unwinding of stack of the functions in the hot spot list. There is no timing info regarding other functions in the call tree. What I mean is: Amplifier provides timing for the hotspot function itself and the same functions contribution being called in the different stacks. So, we cannot compare the timing for the functions in the same sub-tree. Thats how the statistical sampling approach works.

If you believe that I missed your idea (e.g. you still might be interested by filtering the hotspot functions found in the call tree of the function-of-interest), please let me know we could discuss it further
0 Kudos
Dmitry1
Beginner
421 Views
You right, callgraph filtering won't work. I forgot that the Amplifier does statistical callgraph.
0 Kudos
Vladimir_T_Intel
Moderator
421 Views
Quoting - Dmitry
You right, callgraph filtering won't work. I forgot that the Amplifier does statistical callgraph.
It's more precise to call it "statistical call tree" :)
0 Kudos
Dmitry1
Beginner
421 Views
Quoting - Dmitry
You right, callgraph filtering won't work. I forgot that the Amplifier does statistical callgraph.
I thought about it overnight and I think you can make it work. There are two basic ideas:
1. If you have A call B call C, and whenever you sample, you only see A->B->C call stack (and never only A->B or A), then you can say that the self-times of A and B are 0.
2. If X calls Y and Z only, then total time of X is total time of <...> -> X -> Y PLUS total time of <...> -> X -> Z (where <...> represents arbitrary sequence of callers. well, save for recursion). In other words, you can propagate total times up the statistical call graph.

So, say you sampled your run and collected the following % of time spent for each call stack:
1) A -> C -> D: 10%
2) A -> C -> E: 5%
3) B -> C -> D: 15%
4) B -> C -> E:20%
5) A -> C: 5%
6) B -> F -> E: 25%
7) B: 20%

Now let's say you want to filter the graph on function C and its descendants. The total time of all paths that go through C (paths 1 to 5) is 55% of the overall time. Easy enough. The time in A itself is 0 (since A never appears at the bottom of any path). So you get this breakdown:

1) + 3) give C -> D: 25% / 55%
2) + 4) give C -> E: 25% / 55%
5) gives C: 5% / 55%

So all times are accounted for without any guessing.

Does this make sense?
0 Kudos
Vladimir_T_Intel
Moderator
421 Views

Hi Dmitry,

Yes, it really makes sence. What youve just explained in the example is partially implemented in the Hotspot Top-down Tree. The only thing is that a function C (from your example) must be initially in the hotspot list. So, by selecting it in the Hotspot Bottom-up view and switching to Top-down Tree view, youll get the self-time/total-timedistributionfor the selected. What were missing is normalization the function C to 100%

We are considering a flexible filtering mechanizm for out furure products, so it might be a good idea to implement a predefined filter for that. Thanks for you contribution.

0 Kudos
Reply