PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
New WINDEV 27 feature!
  • In this lesson you will learn the following concepts
  • Overview
  • Starting the performance profiler
  • Analyzing the result
Lesson 6.3. Performance profiler
In this lesson you will learn the following concepts
  • Overview.
  • Starting the performance profiler.
  • Analyzing the result.
Lesson duration

Estimated time: 15 mn
Previous LessonTable of contentsNext Lesson
Overview
The performance profiler (also called Profiler) checks and optimizes the execution time of processes in your application.
The principle is straightforward:
  • You test your application.
  • During this test, the performance profiler keeps track of all actions performed and saves the execution times of each one of the processes run.
At the end of the test, the performance profiler displays:
  • the 10 most time-consuming operations,
  • the duration and the number of calls for all processes run.
The "WD Optimization" project has a specific window that shows useful data with the performance profiler.
Starting the performance profiler
The performance profiler can be started:
  • from the WINDEV editor:
    In this case, the project is automatically run in test mode. You can use your application and start the processes of your choice.
    To go back to the WINDEV editor, simply exit your application..
    Then, the performance profiler displays the result of the analysis. This result is saved in a WPF file.
  • from one of your WLanguage processes, with the following functions:
    ProfilerStartStarts "collecting data" for the performance profiler.
    ProfilerEndStops "collecting data" for the performance profiler.

    In this case, only the code between ProfilerStart and ProfilerEnd will be analyzed. The result is saved in a WPF file.
  • The first method will be used in our example. To start the performance profiler on the "WD Optimization" project:
    1. On the "Project" tab, "Audit and performance" group, expand "Analyze performance" and select "Analyze performance".

      Note

      The performance profiler can also be started from the project dashboard, via the "Performance" widget. To do so:
      • enable the widget if necessary (click the link "Click here to re-enable").
      • expand the drop-down arrow and select "Analyze performance".
        Widget on the dashboard
    2. The project test is run.
    3. Click the "Test window of performance profiler" button.
    4. Click the "Process to analyze" button.
    5. Validate the information window and stop the project test. The performance profiler report window appears.
Analyzing the result
  • Let's analyze the report window of the performance profiler. Results are displayed in several tabs:
    • the "Summary" tab shows the ten longest processes.
    • the "Mapping" tab shows a graphical view of the main processes.
    • the "Details" tab shows all processes run during the application test (from the slowest one to the fastest one).
    • the "Calls" tab is used to view the details of operations performed in a process.
  • Let's present these different tabs in our example.
    • The "Summary" tab shows the ten longest processes. In our example, you can see that the local procedure named "UpdateProductStock" takes more than 3 seconds to run.
      Performance profiler - Summary
    • The "Mapping" tab is used to visually identify what took the longest time. In our case, it's a call to Ping:
      Performance profiler - Mapping
    • The "Details" tab shows all processes or events run, from the slowest one to the fastest one.
      Performance profiler - Details
      The following information is displayed for each process or event:
      • Function: Function, event or procedure run.
      • Total time: Function execution window.
      • Internal time: Execution time due to the engine.
      • Nb of calls: Number of calls made to the function (procedure or event).
      • Time 1 call: Execution time of a call to the function (procedure or event).
      • Code %: Percentage of time it took to process the function or procedure (developer code that can be optimized).
      • Parent: Element that contains the process.
  • In our case, the "Details" tab indicates that the call to the "Ping" function is one of the elements taking the longest time.
    1. Select this line. We are going to check whether this slowdown is caused by a specific problem.
    2. Click "Calls" to view the details of the calls to the UpdateProductStock procedure.
    3. Select the "Ping" line and click "Code": the corresponding line of code appears in the editor.
    4. Close the performance profiler.
    5. The following line of code is run:
      // Checks the accessibility of the supplier server
      Ping("supplier-addr")
      The slowdown is caused by the fact that the address specified for Ping is not accessible.

      Note

      The code editor shows a "Wrong way" icon to indicate that an error has been found on this line of code at runtime. The details of the error are shown when hovering over the icon.
  • Let's check how the application works when this code is optimized:
    1. Replace the line of code containing Ping by the following line of code:
      // Checks the accessibility of the supplier server
      Ping("www.google.com")
    2. Save the code (Ctrl + S).
  • We will restart the performance profiler:
    1. On the "Project" tab, "Audit and performance" group, expand "Analyze performance" and select "Analyze performance".
    2. The project test is run.
    3. Click the "Test window of performance profiler" button.
    4. Click the "Process to analyze" button.
    5. Validate the information window and stop the project test. The performance profiler report window appears.
    6. In the "Mapping" tab, Ping does not appear with the same importance.
      Performance profiler - Mapping
  • Close the performance profiler report window.
Previous LessonTable of contentsNext Lesson
Minimum version required
  • Version 27
Comments
Click [Add] to post a comment