APLX Help : Performance Profiling
|
|
Performance Profiling |
|
OverviewPerformance profiling can be used to find out which parts of your APL code take the most time to execute, or are executed most often, and so helps you to determine which functions to concentrate on when optimising performance. You can view the performance data in a number of different ways, and easily 'drill down' to get more detail on exactly where execution time is spent. You can either use the very easy menu-based profiling described below, or for more detailed control use Profiling using the Tools menuFor simple profiling you can enable profiling through the APLX Tools menu. You then run the code to be profiled. When the code completes and APLX returns to desktop calculator mode, the profile is automatically shown in a Profile window. When you select 'Performance Profiling' from the Tools menu, APLX brings up a dialog which offers you a choice of different methods for measuring the execution time: Depending on which platform you are using, one or more of the timing methods may not be available. For example, earlier versions of Windows cannot measure the number of CPU cycles used by an application. If the method specified is not available it will be disabled in the dialog. Measuring CPU cycles, if available, usually gives the most accurate results. (See the description of Once you click OK on this dialog, profiling is enabled. You then run your APL code (a function, which in turn will typically call many other functions, and can ask for input from the user as part of its operation). As soon as the function finally completes or is interrupted, and APL returns to desk calculator mode, profiling is automatically disabled and the results window will open. In this example (based on the HELPOBJECTS workspace supplied with APLX in library 10), we have executed a function called As you can see, the results are displayed on five tabs. The first tab ("By Line") tells you which individual function lines have taken the most CPU (or elapsed) time, as shown above. They are initially sorted with the one which has taken the most time first, but you can change the sort criteria by clicking on the header of a column. CPU usage by lineIn our example, the function line which has been most CPU-intensive is line 6 of The critical information is usually in the column shown as 'Self Only'. This relates to the CPU usage for the line itself, excluding any functions called by the line. The next column ('Self+Children') displays the time taken both in the line itself and in any functions called. In our example, line 12 of By selecting the 'Graph By Line' tab, you can get an immediate graphical representation of which lines took the most CPU time: CPU usage by functionAs well as looking at individual lines, you can also get an overview of which functions (and methods) took the most time, by selecting the second tab of the results window ('By Function'): From this display you can 'drill down' within a given function, to find out where the time is spent in that function, by clicking on the twist-down by the function name: The 'Graph By Function' tab shows the overview by function as a pie chart. CPU usage by Call ChainThe third way of looking at the data is by call chain. This is best shown by our example: This shows that, unsurprisingly, 100% of the time was spent in our top-level function Saving the profiling data as a web pageAs well as looking at the data in the APLX window, you can select 'Save As Web Page' from the File menu. This saves a complete report (either as a summary of the most important items only, or of the whole application), as a web page which you can load in any standard browser. |
|
APLX Help : Performance Profiling
|
Copyright © 1996-2010 MicroAPL Ltd