An application program analysis method, device, equipment and storage medium
By binding the acquisition trigger function with the data acquisition signal, the data acquisition task of the target process is automatically triggered, which solves the problems of cumbersome and non-real-time program performance analysis in the existing technology and realizes efficient program performance analysis.
Patent Information
- Application Number
- CN202310333892.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-30
- Publication Date
- 2025-12-23
- Estimated Expiration
- 2043-03-30
AI Technical Summary
Existing program performance analysis methods require manual code insertion, which is cumbersome and not real-time, affecting analysis efficiency.
By binding the acquisition trigger function and the data acquisition signal, the data acquisition task of the target process is automatically triggered, the acquired data is acquired and analyzed in real time, and statistical result files are generated.
It simplifies program performance analysis, improves analysis efficiency, and enables real-time acquisition and analysis of function execution in the target process.
Smart Images

Figure CN116302894B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of computer, in particular, relate to an application program analysis method and device, equipment and storage medium. BACKGROUND
[0002] A computer system can run multiple programs simultaneously, in order to ensure the speed and fluency of the computer system when running, it is necessary to ensure that the resource amount occupied by each program running on the computer system is maintained in a reasonable state, so as to balance the load of the central processing unit, in order to achieve this purpose, it is necessary to analyze the performance of each program running on the computer. When performing program performance analysis, an analyst generally needs to insert corresponding code at certain positions of the program to be analyzed, and then collect data generated by the program when running, and analyze the performance of the program. Another method is to collect data of the function to be analyzed when the specific function is running, and end the collection when the function stops running, and then analyze the performance of the function.
[0003] In related technologies, when performing program performance analysis, the first method needs to manually insert code in the program to be analyzed, which is relatively cumbersome and prone to errors, and the other method can only collect data when the specific function is running, and cannot collect data in real time and stop data collection, which affects the efficiency of program performance analysis. SUMMARY
[0004] Embodiments of the present application provide an application program analysis method, device, equipment and storage medium, which aims to improve the efficiency of program performance analysis.
[0005] The first aspect of the embodiments of the present application provides an application program analysis method, the method comprising:
[0006] In response to a data collection instruction for a target application program, binding a collection trigger function and a data collection signal, the data collection instruction at least including a process name corresponding to the target application program, a collection parameter corresponding to the target application program, and a target result parameter corresponding to the target application program;
[0007] According to the process name, determine the target process number corresponding to the target application program;
[0008] According to the collection parameter and the target process number, send the data collection signal to the data collection program to trigger the data collection task of the target process corresponding to the target process number, and obtain the collection data, the collection data representing the sampling number of each function in the target process;
[0009] According to the target result parameter, statistically analyze the collection data to obtain a statistical result file.
[0010] Optionally, the binding the collection trigger function with the data collection signal in response to the data collection instruction for the target application program comprises:
[0011] binding a collection start function in the collection trigger function with a first data collection signal in the data collection signal;
[0012] binding a collection end function in the collection trigger function with a second data collection signal in the data collection signal.
[0013] Optionally, the binding the collection trigger function with the data collection signal in response to the data collection instruction for the target application program, the method further comprises:
[0014] specifying a file name of the statistical result file corresponding to the data collection instruction.
[0015] Optionally, the determining the target process number corresponding to the target application program according to the process name comprises:
[0016] searching process related information corresponding to the process name according to the process name;
[0017] determining the target process number corresponding to the process name from the process related information.
[0018] Optionally, the issuing the data collection signal to the data collection program according to the collection parameter and the target process number to trigger a data collection task of the target process corresponding to the target process number to obtain collection data comprises:
[0019] determining a collection start time and a collection end time of the data collection task according to the collection parameter;
[0020] issuing the first data collection signal to the data collection program to trigger the data collection task of the target process corresponding to the target process number when a system time reaches the collection start time;
[0021] issuing the second data collection signal to the data collection program to obtain the collection data when the system time reaches the collection end time.
[0022] Optionally, the statistical analysis of the collection data according to the target result parameter to obtain a statistical result file comprises:
[0023] determining a statistical mode and a target result data format corresponding to the collection data according to the target result parameter;
[0024] The collected data is statistically analyzed by the statistical method to obtain statistical result data;
[0025] The statistical result file corresponding to the statistical result data is generated according to the target result data format.
[0026] Optionally, the method further comprises:
[0027] According to the statistical result data, a function in the target process that is collected more than a preset collection number threshold is determined as an abnormal function;
[0028] The abnormal function is marked in the statistical result data.
[0029] The second aspect of the embodiments of the present application provides an application program analysis device, and the device comprises:
[0030] A signal binding module is configured to bind a collection trigger function to a data collection signal in response to a data collection instruction for a target application program, wherein the data collection instruction comprises at least a process name corresponding to the target application program, a collection parameter corresponding to the target application program, and a target result parameter corresponding to the target application program;
[0031] A target process number determination module is configured to determine a target process number corresponding to the target application program according to the process name;
[0032] A data collection module is configured to send the data collection signal to a data collection program to trigger a data collection task of a target process corresponding to the target process number according to the collection parameter and the target process number, so as to obtain collected data, wherein the collected data represents a sampling number of each function in the target process;
[0033] A data statistical module is configured to statistically analyze the collected data according to the target result parameter to obtain a statistical result file.
[0034] Optionally, the signal binding module comprises:
[0035] A first signal binding submodule is configured to bind a collection start function in the collection trigger function to a first data collection signal in the data collection signal;
[0036] A second signal binding submodule is configured to bind a collection end function in the collection trigger function to a second data collection signal in the data collection signal.
[0037] Optionally, the device further comprises:
[0038] The file name designation module is configured to designate a file name of the statistical result file corresponding to the data collection instruction.
[0039] Optionally, the target process number determination module comprises:
[0040] The process-related information determination submodule is configured to search for process-related information corresponding to the process name according to the process name.
[0041] The target process number determination submodule is configured to determine a target process number corresponding to the process name from the process-related information.
[0042] Optionally, the data collection module comprises:
[0043] The collection time determination submodule is configured to determine a collection start time and a collection end time of the data collection task according to the collection parameter.
[0044] The collection task triggering submodule is configured to send the first data collection signal to the data collection program to trigger a data collection task of a target process corresponding to the target process number when system time reaches the collection start time.
[0045] The collection data obtaining submodule is configured to send the second data collection signal to the data collection program to obtain the collection data when system time reaches the collection end time.
[0046] Optionally, the data statistics module comprises:
[0047] The data format determination submodule is configured to determine a statistical method and a target result data format corresponding to the collection data according to the target result parameter.
[0048] The statistical result data determination submodule is configured to perform corresponding statistical analysis on the collection data by using the statistical method to obtain statistical result data.
[0049] The statistical result file generation submodule is configured to generate the statistical result file corresponding to the statistical result data according to the target result data format.
[0050] Optionally, the apparatus further comprises:
[0051] The abnormal function determination submodule is configured to determine a function in the target process, whose collection frequency is greater than a preset collection frequency threshold, as an abnormal function according to the statistical result data.
[0052] The abnormal function marking submodule is configured to mark the abnormal function in the statistical result data.
[0053] The third aspect of the embodiments of the present application provides a readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the steps in the method of the first aspect of the present application.
[0054] The fourth aspect of the embodiments of the present application provides an electronic device, which comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the method of the first aspect of the present application when executing the computer program.
[0055] According to the application program analysis method, in response to a data collection instruction for a target application program, a collection trigger function is bound to a data collection signal, the data collection instruction at least includes a process name corresponding to the target application program, collection parameters corresponding to the target application program, and a target result parameter corresponding to the target application program; according to the process name, a target process number corresponding to the target application program is determined; according to the collection parameters and the target process number, the data collection signal is sent to a data collection program to trigger a data collection task of a target process corresponding to the target process number, and collection data is obtained, the collection data representing a sampling number of each function in the target process; according to the target result parameter, statistical analysis is performed on the collection data to obtain a statistical result file. The data collection task of the target application program can be triggered in real time by the data collection signal, without manually inserting codes, so that the operation steps of program performance analysis are simplified, the efficiency of program performance analysis is improved, and according to the collection data, the running start time and the running end time of each function in the target process during the execution of the data collection task can be determined. According to the target result parameter, statistical analysis is performed on the collection data to obtain a statistical result file. When performing program performance analysis, an analyst only needs to set parameters related to the data collection task and send a data collection instruction, so that the target process can be collected to obtain a required statistical result file, and then the target program is analyzed according to the statistical result file, so that the efficiency of application program performance analysis is improved. BRIEF DESCRIPTION OF DRAWINGS
[0056] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the description of the embodiments of the present application. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0057] Figure 1 is a flowchart of the application program analysis method according to an embodiment of the present application;
[0058] Figure 2is a schematic diagram of an application program analysis device according to an embodiment of the present application. DETAILED DESCRIPTION
[0059] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of the present application.
[0060] Reference Figure 1 , Figure 1 is a flowchart of an application program analysis method according to an embodiment of the present application.
[0061] As Figure 1 shown, the method comprises the following steps:
[0062] S11: in response to a data collection instruction for a target application program, binding a collection trigger function with a data collection signal, the data collection instruction comprising at least a process name corresponding to the target application program, a collection parameter corresponding to the target application program, and a target result parameter corresponding to the target application program.
[0063] In this embodiment, the target application program is an application program that needs to be subjected to program performance analysis. The data collection instruction is an instruction issued by an application program performance analysis personnel to an application program collection tool, used to control the program collection tool to collect data. The data collection instruction includes the process name corresponding to the target application program, the collection parameter corresponding to the target application program, and the target result parameter corresponding to the target application program. The process name is the name of the target application program when it is running in the system. The collection parameter includes the sampling frequency for the target application program, the start time and end time of data collection, and the like. The target result parameter includes the analysis and statistical manner of the collected data, the statistical result to be obtained, the file format and file type of the final output of the program collection tool, and the like. The collection trigger function includes a collection start function (ProfilerStart) and a collection end function (ProfilerStop), which are a function written in advance and used to trigger the data collection task of the target application program. The data collection task is to sample the process of the target application program, and through the sampling of the program, the running times of each function in the target application program within a period of time can be known. The data collection signal includes a first data collection signal (SIGUSR1) and a second data collection signal (SIGUSR2), which are signals sent by the application program collection tool to the data collection program. Because the signals are bound to the trigger function, the data collection task of the target application program can be triggered. The first data collection signal is used to trigger the data collection task, and the second data collection signal is used to stop the data collection task.
[0064] In this embodiment, the application program collection tool can collect the CPU interrupt sampling through the application program. Through the CPU interrupt sampling mode, the collected times of each function in the process of the application program are recorded, and then the running time of each function in the process of the application program is obtained. When the application program collection tool receives the data collection instruction for the target application program, the collection trigger function is bound to the collection signal. The application program generates the corresponding code by calling the pre-written script, so as to realize the binding of the collection trigger function and the collection signal.
[0065] For example, the program collection tool can use any tool that can perform a program collection task, such as the google-perftools tool.
[0066] S12: According to the process name, the target process number corresponding to the target application program is determined.
[0067] In this embodiment, the target process is a target application program that is running, and the target process number is the number of the target process in the system. Each running process has a unique number.
[0068] In this embodiment, the program collection tool finds all process related information of the process name according to the process name contained in the received data collection instruction, and the related information contains the process number of the process. After the process number of the process is determined, the running position of the process in the process manager of the system can be determined according to the process number, and then the target process is determined.
[0069] S13: According to the collection parameter, the data collection signal and the target process number are sent to the data collection program to trigger the data collection task of the target process, and the collection data is obtained, which represents the sampling number of each function in the target process.
[0070] In this embodiment, the data collection program is used to perform the data collection task, and the CPU interrupt sampling of the target process is performed during the running of the target application program. The collection data is the sampling data obtained by collecting the data of the target process, and the collection data shows the sampling number of each function during the execution of the data collection task.
[0071] In this embodiment, the collection parameter specifies the frequency of data collection, the start time of data collection and the end time of data collection. The program collection tool determines the start time of data collection according to the collection parameter contained in the received data collection instruction, sends the data collection signal and the target process number of the target process to the data collection program when the preset collection start time is reached, triggers the data collection task of the target process, and calls the data collection program to perform the CPU interrupt sampling of the target process during the data collection task to obtain the sampling number of each function and the corresponding sub-function of the target process during the program running.
[0072] For example, the sampling parameter in the data collection instruction specifies that the frequency of data collection is 10 times / s, the sampling start time is 13:00, and the sampling end time is 13:01. During this 1 minute, the program collection tool samples the target process 10 times per second, and each sampling samples the function running in the target process. For example, when 3 functions, function A, function B and function C, are sampled during the sampling period, a total of 600 times are collected, of which function A is collected 300 times, function B is collected 200 times, and function C is collected 100 times.
[0073] S14: According to the target result parameter, the collection data is statistically analyzed to obtain a statistical result file.
[0074] In this embodiment, the target result parameter includes the analysis and statistical manner of the collected data, the statistical result to be obtained, the file format and file type of the final output of the program collection tool, and the like. The statistical result file is a corresponding format file generated according to the statistical result of the collected data.
[0075] In this embodiment, the program collection tool performs statistical analysis on the collected data according to the target result parameter, performs statistical analysis on the collected data in the statistical manner specified in the target result parameter, obtains the analysis result, and generates a corresponding statistical result file according to the format and file type of the statistical result file specified in the target result parameter.
[0076] For example, the statistical manner can be to statistically analyze the time consumption ratio of each sampled function in the target process during the running of the application program, or to statistically analyze the total time consumption of each sampled function in the target process during the running of the application program. The format of the statistical result file can be a sector statistical chart or a column statistical chart, and the file type can be a picture type or a document type. The target result parameter is set by the analysis personnel, and the number of times is not limited.
[0077] In this embodiment, the application program collection tool collects the application program to be analyzed, and then performs performance analysis. The trigger function is bound to the data collection signal through a pre-written script. The program performance analysis personnel can set the start and end times of the data collection task, the collection parameters of the data collection task, and the statistical manner of the generated statistical data, as well as the content and form of the statistical file. The target process is collected in real time through the signal triggering mode, and the collected data is automatically statistically analyzed, so that the program performance analysis personnel can intuitively understand the time consumed by each function during the running of the application program, and then optimize the application program.
[0078] In another embodiment of the present application, step S11 specifically includes:
[0079] S11-1: binding the collection start function in the collection trigger function to the first data collection signal in the data collection signal.
[0080] In this embodiment, the collection start function is used to trigger the data collection task for the target process, and the first data collection signal is a signal sent by the program collection tool to the data collection program. When the data collection program receives the signal, the target process is collected according to the corresponding target process number.
[0081] In this embodiment, when the program collection tool receives the data collection instruction sent by the program performance analyzer, the collection start function in the collection trigger function is bound to the first data collection signal in the data collection signal by calling the pre-written script.
[0082] S11-2: binding the collection end function in the collection trigger function to the second data collection signal in the collection data signal.
[0083] In this embodiment, the collection end function is used to inform the data collection program to stop data collection, and the second data collection signal is a signal sent by the program collection tool to the data collection program. When the data collection program receives the second data collection signal, it stops data collection on the target process.
[0084] In this embodiment, when the program collection tool receives the data collection instruction sent by the program performance analyzer, the collection end function in the collection trigger function is bound to the second data collection signal in the collection data signal by calling the pre-written script.
[0085] In this embodiment, a script is pre-written. When the program collection tool receives the data collection instruction, the pre-written script is called to bind the collection trigger function for data collection to the data collection signal. The program performance analyzer does not need to manually configure related configurations, and the efficiency of program performance analysis is improved.
[0086] In another embodiment of the present application, the collection trigger function is bound to the data collection signal in response to the data collection instruction for the target application, and the method further comprises:
[0087] S11-3: specifying the file name of the statistical result file corresponding to the data collection instruction.
[0088] In this embodiment, when the program collection tool receives the data collection instruction for the target application, the file name of the statistical result file corresponding to the data collection instruction is specified.
[0089] In this embodiment, when the program performance analyzer does not make special settings on the name of the statistical result file, the program collection tool calls the pre-written script to specify the file name of the statistical result file corresponding to the data collection instruction.
[0090] In this embodiment, a script is pre-written. By calling the script, the file name of the statistical result file can be generated by default. The program performance analyzer does not need to set the file name by himself, and the efficiency of program performance analysis is improved.
[0091] In another embodiment of the present application, step S12 specifically comprises:
[0092] S12-1: According to the process name, find the process related information corresponding to the process name.
[0093] S12-2: Determine the target process number corresponding to the process name from the process related information.
[0094] In this embodiment, when the program collection tool receives the data collection instruction for the target application program, according to the process name of the target application program contained therein, the process related information corresponding to the process name is found, and the target process number corresponding to the process name can be determined in the process related information.
[0095] In another embodiment of the present application, step S13 specifically includes:
[0096] S13-1: According to the collection parameters, determine the collection start time and collection end time of the data collection task.
[0097] In this embodiment, when the program collection tool receives the data collection instruction for the target application program, according to the collection parameters included in the data collection instruction, the collection start time and collection end time of the data collection task are determined.
[0098] S13-2: When the system time reaches the collection start time, the first data collection signal is sent to the data collection program to trigger the data collection task of the target process corresponding to the target process number.
[0099] In this embodiment, when the system time reaches the collection start time, the program collection tool sends the first data collection signal to the data collection program to trigger the data collection program to start running, and the program collection tool runs the data collection program to collect data from the target process corresponding to the target process number.
[0100] For example, the set data collection start time is 13:00, when the system time reaches 13:00, the program collection tool sends the first data collection signal to the data collection program to start the data collection program and collect data from the target process corresponding to the target process number.
[0101] S13-3: When the system time reaches the collection end time, the second data collection signal is sent to the data collection program to obtain the collection data.
[0102] In this embodiment, when the system time reaches the collection end time, the program collection tool sends the second data collection signal to the data collection program, and the data collection program stops running to obtain the collection result data.
[0103] For example, the set data collection end time is 13:01, when the system time reaches 13:01, the program collection tool sends a second data collection signal to the data collection program to stop the data collection program and obtain the collected data.
[0104] In another embodiment of the present application, the stop process time can also be set in the collection parameters, and after the data collection task is executed, the target process can be stopped.
[0105] In the embodiment, the data collection script is pre-written, the script supports inputting the process number of the target application and setting the corresponding collection parameters, realizes real-time collection of the target process, and when the program collection tool receives the data collection instruction, the data collection script is called, so that the target process is collected according to the input process number and collection parameters, the collection is stopped, the process is terminated, and the real-time collection is realized through the signal triggering mode to obtain the corresponding collection data.
[0106] In another embodiment of the present application, step S14 specifically comprises:
[0107] S14-1: According to the target result parameter, the statistical method corresponding to the collection data and the target result data format are determined.
[0108] In the embodiment, the target result parameter contains the statistical method corresponding to the collection data and the target result data format. After the program collection tool receives the data collection instruction, the statistical method parameter and the target result data format parameter contained in the target result parameter are obtained, and then the statistical method corresponding to the collection data and the target result data format are determined.
[0109] For example, the statistical method can be the running time proportion statistics of each function, or the running time consumption of each function, the target result data format can be a sector statistical chart or a column chart, and the output can be in the form of a picture or a document, and the output mode can also be a web page format, which can be remotely viewed.
[0110] S14-2: The collection data is statistically analyzed by the statistical method to obtain statistical result data.
[0111] In the embodiment, after the program collection tool determines the statistical method, the collection data is statistically analyzed according to the determined statistical method to obtain the statistical result data.
[0112] For example, when the statistical manner is to count the running time proportion of each function, for example, when 3 functions, function A, function B and function C, are sampled for 600 times during sampling, function A is sampled for 300 times, function B is sampled for 200 times, and function C is sampled for 100 times, the proportion of function A is 50%, the proportion of function B is 33%, and the proportion of function C is 17%.
[0113] S14-3: generating the statistical result file corresponding to the statistical result data according to the target result data format.
[0114] In this embodiment, after obtaining the statistical result data, the corresponding statistical result file is generated according to the target result data format.
[0115] For example, for the statistical result data in S62, when the target result data format is a sector statistical chart, the sector statistical charts of function A, function B and function C are output, which can directly reflect the running time proportion of each function in the target process.
[0116] In this embodiment, the data analysis script is pre-written, and the program collection attack can call the script to perform corresponding statistical analysis on the collected data according to the settings of the program performance analyzer, and output the statistical result file in a corresponding format, thereby improving the efficiency of program performance analysis.
[0117] In another embodiment of the present application, after step S14-3, the method further comprises:
[0118] S14-4: determining a function in the target process whose collected number of times is greater than a preset collection number of times threshold as an abnormal function according to the statistical result data.
[0119] In this embodiment, the collection number of times threshold is a preset maximum value of the collected number of times of a function, and when the collected number of times of a function exceeds the preset collection number of times threshold, the function is determined as an abnormal function.
[0120] In this embodiment, the program collection tool analyzes the statistical result data, compares the collection number of times of each function in the target process with the preset collection number of times threshold, and determines a function whose collected number of times exceeds the preset collection number of times threshold as an abnormal function. When a function is an abnormal function, the function occupies more computer resources, causing excessive computer load, and needs to be optimized.
[0121] S14-5: marking the abnormal function in the statistical result data.
[0122] In this embodiment, when there is an abnormal function in the statistical result data, the program collection tool marks the abnormal function. The marked data also carries the mark when generating the statistical result file.
[0123] For example, the sector occupied by the abnormal function is marked as red in the sector statistical chart, the column corresponding to the abnormal function is marked as red in the column statistical chart, and the function name of the abnormal function is marked as red in the document. The marking manner can be set by the user and is not limited herein.
[0124] In this embodiment, the abnormal function in the statistical result data is determined and marked, which facilitates the program performance analysis personnel to determine the abnormal function in the target process, and further facilitates the staff to optimize the program, and improves the efficiency of program performance analysis.
[0125] Based on the same inventive concept, an embodiment of the present application provides an application program analysis device. Referring to Figure 2 , Figure 2 is a schematic diagram of the application program analysis device 200 provided by an embodiment of the present application. As shown in Figure 2 , the device comprises:
[0126] The signal binding module 201 is configured to bind a collection trigger function and a data collection signal in response to a data collection instruction for a target application program, wherein the data collection instruction at least comprises a process name corresponding to the target application program, a collection parameter corresponding to the target application program, and a target result parameter corresponding to the target application program.
[0127] The target process number determination module 202 is configured to determine a target process number corresponding to the target application program according to the process name.
[0128] The data collection module 203 is configured to send the data collection signal to a data collection program according to the collection parameter and the target process number, so as to trigger a data collection task of a target process corresponding to the target process number, and obtain collection data, wherein the collection data represents a sampling number of each function in the target process.
[0129] The data statistical analysis module 204 is configured to statistically analyze the collection data according to the target result parameter, and obtain a statistical result file.
[0130] Optionally, the signal binding module comprises:
[0131] The first signal binding sub-module is configured to bind a collection start function in the collection trigger function and a first data collection signal in the data collection signal.
[0132] The second signal binding sub-module is configured to bind an end-of-collection function in the collection trigger function with a second data collection signal in the collection data signals.
[0133] Optionally, the apparatus further comprises:
[0134] The file name specifying module is configured to specify a file name of the statistical result file corresponding to the data collection instruction.
[0135] Optionally, the target process number determining module comprises:
[0136] The process-related information determining sub-module is configured to search for process-related information corresponding to the process name according to the process name.
[0137] The target process number determining sub-module is configured to determine a target process number corresponding to the process name from the process-related information.
[0138] Optionally, the data collection module comprises:
[0139] The collection time determining sub-module is configured to determine a collection start time and a collection end time of the data collection task according to the collection parameter.
[0140] The collection task triggering sub-module is configured to send the first data collection signal to the data collection program to trigger a data collection task of a target process corresponding to the target process number when system time reaches the collection start time.
[0141] The collection data obtaining sub-module is configured to send the second data collection signal to the data collection program to obtain the collection data when system time reaches the collection end time.
[0142] Optionally, the data statistics module comprises:
[0143] The data format determining sub-module is configured to determine a statistical method and a target result data format corresponding to the collection data according to the target result parameter.
[0144] The statistical result data determining sub-module is configured to perform corresponding statistical analysis on the collection data by using the statistical method to obtain statistical result data.
[0145] The statistical result file generating sub-module is configured to generate the statistical result file corresponding to the statistical result data according to the target result data format.
[0146] Optionally, the apparatus further comprises:
[0147] The abnormal function determining sub-module is configured to determine, according to the statistical result data, a function in the target process with a collection number greater than a preset collection number threshold as an abnormal function.
[0148] The abnormal function marking sub-module is configured to mark the abnormal function in the statistical result data.
[0149] Based on the same inventive concept, another embodiment of the present application provides a readable storage medium having a computer program stored thereon, the program being executed by a processor to implement the steps in the application program analysis method according to any one of the above embodiments of the present application.
[0150] Based on the same inventive concept, another embodiment of the present application provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, the processor being executed to implement the steps in the application program analysis method according to any one of the above embodiments of the present application.
[0151] For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the related parts are described in the part of the method embodiment.
[0152] Each embodiment in the present specification is described in a progressive manner, and each embodiment focuses on the difference from other embodiments. The same and similar parts between the embodiments can be referred to each other.
[0153] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a device, or a computer program product. Therefore, the embodiments of the present application can be in the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the embodiments of the present application can be in the form of a computer program product implemented on one or more computer usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer usable program code.
[0154] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams according to the method, terminal device (system), and computer program product of the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of the flows and / or blocks can be implemented by computer program instructions. These computer program instructions can be provided to a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to produce a machine, so that the instructions executed by the computer or other programmable data processing terminal device produce a device for implementing the functions specified in the flowcharts and / or block diagrams. Figure 1 The device for implementing the functions specified in one flow or multiple flows and / or blocks Figure 1 one flow or multiple flows and / or blocks
[0155] These computer program instructions can also be stored in a computer- readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instructions which implement the flow Figure 1 one or more flow or block Figure 1 one or more blocks or steps with the function specified in the flow
[0156] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the flow Figure 1 one or more flow or block Figure 1 one or more blocks or steps with the function specified in the flow
[0157] Although preferred embodiments of the application have been described, those skilled in the art will recognize that additional modifications and changes can be made thereto without departing from the scope of the present application. Accordingly, the appended claims are intended to cover all such modifications and changes as fall within the scope of the application.
[0158] Finally, it should be noted that the terms "first", "second", and the like, herein do not denote any order, quantity, combination, or importance, but rather are used to distinguish one element from another, and are not intended to denote a particular order, quantity, combination, or importance of, or between, the elements so designated. Also, the use of terms such as "including", "containing", or "comprising", and any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements in the list, but can also include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises a... " does not, without more constraints, exclude the existence of additional identical elements in the process, method, article, or apparatus that comprises the element.
[0159] The application program analysis method, device, equipment and storage medium provided by the present application are described in detail above, and the principles and implementation manners of the present application are described by applying specific examples. The above description of the embodiments is only used to help understand the method of the present application and its core idea; at the same time, for those skilled in the art, according to the idea of the present application, the specific implementation manner and application range will be changed, and the above description of the present application should not be understood as a limitation.
Claims
1. An application program analysis method characterized by comprising: The method comprises: in response to a data collection instruction for a target application program, binding a collection trigger function with a data collection signal, the data collection instruction comprising at least a process name corresponding to the target application program, a collection parameter corresponding to the target application program, and a target result parameter corresponding to the target application program; determining a target process number corresponding to the target application program according to the process name; issuing the data collection signal to a data collection program according to the collection parameter and the target process number, to trigger a data collection task for a target process corresponding to the target process number, and obtaining collection data, the collection data representing a number of times of sampling of each function in the target process; performing statistical analysis on the collection data according to the target result parameter, to obtain a statistical result file; the response to the data collection instruction for the target application program, the binding of the collection trigger function with the data collection signal comprises: binding a collection start function in the collection trigger function with a first data collection signal in the data collection signal; binding a collection end function in the collection trigger function with a second data collection signal in the data collection signal; the application program generates corresponding code for the binding of the collection trigger function with the collection signal by calling a pre-written script; the issuing of the data collection signal to the data collection program according to the collection parameter and the target process number, to trigger the data collection task for the target process corresponding to the target process number, and the obtaining of the collection data comprises: determining a collection start time and a collection end time of the data collection task according to the collection parameter; issuing the first data collection signal to the data collection program when the system time reaches the collection start time, to trigger the data collection task for the target process corresponding to the target process number; issuing the second data collection signal to the data collection program when the system time reaches the collection end time, to obtain the collection data; the process name is a name of the target application program when running in a system, the collection parameter comprises at least a sampling frequency for the target application program, a start time and an end time of data collection, the target result parameter comprises at least an analysis and statistical manner of the collected data, a statistical result to be obtained, a file format and a file type of a final output of a program collection tool.
2. The method of claim 1, wherein, the response to the data collection instruction for the target application program, the binding of the collection trigger function with the data collection signal, the method further comprises: specifying a file name of the statistical result file corresponding to the data collection instruction.
3. The method of claim 1, wherein, the determination of the target process number corresponding to the target application program according to the process name comprises: finding process-related information corresponding to the process name according to the process name; determining the target process number corresponding to the process name from the process-related information.
4. The method of claim 1, wherein, the statistical analysis of the collection data according to the target result parameter, to obtain the statistical result file, comprises: According to the target result parameter, determine a statistical method corresponding to the collected data and a target result data format; According to the target result data format, generate the statistical result file corresponding to the statistical result data. The method further comprises:
5. The method of claim 4, wherein, According to the statistical result data, determine a function in the target process as an abnormal function if the number of times the function is collected is greater than a preset collection number threshold value; Mark the abnormal function in the statistical result data. The device comprises:
6. An application program analysis apparatus characterized by comprising: A signal binding module, configured to bind a collection trigger function to a data collection signal in response to a data collection instruction for a target application program, the data collection instruction comprising at least a process name corresponding to the target application program, a collection parameter corresponding to the target application program, and a target result parameter corresponding to the target application program; A target process number determination module, configured to determine a target process number corresponding to the target application program according to the process name; A data collection module, configured to send the data collection signal to a data collection program according to the collection parameter and the target process number, to trigger a data collection task for a target process corresponding to the target process number, and obtain collected data, the collected data representing the number of times each function in the target process is sampled; A data statistics module, configured to perform statistical analysis on the collected data according to the target result parameter, and obtain a statistical result file; The signal binding module comprises: A first signal binding submodule, configured to bind a collection start function in the collection trigger function to a first data collection signal in the data collection signal; A second signal binding submodule, configured to bind a collection end function in the collection trigger function to a second data collection signal in the data collection signal; An application program binds the collection trigger function to the collection signal by calling a pre-written script to generate corresponding code; The data collection module comprises: A collection time determination submodule, configured to determine a collection start time and a collection end time of the data collection task according to the collection parameter; A collection task trigger submodule, configured to send the first data collection signal to the data collection program when system time reaches the collection start time, to trigger the data collection task for the target process corresponding to the target process number; A collection data obtaining submodule, configured to send the second data collection signal to the data collection program when system time reaches the collection end time, to obtain the collected data; The process name is the name of the target application program when it runs in the system, the collection parameter comprises at least a sampling frequency for the target application program, a start time and an end time of data collection, the target result parameter comprises at least a statistical analysis method for the collected data, a statistical result to be obtained, a file format and a file type of a final output of a program collection tool. The computer program is executed by a processor to implement the steps in the method of any one of claims 1 to 5.
7. A computer-readable storage medium having stored thereon a computer program, characterized in that, 8. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor, when executing the computer program, implements the steps of the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Program running performance analysis method and device
CN106227671A