ABAP Profiler – Aggregation by Call Stack
If you have not seen the ABAP Profiler in Eclipse yet, I recommend this quick introduction that spotlights all analysis tools of the ABAP Profiler in SAP NW ABAP 7.4 SP2 for non-aggregated traces.
I was trying to profile the extraction of SQL monitor (SQLM) results to a file, which may take several minutes. The non-aggregated trace aborted with error state ‘Size exceeded’ (see below).
Of course, I could try to repeat the measurement with an aggregated trace but traces aggregated by call position contain less information and offer a very restricted set of analysis tools.
In this situation, a new feature of the ABAP profiler in Eclipse in SAP NW ABAP 7.5 provides a significant improvement: Aggregation by Call Stack. This aggregation mode is recommended whenever non-aggregated trace files become too large. In difference to non-aggregated traces, the chronological order of trace events and the individual execution times of each trace event are not contained in traces aggregated by call stack. As a consequence, the trace files are much smaller. I repeated the trace with this new mode and succeeded with a trace file of 149KB where 30MB have not sufficed before (see below).
For the second trace in the ABAP Traces view above, I have used the trace parameters shown below.
In particular, I have chosen the new trace parameter aggregation by call stack (“Yes, I need the Aggregated Call Tree (medium file size)”) and traced procedural units and SQL statements. Non-procedural trace events (SQL statements in this case) are called specified statements.
In my experience, often trace files with aggregation by call stack are not much larger than the old fallback option – trace files aggregated by call position (option “Yes, Hit List is sufficient (small file size)”). That’s great news, especially when I realized how to access the additional information about call stacks by new analysis tools in several ways. Let me show you!
New Analysis Tools
The first new analysis tool – the Condensed Hit List shown below – provides information about called units (methods, functions, forms, programs, transactions, …). You see how often, from how many different call stacks and from how many different call positions the unit was called. Most importantly, three execution times of the units are listed. The Total Time includes the total execution time of call statements (e.g. call method) of the unit. The difference between the two Own Times is whether they include the execution time of specified statements (SQL statements in this case) or not.
The Condensed Hit List is a good starting point for the analysis of traces. For example, to display the four different call stacks of method CL_ABAP_GZIP->COMPRESS_BINARY in the second line of the Condensed Hit List, I simply right-click on the line and choose “Show Call Stack” in the context menu. Then, in the Properties View, each of the four stacks can be displayed as below.
Now consider method CL_SQLM_METADATA->GET_MD_FOR_TABLES in the Condensed Hit List. Observe the difference between the two Own Times of this method. This means that the method spends a lot of time in specified statements. I navigate to the source code simply by double-clicking on the line of the method and remark that two specified statements of the method are SELECT loops. But I can find out even more details easily! I right-click on the line of the method in the Condensed Hit List, choose “Show in Aggregated Call Tree” and click on “Show” in the Statement Filter column of the method. As below, I see that the first select loop on table DD02L took significantly longer than the second one on table DD06L.
With the last mouse clicks, I arrived in the second new analysis tool, the Aggregated Call Tree shown above. For traces aggregated by call stack, it displays all execution details contained in the trace, namely the tree of all call stacks of trace events with their execution counters and execution times. The tool is very suitable for detail analysis. A single mouse click unfolds those parts of subtrees that consumed most of the time. Furthermore, for each trace event, navigation to the source code and to all related entries in other analysis tools of the ABAP profiler is supported.
With SAP NW ABAP 7.5, the ABAP Profiler in Eclipse offers aggregation by call stack. This aggregation mode is the new fallback option whenever no aggregation is not applicable. New analysis tools – the Condensed Hit List and the Aggregated Call Tree – interact nicely with each other and with the other tools of the ABAP profiler. I use these tools to get an overview, to explore and to discover efficiently useful execution details from a trace.
The option to view call stacks was formerly reserved to non-aggregated traces and is now also available for the often unavoidable fallback option! In my opinion, this takes ABAP performance analysis to the next level.