The Stack Profiler enables you to set a marker in your source code so that whenever execution hits that marker, a full stack trace is captured. As the application continues executing and the marked position is accessed from a variety of places within the running executable, a very detailed and useful picture is built up showing hot spots and usage scenarios for a particular point in code.
The Stack Profile report, like the Memory Profile report, is displayed in 'reverse stack' order. This means that the root of the report is always a single node (in this case the marker) and the tree then fans out to show all the various places the marked position has been accessed from.
Use the Stack Profile mode to produce a report that shows the unique ways in which a function can be invoked during the running of a program. Determine the parts of the model that rely on this function and their frequency.
Profiler modes are selected using the Profiler control Toolbar. If a Profiler Point is already created, it is displayed. The Profiler Point is the point at which stack traces are captured. You can set the Profiler Point using the Set button on the control itself, once the mode is selected. After deciding on the Profile Point, build the project to be sure everything is up to date, then start the Profiler. The number of unique stack holdings detected is visible during the run.
A results can be produced by clicking the report button on the Profiler control Toolbar. This button is enabled when either:
- Capture is turned off (using the Pause Button) or
- The Profiler is stopped (using the Stop Button)
The results produced are displayed as a weighted call graph, where the lines on the graph represent a unique stack, and weighted to show the higher frequency stacks first. The report can then be saved, either to file or to the model, using the context menu of the report itself.