After analyzing application performance with Visual Expert or in response to user feedback, you may need to profile your PowerBuilder code to identify which lines need to be refactored to improve the response time of a given feature.
Visual Expert allows you to generate a trace of your PowerBuilder code and analyze it to quickly identify the lines of code that consume the longest time in a given process.
This tutorial describes the results provided by Visual Expert and how to activate code profiling to identify PowerBuilder code that needs to be optimized to improve a slow feature.
Visual Expert delivers relevant, readable results by displaying in the treeview only those components that consume the most time in a process.
By default, only those items consuming more than 20% of a process's time are displayed.
You can change this setting by clicking on the wrench to the right of the macro.
Select an item in the treeview to display its code.
Lines that consume the most time are highlighted in red in the source code view.
On the left, Visual Expert indicates the execution time of the line in question as a percentage.
For example, if a method takes 10 minutes to execute, and one line of code in that method takes 7 minutes to execute, that single line represents 70% of the total time taken to execute the method.
The “Get Children” macro enables you to obtain a list of direct children whose execution time is longer than a certain duration.
By default, Visual Expert displays children whose execution time is higher than 5ms.
You can change this setting by clicking on the wrench to the right of the macro.
//Start Tracing vepbtracemanager veperfmang veperfmang = create vepbtracemanager veperfmang.starttrace("VEPB.INI")
For Example:
//Stop Tracing vepbtracemanager veperfmang veperfmang = create vepbtracemanager veperfmang.endtrace("VEPB.INI")
For Example:
StartTrace and EndTrace methods use the VEPB.INI file as input.
This file contains the default configurations required to create the output file along with the parameters to be measured. (See below)