Rate This Document
Findability
Accuracy
Completeness
Readability

Profiling Process

Prerequisites

  • The server and OS are running properly.
  • An SSH remote login tool has been installed on the local PC.
  • The System Profiler has been installed in the target environment and is running properly.
  • Python 3 has been installed in the target environment.

Procedure

  1. Execute the demo on Python 3.

    In this interface, the plus sign (+) is used to concatenate character strings in the for loop. The demo takes about 11 seconds.

    Figure 1 Executing the demo
  2. Add the Python 3 directory to the application path configuration.

    Because Python 3 is not in the default tool path, add the Python 3 directory to the application path configuration item or move the application to the /opt or /home path.

    Figure 2 System configuration
  3. Create a hotspot function analysis task.

    Click next to the System Profiler and select General analysis. On the task creation page that is displayed, select Hotspot Function, set the required parameters, and click OK to start the hotspot function analysis task. Retain the default values for the parameters unless otherwise specified.

    Figure 3 Creating a hotspot function analysis task
    Table 1 Task parameters

    Parameter

    Description

    Analysis Type

    Set it to Hotspot functions.

    Analysis Object

    Set it to Application.

    Mode

    Set it to Launch application.

    Application Path

    /usr/bin/python3

    Application Parameter

    /opt/testdemo/concatenate_string.py string_plus

    Sampling Duration

    Set it to 10.

    Call Stack

    Enable this option.

  4. View the hotspot function analysis result.

    Check the top 30 hotspot call stack functions on the Overview page. The memcpy function implements memory replication, and the __libc_realloc function allocates memory. These functions consume a large number of CPU resources.

    Figure 4 Overview
  5. Analyze performance bottlenecks.

    Strings are immutable in Python. When "+" is used to concatenate a large number of character strings in a loop, memory application, allocation, and character string replication are frequently performed. As a result, the performance is low.