Axe Diagnostic ToolThe Axe Program Diagnostics Tool is an Axe utility that allows you to run diagnostics on the runtime speed of your program, analyzing relative and absolute speeds of various subroutines. The utility works by setting up an interrupt that periodically samples your program to see in which routines it is spending the most amount of time. It also traverses the stack during each call to give you even more information.For example, is your game running slow? Can't figure out which part is slowing it down the most? Set up the Axe Program Diagnostics Tool to track all of your major subroutines, and it will tell you how long your program is spending in each routine. If you need higher fidelity, you can also place additional labels inside of a single subroutine to see which parts are taking the most amount of time.
The screenshot below gives a good example how this program works, and specifically the difference between inclusive and exclusive samples. A label gets an inclusive sample every time it's own code is sampled, and a label gets an exclusive sample any time it has it's own code, or the code of any routine it has called, sampled. Below, there are 4 labels, MAIN L1 L2 and L3. MAIN is just the main loop that calls L1 and L2. L1 displays a sprite, L2 pauses and then calls L3, and L3 just pauses.
When we look at the inclusive percent, we can see that MAIN has very little, since it is barely doing anything (just calling 2 subroutines and looping). L1 has practically zero percent, because the only thing it does is call another subroutine (to draw a sprite) which is not counted in the inclusive percent. Both L2 and L3 are about the same, they both have inclusive samples proportional to the amount of work they do. The 'Other' label has 11 percent, which accounts for the time spent displaying the sprite. But when we look at exclusive percent, things get a little bit more interesting. The percent for MAIN is 100%, since all code that is ever executed is either in MAIN, or inside of a function MAIN calls. L1 now has the same percent as 'Other' since L1 itself barely contributes and gets all it's percent from the sprite routine it calls. L2 has increased since it calls L3. 'Other' always remains the same between Inclusive and Exclusive.