A method and system for automatic analysis of program performance bottlenecks

By using automated analysis tools to monitor and calculate key performance parameters in real time and generate structured reports, the problem of existing performance analysis tools being complex and inefficient is solved. This enables rapid identification and optimization of program performance bottlenecks and improves development efficiency.

CN122111783APending Publication Date: 2026-05-29成都安易迅科技有限公司

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
成都安易迅科技有限公司
Filing Date
2026-01-08
Publication Date
2026-05-29

Smart Images

  • Figure CN122111783A_ABST
    Figure CN122111783A_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a kind of program performance bottleneck automatic analysis method and system, it is related to application research and development technical field.The method can respond to the program running instruction input by user, based on target program path, run target program, then according to monitoring parameter setting performance analysis tool data acquisition strategy, and in target program running process, according to data acquisition strategy, monitoring data is obtained from event tracking interface.After target program ends, based on analysis algorithm and monitoring data, calculate key performance parameters, then according to result output mode and key performance parameters, generate structured report.Data acquisition strategy includes the counting object of performance counter and process filtering rule.The method can automatically call event tracking interface to complete performance data acquisition and analysis by user specified analysis rule, and real-time output performance bottleneck analysis result, can reduce the complexity of program performance analysis operation, improve program performance analysis efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of application development technology, and in particular to a method and system for automatic analysis of program performance bottlenecks. Background Technology

[0002] In the development of software applications, performance analysis is necessary to identify performance bottlenecks. A performance bottleneck refers to a software or hardware factor that limits the overall performance of a program due to the inefficiency of a particular part of the program. Accurately pinpointing performance bottlenecks facilitates performance optimization of the developed program.

[0003] When performing performance analysis, tools such as Windows Performance Analyzer (WPA) can be used to help developers identify issues such as high CPU usage, memory leaks, and I / O blocking by collecting data such as system events and process activity. WPA can enable program performance debugging on the Windows operating system platform through Event Tracing for Windows (ETW), performance monitoring, and data analysis.

[0004] However, performance analysis tools such as WPA require users to manually configure tracing parameters, filter performance data, and analyze multi-dimensional metrics, making the operation complex. Furthermore, performance analysis involves multiple steps, including starting the tool, setting the tracing range, running the program, stopping tracing, loading data, and manually locating bottlenecks. This process is time-consuming and involves a lot of repetitive work, making it inefficient when problems need to be frequently reproduced during iterative development. Summary of the Invention

[0005] In view of this, embodiments of this application provide an automatic program performance bottleneck analysis method and system to solve the problems of complex and inefficient program performance analysis operations.

[0006] According to a first aspect of this application, an automatic analysis method for program performance bottlenecks is provided, the method comprising: Obtain program execution instructions input by the user, the program execution instructions including the target program path, monitoring parameters, analysis algorithm, and result output method; In response to the program execution instruction, the target program is executed based on the target program path; The data acquisition strategy of the performance analysis tool is set according to the monitoring parameters, and the monitoring data is acquired according to the data acquisition strategy; the data acquisition strategy includes the counting object of the performance counter and the process filtering rules; the monitoring data includes program running events acquired through the event tracing interface of the performance analysis tool during the execution of the target program; After the target program finishes running, key performance parameters are calculated based on the analysis algorithm and the monitoring data. The key performance parameters include a sequence of performance bottleneck indicators generated after filtering non-key indicators through a rule engine. Generate a structured report according to the output method and the key performance parameters.

[0007] In some embodiments, obtaining user-input program execution instructions includes: Receive configuration information input by the user, the configuration information including interactive action information and / or configuration files input by the user through the configuration interface; Query the target program path based on the configuration information; Extract custom parameters from the configuration information. The custom parameters include at least one of the following: custom analysis dimension, bottleneck threshold, and result output method. Set the monitoring parameters according to the custom analysis dimension, and set the analysis algorithm according to the custom analysis dimension and the bottleneck threshold; The program execution instructions are generated by encapsulating the target program path, the monitoring parameters, the analysis algorithm, and the result output method.

[0008] In some embodiments, acquiring monitoring data according to the data acquisition strategy includes: Configure the data acquisition strategy for the data acquisition module; Listen for the start event of the target program; In response to the start-up event, the event tracing interface of the performance analysis tool is invoked through the data acquisition module; The monitoring data is obtained by filtering program execution events in the event tracking interface according to the data acquisition strategy.

[0009] In some embodiments, acquiring monitoring data according to the data acquisition strategy includes: Obtain the event monitoring data stream through the event tracking interface; According to the process filtering rules, target events are captured from the event monitoring data stream; the target events are program execution events associated with the data collection strategy. The target event is counted using a performance counter to generate count information; Performance data is generated based on the target event and the counting information; The performance data is cached in real time to a local temporary file.

[0010] In some embodiments, after the target program finishes running, key performance parameters are calculated based on the analysis algorithm and the monitoring data, including: Listen for the termination event of the target program; In response to the termination event, the data parsing interface of the performance analysis tool is invoked; the data parsing interface is used to load a preset analysis template and extract raw metrics. The key performance parameters are calculated based on the monitoring data using the data parsing interface and the analysis algorithm.

[0011] In some embodiments, the key performance parameters are calculated based on the monitoring data using the data parsing interface and the analysis algorithm, including: The analysis algorithm extracts a custom analysis dimension, which includes at least one of CPU dimension, memory dimension, and input / output dimension. Performance parameters are calculated based on the custom dimensions and the monitoring data. Specifically, when the custom analysis dimension includes a CPU dimension, the cumulative time consumed by the function call stack is statistically analyzed and sorted according to the percentage of the cumulative time consumed to generate CPU performance parameters. When the custom analysis dimension includes a memory dimension, memory leaks and memory-occupying objects are identified by analyzing memory allocation or release frequencies to generate memory performance parameters. When the custom analysis dimension includes an input / output dimension, disk read / write latency and network request response time are calculated, and these latency and response times are correlated with program files or interface call events to generate input / output performance parameters. Extract key performance parameters from the performance parameters.

[0012] In some embodiments, extracting key performance parameters from the performance parameters includes: Set the percentage threshold for non-critical indicators; Set the percentage threshold to the rule engine; The rule engine filters out non-critical indicators from the performance parameters to obtain a set of critical indicators; the non-critical indicators are performance parameters whose proportion is less than the proportion threshold. The key indicators in the set of key indicators are sorted according to their performance parameter proportions to generate the performance bottleneck indicator sequence.

[0013] In some embodiments, a structured report is generated according to the result output method and the key performance parameters, including: The report output format is matched according to the result output method, and the report output format includes at least one of text report, visual chart, and jump link; According to the report output format, report output elements are generated based on the key performance parameters; wherein, when the report output format includes the text report, the report output elements include the bottleneck name, indicator value, and code location; when the report output format includes the visualization chart, the report output elements include a percentage view; when the report output format includes the jump link, the report output elements include the link program location. The structured report is generated by assembling the report output elements.

[0014] In some embodiments, generating a structured report according to the result output method and the key performance parameters further includes: Historical data is extracted based on the key performance parameters, wherein the historical data are performance parameters of the same type as the key performance parameters calculated within a preset monitoring period; A comparison result object is generated based on the historical data and the key performance parameters; Add the comparison result object to the structured report; The structured report is sent to the user terminal, which displays the console, log files, and developer tool plugin panel.

[0015] According to a second aspect of this application, an automatic program performance bottleneck analysis system is provided, the system comprising: The configuration module is used to obtain program execution instructions input by the user, and in response to the program execution instructions, run the target program based on the target program path; the program execution instructions include the target program path, monitoring parameters, analysis algorithms, and result output methods; The data acquisition module is used to set the data acquisition strategy of the performance analysis tool according to the monitoring parameters, and to acquire monitoring data according to the data acquisition strategy; the data acquisition strategy includes the counting object of the performance counter and the process filtering rules; the monitoring data includes program running events acquired through the event tracing interface of the performance analysis tool during the execution of the target program; An automatic analysis module is used to calculate key performance parameters based on the analysis algorithm and the monitoring data after the target program finishes running. The key performance parameters include a sequence of performance bottleneck indicators generated after filtering non-key indicators through a rule engine. The results output module is used to generate a structured report according to the results output method and the key performance parameters.

[0016] According to a third aspect of this application, a computer device is provided, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor executes the program to implement the above-described automatic program performance bottleneck analysis method.

[0017] According to a fourth aspect of this application, a storage medium is provided on which a computer program is stored, wherein the program, when executed by a processor, implements the above-described automatic program performance bottleneck analysis method.

[0018] By employing the above technical solutions, embodiments of this application provide a method and system for automatic program performance bottleneck analysis. The method responds to user-inputted program execution commands, runs the target program based on the target program path, sets the data acquisition strategy of the performance analysis tool according to monitoring parameters, and acquires monitoring data from the event tracing interface according to the data acquisition strategy during the target program's execution. After the target program finishes running, key performance parameters are calculated based on the analysis algorithm and monitoring data, and then a structured report is generated according to the result output method and key performance parameters. The data acquisition strategy includes the counting object of the performance counter and process filtering rules. This method can automatically call the event tracing interface to complete performance data acquisition and analysis through user-specified analysis rules, and output performance bottleneck analysis results in real time, reducing the complexity of program performance analysis operations and improving the efficiency of program performance analysis.

[0019] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description

[0020] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: Figure 1 A schematic flowchart of the automatic analysis method for program performance bottlenecks provided in this application embodiment; Figure 2 This is a schematic diagram of the overall process of program performance analysis provided in the embodiments of this application; Figure 3 This is a schematic diagram of the electronic device module partitioning structure provided in an embodiment of this application; Figure 4 This is a schematic diagram of the historical data comparison process provided in the embodiments of this application; Figure 5 A schematic diagram of the structure of the automatic program performance bottleneck analysis system provided in this application embodiment. Detailed Implementation

[0021] The present application will be described in detail below with reference to the accompanying drawings and embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in the embodiments of the present application can be combined with each other.

[0022] In this embodiment, the automatic program performance bottleneck analysis method can be applied to the field of software application development. During the development of a software application, the developed application can be referred to as the target program. Because the performance of the target program is affected by factors such as the execution efficiency of the written program code, the collaborative relationships between different modules, data transmission, and interface call relationships, the overall program performance is limited, thus creating a performance bottleneck in the target program.

[0023] In this context, a program performance bottleneck refers to a software or hardware factor that limits the overall performance of a program due to the inefficiency of a certain part during program execution. To promptly identify performance bottlenecks and make targeted improvements in subsequent program development or iterations, performance analysis of the target program can be performed to accurately pinpoint the bottlenecks and optimize the program's performance.

[0024] In some embodiments, when performing performance analysis, performance analysis tools such as Windows Performance Analyzer (WPA) can be used to help developers identify monitoring states that cause program performance bottlenecks, such as high CPU usage, memory leaks, and I / O blocking, by collecting data such as system events and process activity. WPA can achieve program performance debugging on the Windows operating system platform through Event Tracing for Windows (ETW), performance monitoring, and data analysis.

[0025] Because performance analysis tools like WPA require users to manually configure tracing parameters, filter performance data, and analyze multi-dimensional metrics such as CPU utilization, thread blocking time, and disk I / O, developers need to be familiar with the operating principles of these tools and possess professional performance analysis knowledge. This results in a high learning curve for users, making performance analysis tools have a high barrier to entry.

[0026] Furthermore, the performance analysis process using performance analysis tools involves multiple steps, including starting the tool, setting the tracing range, running the program, stopping the tracing, loading data, and manually locating bottlenecks. Therefore, the entire performance analysis process is time-consuming and involves a lot of repetitive work, which reduces program development efficiency. This is especially true in iterative development where problems need to be frequently reproduced; the cumbersome analysis process leads to low efficiency in performance analysis.

[0027] The raw data output by performance analysis tools such as WPA is complex and can include various types of raw data such as process ID, thread stack, and call relationships. Users need to manually associate various metrics and sort performance consumption items. It cannot directly output structured results such as the top N performance bottlenecks, which makes bottleneck location unintuitive and makes it difficult for developers to quickly focus on key issues.

[0028] In addition, performance analysis tools such as WPA have low automation levels and lack seamless integration with the development process. They cannot achieve real-time monitoring during program execution or automatic analysis after program execution, requiring manual triggering of the analysis process, which affects the efficiency of problem localization.

[0029] To address the issues of complex and inefficient program performance analysis, this application provides an automatic program performance bottleneck analysis method in some embodiments. This method addresses the shortcomings of WPA performance analysis tools, such as complex operation, cumbersome analysis process, unintuitive results, and low automation. It enables automatic program performance bottleneck analysis based on an event tracking interface, automating the entire process of performance data collection, analysis, and bottleneck ranking, thereby reducing the operational threshold and improving performance optimization efficiency.

[0030] The method can be applied to electronic devices with data processing capabilities. These electronic devices include, but are not limited to, computers, servers, mobile terminals, smart wearable devices, and industrial control machines. For ease of description, this application embodiment uses an electronic device as the execution subject of the method. It should be understood that the method can also be applied to other types of execution subjects, which are not illustrated in this application embodiment. Figure 1 As shown, the method includes: S101. Obtain the program execution instructions input by the user.

[0031] When performing program performance bottleneck analysis, the user-input program execution instructions can be obtained first. These instructions can be used to control the electronic device to run the target program being analyzed and to specify the analysis method for the target program. Therefore, such as... Figure 2 As shown, the program execution instructions may include the target program path, monitoring parameters, analysis algorithm, and result output method.

[0032] The target program path refers to the storage path of the target program. Since the target program can be stored locally on the electronic device or on other devices with a communication connection to the electronic device, such as a network application stored on a server, the target program path can be either a local storage path or a communication path.

[0033] Monitoring parameters are used to set the runtime events and related data that need to be monitored during the execution of the target program. For example, monitoring parameters may include CPU utilization, thread blocking time, disk input / output (I / O) time, etc. Monitoring parameters can be set according to the function, scale, development progress, and application environment of the target program.

[0034] Analysis algorithms are used to determine the specific analysis methods for the data obtained during program analysis. An analysis algorithm can be a combination of one or more algorithms from a pre-defined set of automatic analysis algorithms. Furthermore, there is a correspondence between the analysis algorithm and the monitoring parameters. For example, when the monitoring parameters include CPU utilization, the analysis algorithm may include algorithms for calculating the cumulative time consumption of the CPU function call stack, algorithms for calculating the percentage of time consumed, and algorithms for sorting by percentage.

[0035] The output method is used to define how the automatic analysis results of program performance bottlenecks are displayed. Depending on the application scenario, user needs, and the interaction methods supported by the user's terminal, the output method can include various formats. For example, output methods may include text reports, visual charts, integrated development environment (IDE) links, and historical data comparisons.

[0036] The program execution instructions can be automatically generated by combining user-inputted instructions and preset automatic analysis rules. Specifically, in some embodiments, the electronic device can first receive the execution instructions input by the user for the target program, and upon receiving the instructions, retrieve the target program path in response. Then, it calls a user-pre-configured analysis configuration file and extracts the monitoring parameters, analysis algorithms, and result output methods for the target program from the configuration file. Finally, it generates the program execution instructions based on the target program path, monitoring parameters, analysis algorithms, and result output methods.

[0037] For example, for the same target program, users can pre-configure a unified analysis configuration file, specifying monitoring parameters, analysis algorithms, and result output methods within it. This configuration file is then stored in a database. During the target program's development phase, when a user inputs an execution command to control an electronic device to launch different application versions of the target program, the system can respond to the command, determine the target program path based on the target program's operation object, and query the database for the target program's monitoring parameters, analysis algorithms, and result output methods, thereby generating the program execution command.

[0038] like Figure 3As shown, in some embodiments, the electronic device may have a built-in configuration module. This module can be used to perform user interaction, that is, to enable the electronic device to display a configuration interface by running an interactive program. As an interactive interface, the configuration interface allows users to set target program paths, monitoring parameters, analysis algorithms, and result output methods by performing interactive actions.

[0039] Therefore, when obtaining program execution instructions input by the user, configuration information input by the user can be received. This configuration information includes at least one of the interactive action information input by the user through the configuration interface and a configuration file. For the interactive action information, the user can execute interactive actions based on the interactive controls in the configuration interface to generate interactive action information. The interactive action information can be mapped to user-specified content according to the execution logic of the interactive controls in the configuration interface.

[0040] For example, the configuration interface can include checkboxes for specifying monitoring parameters. Users can click to select CPU utilization from the checkboxes to specify CPU utilization as a monitoring parameter. The generated interactive information will then include a click on the CPU utilization option, mapping it to the function of specifying the CPU utilization monitoring parameter. Similarly, the configuration interface can also include checkboxes for specifying the analysis algorithm and the result output method.

[0041] The configuration file can contain fields that characterize the target program path, monitoring parameters, analysis algorithms, and result output methods. Electronic devices read these fields to obtain one or more combinations of the target program path, monitoring parameters, analysis algorithms, and result output methods. For example, if a user pre-configures monitoring parameters including CPU usage, the configuration file could include a field like "Monitoring parameters=CPUUsage".

[0042] The configuration file can be sourced from a database system, as described in the above embodiments. Alternatively, a file upload control can be set in the configuration interface. After the user clicks the file upload control and specifies the storage path of the configuration file, the electronic device can retrieve the uploaded configuration file through the file upload control.

[0043] After receiving the configuration information input by the user, the system can query the target program path based on that information. For example, if the user specifies the target program path as "D:\AA\BB\cc.exe" in the configuration interface, the target program path can be found in the configuration information.

[0044] When the user does not specify the target program path in the configuration interface, the electronic device can also extract the interactive action information corresponding to the program startup operation from the configuration information, and determine the storage path of the target program based on the interactive action information corresponding to the program startup operation, thereby determining the target program path.

[0045] For example, when an electronic device supports double-clicking to launch an application, the relevant information of the double-click operation can be extracted from the interaction action information, the program to be executed by the double-click operation can be identified as the target program, and the target program path can be determined based on the storage address of the target program.

[0046] While querying the target program path based on configuration information, custom parameters can also be extracted from the configuration information. These custom parameters include at least one of the following: custom analysis dimensions, bottleneck thresholds, and result output methods. Monitoring parameters are then set according to the custom analysis dimensions, and analysis algorithms are set based on the custom analysis dimensions and bottleneck thresholds. Finally, by encapsulating the target program path, monitoring parameters, analysis algorithms, and result output methods, program execution instructions are generated.

[0047] For example, the configuration module built into electronic devices can allow users to customize analysis dimensions through interactive operations of the configuration interface or configuration files, such as monitoring only CPU and memory, and defining bottleneck thresholds, such as triggering alarms when monitoring data shows that the CPU percentage is higher than 10%. They can also define output formats to adapt to the performance analysis needs of different scenarios.

[0048] S102. In response to the program execution instruction, run the target program based on the target program path.

[0049] After receiving the user's input program execution command, the electronic device can respond to the command and run the target program based on the target program path. When running the target program based on the target program path, the electronic device first performs path resolution, that is, by resolving the target program path, it determines the actual storage location of the target program file. Then, it performs file system access, searching for the target program file in the file system according to the target program path, and performs permission checks to determine whether the current user has permission to access and execute the corresponding program file.

[0050] When a user has access and execution permissions for a target program, the target program can be loaded into memory. For example, an electronic device can open the target program file, preparing to read its contents. Then, by reading the program file's header information, such as PE header information and ELF header information, the entry point, required memory layout, and dependent dynamic link libraries of the target program can be determined. Next, based on the program header information, memory space is allocated for the target program, including memory areas such as code segment, data segment, heap, and stack. Finally, the target program's code and initialization data are loaded from disk into the allocated memory space.

[0051] Simultaneously, electronic devices can create processes and threads based on the target program's execution. For example, a new process can be created to provide an independent runtime environment for the target program. And one or more threads can be created, with the main thread serving as the entry point for the target program, to run it.

[0052] While running the target program based on the target program path, the program can also trigger automatic execution of program performance bottleneck analysis through program execution instructions. This allows for the collection of data related to the target program's execution process during its operation, and automatic analysis based on the collected data after the target program finishes running.

[0053] S103. Set the data acquisition strategy for the performance analysis tool according to the monitoring parameters, and acquire monitoring data according to the data acquisition strategy.

[0054] After triggering automatic performance bottleneck analysis, the data collection strategy of the performance analysis tool can be set according to the monitoring parameters. This data collection strategy includes the counting objects of performance counters and process filtering rules. Performance counters are tools provided by electronic device operating systems or performance analysis tools to monitor system and application performance, and can collect and analyze system resource usage in real time.

[0055] Performance counters can be categorized into various types depending on the monitored object. For example, for CPU performance monitoring, performance counters may include CPU utilization (% Processor Time) counters and CPU queue length counters. For memory performance monitoring, performance counters may include available physical memory (Available MBytes) counters and committed virtual memory (Committed Bytes) counters.

[0056] Process filtering rules are used to filter specific processes in monitoring or event tracing for more efficient data collection and analysis. Within an ETW session, process filtering rules allow you to specify which processes' events should be captured.

[0057] The data acquisition strategy can be embedded into the analysis program for automatic program performance bottleneck analysis. Once executed, the analysis program can control the data acquisition process according to the data acquisition strategy, that is, during the target program's execution, monitoring data is collected according to the data acquisition strategy. This monitoring data includes program execution events obtained through the event tracing interface of the performance analysis tool during the target program's operation.

[0058] Event tracing interfaces are the infrastructure used for event tracing and performance analysis in performance analysis tools. They can act as event providers, recording events such as system behavior, application status, or performance metrics during the execution of the target program.

[0059] In some embodiments, the electronic device may have a built-in data acquisition module specifically designed to collect monitoring data related to the execution process of the target program. When acquiring monitoring data according to a data acquisition strategy, the strategy can be first set for the data acquisition module, and the module can listen for the target program's start-up event. Upon detecting the start-up event, the data acquisition module can invoke the event tracing interface of a performance analysis tool, and then filter the program execution events in the event tracing interface according to the data acquisition strategy to obtain monitoring data.

[0060] For example, the data acquisition module can call WPA's ETW tracing interfaces, such as StartTrace and EnableTraceEx2, and monitor CPU, memory, disk I / O, network, and other related performance information through preset performance counters. During monitoring, the process identity document (PID) or target program name can be specified through process filtering rules. This allows low-overhead data acquisition to be automatically initiated after the target program starts, with no significant interference to the target program's operation.

[0061] In some embodiments, monitoring data may include counting information, which is obtained through statistical analysis of events monitored by the event tracing interface. Therefore, when acquiring monitoring data according to a data collection strategy, the event monitoring data stream can be obtained first through the event tracing interface, and then target events can be extracted from the event monitoring data stream according to process filtering rules. The target events are program execution events associated with the data collection strategy, and these target events can be used for counting analysis. Performance counters are then used to count the target events to generate counting information, and performance data is generated based on the target events and the counting information. The performance data is then cached in real-time to a local temporary file.

[0062] For example, after the user specifies the target program path and monitoring parameters through the configuration module, the configuration module can generate program execution instructions and start the target program through the program execution instructions. At this time, the electronic device can automatically call the data acquisition module to start ETW tracing, so as to cache performance data to local temporary files in real time during program operation.

[0063] During the real-time caching of performance data, electronic devices can activate performance counters set in the data acquisition strategy and obtain event monitoring data streams through the event tracking interface. Then, based on the performance counters and process filtering rules, events in the monitoring data stream are filtered to extract target events. For example, if the data acquisition strategy specifies monitoring parameters including memory allocation frequency or memory release frequency, the electronic device can activate the performance counters for memory performance monitoring and, based on process filtering rules, limit the extraction of memory allocation and memory release events of the target program from the event monitoring data stream. Then, based on the event occurrence times corresponding to the extracted memory allocation and memory release events, the memory allocation frequency or memory release frequency is calculated.

[0064] S104. After the target program finishes running, calculate key performance parameters based on the analysis algorithm and monitoring data.

[0065] During the data acquisition process, monitoring data can be collected according to the data collection strategy, and it's also possible to monitor whether the target program has finished running. Upon detecting the completion of the target program's execution, the monitoring data can be automatically analyzed, specifically calculating key performance parameters based on the analysis algorithm and the monitoring data. These key performance parameters include a sequence of performance bottleneck indicators generated after filtering non-critical indicators through a rule engine.

[0066] To calculate key performance parameters, in some embodiments, the termination event of the target program can be monitored, and in response to the termination event, the data parsing interface of the performance analysis tool can be invoked. This data parsing interface is used to load a preset analysis template and extract raw metrics. Then, through the data parsing interface and analysis algorithms, the key performance parameters are calculated based on the monitoring data.

[0067] For example, electronic devices can have built-in automatic analysis modules. After the program ends, the automatic analysis module can call WPA's data parsing application programming interface (API), such as WpaLoadProfile for loading preset analysis templates and WpaQueryData for extracting raw indicators. Then, combined with the custom analysis algorithms in the data acquisition strategy, it can calculate key performance parameters based on the monitoring data.

[0068] In some embodiments, when performing the calculation of key performance parameters based on monitoring data by combining the data parsing interface with the analysis algorithm, a custom analysis dimension can be extracted from the analysis algorithm first. The custom analysis dimension includes at least one of the following: CPU dimension, memory dimension, and input / output dimension.

[0069] Performance parameters are then calculated based on custom dimensions and monitoring data, allowing for the calculation of different performance parameters for different custom dimensions. When the custom analysis dimension includes CPU, the cumulative time of function call stacks is statistically analyzed and sorted according to the percentage of cumulative time consumed to generate CPU performance parameters. For example, in the calculation of performance parameters related to CPU bottlenecks, the cumulative time of function call stacks can be statistically analyzed and sorted according to the percentage of cumulative time consumed to obtain CPU performance parameters for each process or program execution event.

[0070] When custom analysis dimensions include memory, memory leaks and memory-intensive objects can be identified by analyzing memory allocation and deallocation frequencies to generate memory performance parameters. For example, in the calculation of performance parameters related to memory bottlenecks, the memory allocation or deallocation frequency can be calculated according to the algorithm rules specified in the analysis algorithm. Then, based on the memory allocation or deallocation frequency, memory leaks and objects with high memory usage can be identified to generate memory performance parameters.

[0071] When custom analysis dimensions include input and output dimensions, disk read / write latency and network request response time are calculated, and these latency and response times are associated with program files or API call events to generate input / output performance parameters. For example, for performance parameter calculations involving I / O bottlenecks, disk read / write latency and network request response time can be calculated, and the calculated latency and response times can be associated with specific files or API call events.

[0072] After calculating the performance parameters, key performance parameters can be extracted. In some embodiments, to calculate key performance parameters, when extracting key performance parameters from the performance parameters, a percentage threshold for non-key indicators can be first set and passed to the rule engine. The rule engine then filters out non-key indicators from the performance parameters to obtain a set of key indicators. Here, the non-key indicators are performance parameters whose percentage is less than the percentage threshold. The key indicators in the set are then sorted according to their percentage to generate a performance bottleneck indicator sequence.

[0073] For example, after calculating performance parameters based on the performance data calculation method in the analysis algorithm, non-critical indicators can be filtered out using a rule engine. That is, parameters accounting for less than 5% of the performance parameters are filtered out, and the remaining parameters are identified as critical performance parameters. The results of the critical performance parameters are then sorted to generate a TOP N ranking of performance bottlenecks, representing the N hardware or software factors that have the most significant impact on the target program's performance. Examples include function A - CPU usage 35%, function B - memory leak 20%, and thread C - blocking 15%.

[0074] S105. Generate a structured report according to the output method and key performance parameters.

[0075] After calculating the key performance parameters, analysis results can be generated and output based on these parameters. Specifically, a structured report is generated according to the output format and key performance parameters. The structured report refers to a report format that outputs the key performance parameters according to the user-specified report output structure.

[0076] In order to generate structured reports, in some embodiments, when generating structured reports according to the result output method and key performance parameters, the report output format can be matched according to the result output method first. The report output format includes at least one of text reports, visual charts, and jump links.

[0077] Next, following the report output format, report output elements are generated based on key performance parameters. These elements are then assembled to produce a structured report. Specifically, when the report output format includes a text report, the output elements include the bottleneck name, metric value, and code location; when the report output format includes a visualization chart, the output elements include a percentage view; and when the report output format includes a link, the output elements include the location of the linked program.

[0078] For example, electronic devices can have built-in output modules that support multiple output formats. When outputting results in text report format, a structured report containing the bottleneck name, metric value, and code location can be generated. When outputting analysis results in visualization chart format, bar charts, pie charts, line charts, and other graphical objects can be generated based on key performance indicators (KPIs). These KPIs can then be displayed in the structured report through these graphical objects, such as showing percentages through bar charts. IDE jump links can be used to directly navigate to lines of code, allowing users to quickly view the code area corresponding to the bottleneck factor and make code adjustments.

[0079] By displaying performance consumption rankings through structured reports such as text and charts, and clearly marking specific metrics for each bottleneck item, such as time consumption, resource utilization, and number of calls, as well as associated code locations, such as function names and thread IDs, developers can directly pinpoint optimization priorities.

[0080] By applying the technical solutions of the above embodiments, the automatic program performance bottleneck analysis method described in the above embodiments can automatically call the WPA interface to complete performance data collection and analysis without requiring users to manually operate the WPA tool. This allows developers to trigger monitoring simply by starting the target program, without needing to master professional performance analysis knowledge, thus lowering the operational threshold.

[0081] The method integrates data collection, indicator calculation, bottleneck ranking and other processes. After the program runs, it outputs the TOP N results of performance bottlenecks in real time, eliminating the need for manual screening and data correlation, reducing the analysis time from hours to minutes and improving analysis efficiency.

[0082] The method also displays performance consumption ranking through structured reports such as text and charts, clearly marking the specific indicators and associated code locations of each bottleneck item, making it convenient for developers to directly locate optimization priorities and making the analysis results more intuitive.

[0083] The method also supports integration into the development process via command-line calls or IDE plugins. It can configure trigger conditions such as program startup, termination, and scheduled monitoring to meet the high-frequency performance testing needs in iterative development, realize a closed loop of development, testing, and analysis, and improve the automation and integration of program analysis.

[0084] In some embodiments, as a refinement and extension of the specific implementation of the above embodiments, in order to fully illustrate the specific implementation process of this embodiment, some embodiments of this application also provide an automatic program performance bottleneck analysis method. The difference between this method and the above embodiments is that it can provide a historical data comparison function when generating a structured report according to the result output method and key performance parameters. Figure 4 As shown, the method includes: S201. Extract historical data based on key performance parameters; S202. Generate a comparison result object based on historical data and key performance parameters; S203. Add the comparison results to the structured report; S204. Send the structured report to the user terminal.

[0085] To facilitate the identification of program performance bottlenecks, electronic devices can extract historical data from local data storage units or databases based on calculated key performance parameters when generating structured reports. This historical data consists of performance parameters of the same type as the key performance parameters, calculated within a preset monitoring period. For example, after calculating disk read / write latency and network request response time using an analysis algorithm, historical disk read / write latency and historical network request response time for the previous M versions of the target program can be extracted from the database to obtain historical data.

[0086] After extracting historical data, it can be compared with key performance parameters to generate a comparison result object. For example, the comparison result object can be a table view, with the left side of the table view displaying historical data and the right side displaying key performance parameters, showing the differences between the currently calculated key performance parameters and the performance parameters of the previous version.

[0087] After generating the comparison result object, the comparison result object is added to the structured report, and then the structured report is sent to the user terminal. The user terminal is used to display the console, log files, and developer tools plugin panel.

[0088] For example, after a user specifies the target program path and monitoring parameters through the configuration module, the electronic device can be triggered to start the target program, automatically invoking the data acquisition module to enable ETW tracing. During program execution, performance data is cached in real-time to a local temporary file. After the target program finishes running, the automatic analysis module loads the data and performs bottleneck calculations, generating ranking results. Then, the results output module pushes a structured report to the user's specified terminal for display in the console, log files, or developer tool plugin panels.

[0089] In some embodiments, as a specific implementation of the automatic program performance bottleneck analysis method described in the above embodiments, some embodiments of this application also provide an automatic program performance bottleneck analysis system, such as... Figure 5 As shown, the system includes: The configuration module is used to obtain program execution instructions input by the user, and in response to the program execution instructions, run the target program based on the target program path; the program execution instructions include the target program path, monitoring parameters, analysis algorithms, and result output methods; The data acquisition module is used to set the data acquisition strategy of the performance analysis tool according to the monitoring parameters, and to acquire monitoring data according to the data acquisition strategy; the data acquisition strategy includes the counting object of the performance counter and the process filtering rules; the monitoring data includes program running events acquired through the event tracing interface of the performance analysis tool during the execution of the target program; An automatic analysis module is used to calculate key performance parameters based on the analysis algorithm and the monitoring data after the target program finishes running. The key performance parameters include a sequence of performance bottleneck indicators generated after filtering non-key indicators through a rule engine. The results output module is used to generate a structured report according to the results output method and the key performance parameters.

[0090] The system includes a data acquisition module, an automatic analysis module, a result output module, and a configuration module. Each module works collaboratively through the ETW interface provided by WPA, the performance data parsing API (such as WpaExporter.exe), and a custom rule engine.

[0091] By applying the technical solutions of the above embodiments, the automatic program performance bottleneck analysis system described above can, after the configuration module responds to the user-input program execution command and runs the target program based on the target program path, have the data acquisition module set the data acquisition strategy of the performance analysis tool according to the monitoring parameters, and acquire monitoring data from the event tracking interface according to the data acquisition strategy during the target program's execution. After the target program finishes running, the automatic analysis module calculates key performance parameters based on the analysis algorithm and monitoring data, and then the result output module generates a structured report according to the result output method and key performance parameters. The system can automatically call the event tracking interface to complete performance data acquisition and analysis through user-specified analysis rules, and output performance bottleneck analysis results in real time, which can reduce the complexity of program performance analysis operations and improve the efficiency of program performance analysis.

[0092] It should be noted that other corresponding descriptions of the functional units involved in the automatic program performance bottleneck analysis system provided in this application embodiment can be found in the corresponding descriptions in the automatic program performance bottleneck analysis method provided in the above embodiments, and will not be repeated here.

[0093] This application also provides a computer device, specifically a personal computer, server, network device, etc. The computer device includes a bus, processor, memory, and communication interface, and may also include input / output interfaces and a display device. The processor of the computer device provides computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database of the computer device stores location information. The network interface of the computer device is used for communication with external terminals via a network connection. When the computer program is executed by the processor, it implements the steps in the various method embodiments.

[0094] Those skilled in the art will understand that the structure of the computer device described above is only a partial structure related to the solution of this application, and does not constitute a limitation on the computer device to which the solution of this application is applied. A specific computer device may include more or fewer components, or combine certain components, or have different component arrangements.

[0095] In one embodiment, a computer-readable storage medium is also provided, which may be non-volatile or volatile, and a computer program is stored thereon, which, when executed by a processor, implements the steps in the above method embodiments.

[0096] In one embodiment, a computer program product is also provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0097] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.

[0098] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods.

[0099] Any references to memory, database, or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc.

[0100] Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can take many forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0101] The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchain. The processors involved in the embodiments provided in this application may be, but are not limited to, general-purpose processors, graphics processors, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc.

[0102] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0103] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A method for automatic analysis of program performance bottlenecks, characterized in that, The method includes: Obtain program execution instructions input by the user, the program execution instructions including the target program path, monitoring parameters, analysis algorithm, and result output method; In response to the program execution instruction, the target program is executed based on the target program path; The data acquisition strategy of the performance analysis tool is set according to the monitoring parameters, and the monitoring data is acquired according to the data acquisition strategy; the data acquisition strategy includes the counting object of the performance counter and the process filtering rules; the monitoring data includes program running events acquired through the event tracing interface of the performance analysis tool during the execution of the target program; After the target program finishes running, key performance parameters are calculated based on the analysis algorithm and the monitoring data. The key performance parameters include a sequence of performance bottleneck indicators generated after filtering non-key indicators through a rule engine. Generate a structured report according to the output method and the key performance parameters.

2. The method according to claim 1, characterized in that, Obtain user-input program execution instructions, including: Receive configuration information input by the user, the configuration information including interactive action information and / or configuration files input by the user through the configuration interface; Query the target program path based on the configuration information; Extract custom parameters from the configuration information. The custom parameters include at least one of the following: custom analysis dimension, bottleneck threshold, and result output method. Set the monitoring parameters according to the custom analysis dimension, and set the analysis algorithm according to the custom analysis dimension and the bottleneck threshold; The program execution instructions are generated by encapsulating the target program path, the monitoring parameters, the analysis algorithm, and the result output method.

3. The method according to claim 1, characterized in that, According to the data acquisition strategy, monitoring data is acquired, including: Configure the data acquisition strategy for the data acquisition module; Listen for the start event of the target program; In response to the start-up event, the event tracing interface of the performance analysis tool is invoked through the data acquisition module; The monitoring data is obtained by filtering program execution events in the event tracking interface according to the data acquisition strategy.

4. The method according to claim 3, characterized in that, According to the data acquisition strategy, monitoring data is acquired, including: Obtain the event monitoring data stream through the event tracking interface; According to the process filtering rules, target events are captured from the event monitoring data stream; the target events are program execution events associated with the data collection strategy. The target event is counted using a performance counter to generate count information; Performance data is generated based on the target event and the counting information; The performance data is cached in real time to a local temporary file.

5. The method according to claim 1, characterized in that, After the target program finishes running, key performance parameters are calculated based on the analysis algorithm and the monitoring data, including: Listen for the termination event of the target program; In response to the termination event, the data parsing interface of the performance analysis tool is invoked; the data parsing interface is used to load a preset analysis template and extract raw metrics. The key performance parameters are calculated based on the monitoring data using the data parsing interface and the analysis algorithm.

6. The method according to claim 5, characterized in that, The key performance parameters are calculated based on the monitoring data using the data parsing interface and the analysis algorithm, including: The analysis algorithm extracts a custom analysis dimension, which includes at least one of CPU dimension, memory dimension, and input / output dimension. Performance parameters are calculated based on the custom dimensions and the monitoring data. Specifically, when the custom analysis dimension includes a CPU dimension, the cumulative time consumed by the function call stack is statistically analyzed and sorted according to the percentage of the cumulative time consumed to generate CPU performance parameters. When the custom analysis dimension includes a memory dimension, memory leaks and memory-occupying objects are identified by analyzing memory allocation or release frequencies to generate memory performance parameters. When the custom analysis dimension includes an input / output dimension, disk read / write latency and network request response time are calculated, and these latency and response times are correlated with program files or interface call events to generate input / output performance parameters. Extract key performance parameters from the performance parameters.

7. The method according to claim 6, characterized in that, Key performance parameters are extracted from the performance parameters, including: Set the percentage threshold for non-critical indicators; Set the percentage threshold to the rule engine; The rule engine filters out non-critical indicators from the performance parameters to obtain a set of critical indicators; the non-critical indicators are performance parameters whose proportion is less than the proportion threshold. The key indicators in the set of key indicators are sorted according to their performance parameter proportions to generate the performance bottleneck indicator sequence.

8. The method according to claim 1, characterized in that, Generate a structured report according to the output method and key performance parameters, including: The report output format is matched according to the result output method, and the report output format includes at least one of text report, visual chart, and jump link; According to the report output format, report output elements are generated based on the key performance parameters; wherein, when the report output format includes the text report, the report output elements include the bottleneck name, indicator value, and code location; when the report output format includes the visualization chart, the report output elements include a percentage view; when the report output format includes the jump link, the report output elements include the link program location. The structured report is generated by assembling the report output elements.

9. The method according to claim 8, characterized in that, The process of generating a structured report based on the output method and key performance parameters also includes: Historical data is extracted based on the key performance parameters, wherein the historical data are performance parameters of the same type as the key performance parameters calculated within a preset monitoring period; A comparison result object is generated based on the historical data and the key performance parameters; Add the comparison result object to the structured report; The structured report is sent to the user terminal, which displays the console, log files, and developer tool plugin panel.

10. An automatic program performance bottleneck analysis system, characterized in that, The system includes: The configuration module is used to obtain program execution instructions input by the user, and in response to the program execution instructions, run the target program based on the target program path; the program execution instructions include the target program path, monitoring parameters, analysis algorithms, and result output methods; The data acquisition module is used to set the data acquisition strategy of the performance analysis tool according to the monitoring parameters, and to acquire monitoring data according to the data acquisition strategy; the data acquisition strategy includes the counting object of the performance counter and the process filtering rules; the monitoring data includes program running events acquired through the event tracing interface of the performance analysis tool during the execution of the target program; An automatic analysis module is used to calculate key performance parameters based on the analysis algorithm and the monitoring data after the target program finishes running. The key performance parameters include a sequence of performance bottleneck indicators generated after filtering non-key indicators through a rule engine. The results output module is used to generate a structured report according to the results output method and the key performance parameters.