Set up Performance Analysis for PowerBuilder

Visual Expert helps to improve the performance of PowerBuilder code, by analyzing application execution statistics, generated by multiple machines and user sessions.

This tutorial describes how to enable performance tracing and identify the code that needs to be tuned to improve the overall performance of a PowerBuilder application.

Step 1: Collecting Application Usage data

  • It is mandatory to add the PBL provided by Visual Expert to your application. This PBL will generate a trace file anytime there is a new user session. For multiple workstations, one file will be generated  per user session and workstation. 
  • These trace files will consist of statistical data gathered from the execution of application objects. Visual Expert will use this data to analyze code performance and display results in graphical format. 
  • The trace files will be created in a common folder, so that VE can find them and include them in its static code analysis process. 

Activate PB Code Performance Tracing in the PowerBuilder Application

  1. Open your application in the PB IDE
  2. Add the veperfmanager.pbl file. It contains the functionality to extract performance analysis for executed functions or events.   

    Location of veperfmanager.pbl 
    C:\Program Files\Novalys\Visual Expert 2023\PowerBuilderPerformance

  3. Once the VEPerfManager PBL is added to the application, enter the following code in the application startup to record performance data. 
          //Start Tracing 
          vepbtracemanager veperfmang
          veperfmang = create vepbtracemanager

    For Example:
    Start Tracing PowerBuilder Code Performance

  4. Enter the below code when closing the application to stop tracing performance data. The *.vepbperf file will be generated containing the performance data of that session
          //Stop Tracing 
          vepbtracemanager veperfmang 
          veperfmang = create vepbtracemanager

    For Example:
    End Tracing PowerBuilder Code Performance

    StartTrace and EndTrace methods use the VEPB.INI file as input.
    VEPB.INI file Input for Performance Analysis

    This file contains the default configurations required to create the output file along with the parameters to be measured. (See below)

    1. FunctionOrEventTime=
      This field allows you to decide whether to include the functions and events in the performance analysis by VE. The field value can be either 1 or 0 respectively.
      For instance:
      FunctionTime=1 → indicates to include functions
      EventTime=1 → indicates to include events
      FunctionOrEventTime=1 → indicates to include both functions and events
      ActiveLog=1 → provides more information when a user faces difficulties using the PB Performance functionality
    2. OutputDirectory=
      This field sets the output directory path for the performance file(*.vepbperf). By default, it will use the folder containing the PB target.
      Output Directory Path for PB Performance File
  5. On closing the application, the .vepbperf file is generated as shown above.

Step 2: Analyzing and Visualizing the Data

  • Create a VE project combining the PB source code and the performance data stored in  the .vepbperf file. 
  • That will enrich the description of the application’s structure with performance information. 
  1. Create a Visual Expert project including the vepbperf file. 
  2. To do so, open the [Project] section in the ‘More Settings’ window.
    Go to Performance Analysis > Locate PB Performance. 
  3. Insert the vepbperf file path located on your PC. Click [OK].

  4. Run a new analysis or refresh the analysis of your PowerBuilder project. 
    Visual Expert will take into account the new performance statistics recorded in vepbperf each time you run a new analysis.

    In the Navigation Bar, you will see a new set of macros under the [Performance Analysis] group.
    PB Code Performance Tuning Macros

Each macro analyzes the performance of your PowerBuilder application from different angles. The visual representation of execution times, combined with the call graph, allows developers to identify and locate slow PowerBuilder code that should be improved.

Know more about Visual Expert Performance Analysis for PowerBuilder Apps