Application optimization method, device, equipment and computer readable storage medium

By determining the CPU time interval of the function to be tested and its operating state target time interval in the application optimization method, the problem of low accuracy of degradation function based on time-consuming detection based on function execution is solved, and more efficient degradation function detection is achieved.

CN114691166BActive Publication Date: 2025-03-07BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011627227.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-31
Publication Date
2025-03-07
Estimated Expiration
2040-12-31

AI Technical Summary

Technical Problem

The application optimization method based on time-consuming function execution fluctuates greatly in multiple detections, resulting in low detection accuracy of degraded function.

Method used

By running the old version of the application and the new version of the application, the CPU time intervals of each function to be tested are determined, and the CPU running state target time intervals are determined in these time intervals, thereby calculating the degradation function in the new version of the application.

Benefits of technology

It improves the accuracy of degradation function detection, reduces detection numerical fluctuations, and enhances the efficiency of application optimization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114691166B_ABST
    Figure CN114691166B_ABST
Patent Text Reader

Abstract

The disclosed embodiments provide an application optimization method, apparatus, device and computer-readable storage medium, the method comprising: determining the first CPU time interval corresponding to each function to be tested during the running of the old version application, and the second CPU time interval corresponding to each function to be tested during the running of the new version application; determining the first target time interval in which the CPU is in the running state in each first CPU time interval; determining the second target time interval in which the CPU is in the running state in each second CPU time interval; and determining the degraded function in the new version application according to the difference between the first target time interval and the second target time interval. This can effectively reduce the problem of large fluctuations in multiple detection values ​​caused by the CPU processing other threads while processing the function to be tested in the application optimization method based on the time consumption of function execution during the degraded function detection process, thereby improving the accuracy of degraded function detection and the efficiency of application optimization.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present disclosure relate to the field of computer technology, and in particular, to an application optimization method, device, equipment, and computer-readable storage medium. Background Art

[0002] In order to ensure that the application software can achieve more functions, it is often necessary to update the application software version from time to time. Before the application software version is updated, it is necessary to compare the performance of different versions of the application software in the online production environment or offline automated testing to detect degraded functions with long running time.

[0003] At present, traditional application optimization methods generally determine the execution time of the function to be tested in two versions of application software through instrumentation, and determine the degraded function in the new version based on the execution time of the function to be tested in the two versions and a preset time threshold.

[0004] However, the inventors have found that when the degraded function is detected based on the time consumption of function execution, the values ​​obtained from multiple detection results fluctuate greatly, so it is impossible to accurately detect the degraded function in the application software to be updated. Summary of the invention

[0005] The embodiments of the present disclosure provide an application optimization method, apparatus, device and computer-readable storage medium to overcome the technical problem that the numerical fluctuations of the detection results of the degradation function are large and the detection accuracy of the degradation function is not high due to the application optimization method based on time-consuming function execution.

[0006] In a first aspect, an embodiment of the present disclosure provides an application optimization method, including:

[0007] Run the old version of the application and the new version of the application respectively;

[0008] Determine a first CPU time interval corresponding to each function to be tested during the running of the old version application, and determine a second CPU time interval corresponding to each function to be tested during the running of the new version application;

[0009] For each first CPU time interval corresponding to the function to be tested, determining a first target time interval in which the CPU state is a running state in the first CPU time interval;

[0010] For each second CPU time interval corresponding to the function to be tested, determining a second target time interval in which the CPU state is a running state in the second CPU time interval;

[0011] A degradation function in the new version application is determined according to a difference between the first target time interval and the second target time interval.

[0012] In a second aspect, an embodiment of the present disclosure provides an application optimization device, including:

[0013] A running module is used to run the old version application and the new version application respectively;

[0014] A determination module, used to determine a first CPU time interval corresponding to each function to be tested during the running of the old version application, and to determine a second CPU time interval corresponding to each function to be tested during the running of the new version application;

[0015] A processing module, configured to determine, for each first CPU time interval corresponding to the function to be tested, a first target time interval in which the CPU state is a running state in the first CPU time interval;

[0016] The processing module is further used to determine, for each second CPU time interval corresponding to the function to be tested, a second target time interval in which the CPU state is a running state in the second CPU time interval;

[0017] An identification module is used to determine a degradation function in the new version application according to a difference between the first target time interval and the second target time interval.

[0018] In a third aspect, an embodiment of the present disclosure provides an electronic device, including: at least one processor and a memory;

[0019] The memory stores computer-executable instructions;

[0020] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the application optimization method described in the first aspect and various possible designs of the first aspect.

[0021] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, in which computer execution instructions are stored. When a processor executes the computer execution instructions, the application optimization method described in the first aspect and various possible designs of the first aspect is implemented.

[0022] The application optimization method, device, equipment and computer-readable storage medium provided in this embodiment first determine the first CPU time interval occupied by each function to be tested during the operation of the old version application and the second CPU time interval corresponding to each function to be tested during the operation of the new version application, respectively determine the first target time interval in which the CPU state is in the running state in the first CPU time interval, and the second target time interval in which the CPU state is in the running state in the second CPU time interval, so that the degraded function in the new version application can be accurately determined according to the first target time interval and the second target time interval. By determining the first target time interval and the second target time interval, the time interval in which the CPU is in other running states when processing each function to be tested can be removed, that is, the time required for the CPU to process the function to be tested can be determined. By using the difference between the first target time interval and the second target time interval to detect the degraded function, the problem of large fluctuations in multiple detection values ​​caused by the CPU processing other threads while processing the function to be tested can be effectively reduced in the detection process of the application optimization method based on the time-consuming function execution, thereby improving the accuracy of the degraded function detection and improving the efficiency of application optimization. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0024] Figure 1 A schematic diagram of an application scenario provided for an embodiment of the present disclosure;

[0025] Figure 2 A flowchart of an application optimization method provided in Embodiment 1 of the present disclosure;

[0026] Figure 3 A schematic diagram of the CPU operating state provided in an embodiment of the present disclosure;

[0027] Figure 4 A flowchart of an application optimization method provided in Embodiment 2 of the present disclosure;

[0028] Figure 5 A schematic diagram of CPU time interval matching provided in an embodiment of the present disclosure;

[0029] Figure 6 A flowchart of an application optimization method provided in Embodiment 3 of the present disclosure;

[0030] Figure 7A schematic diagram of the system architecture on which the embodiments of the present disclosure are based;

[0031] Figure 8 A schematic diagram of the structure of an application optimization device provided in Embodiment 4 of the present disclosure;

[0032] Fig. 9 This is a schematic diagram of the structure of an electronic device provided in Embodiment 5 of the present disclosure. DETAILED DESCRIPTION

[0033] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.

[0034] In response to the technical problems mentioned above that the numerical fluctuations of multiple detection results of the application optimization method based on function execution time are large and the detection accuracy of the degradation function is low, the present disclosure provides an application optimization method, device, equipment and computer-readable storage medium.

[0035] It should be noted that the application optimization method, apparatus, device and computer-readable storage medium provided by the present disclosure can be used in various degradation function and degradation stage detection scenarios.

[0036] In order to achieve performance optimization for the new version of the application, before the new version of the application is released, it is necessary to detect the functions in the new version of the application to determine the degraded functions that need to be optimized. At present, generally, the execution time required for the function to be tested in the new and old versions of the application is determined by inserting the test function, and the degraded function is detected based on the execution time. When the above method is used to detect degraded functions, since the CPU allocates different processing time to different threads each time it processes the same function, the numerical fluctuations of multiple detection results for the same function to be tested are large, which leads to low accuracy in degraded function detection.

[0037] In order to solve the above technical problems, the inventors have discovered through research that in order to reduce the numerical fluctuations in multiple degradation function detection processes and improve the accuracy of degradation function detection, the CPU time interval occupied by the function to be tested can be determined, and the degradation function can be detected based on the CPU time interval occupied by the function to be tested.

[0038] The inventors further discovered that it is possible to determine the first CPU time interval occupied by each function to be tested during the running of the old version application and the second CPU time interval corresponding to each function to be tested during the running of the new version application, and respectively determine the first target time interval in which the CPU state is in the running state in the first CPU time interval and the second target time interval in which the CPU state is in the running state in the second CPU time interval, thereby being able to accurately determine the degraded function in the new version application based on the first target time interval and the second target time interval.

[0039] The following introduces the application scenarios of the application optimization method provided by the embodiment of the present invention. Figure 1 A schematic diagram of an application scenario provided by an embodiment of the present disclosure, such as Figure 1 As shown, the application scenario corresponding to the application optimization method provided by the embodiment of the present disclosure includes a memory 1, a memory 2, a central processing unit (CPU) 3 and a disk 4. In order to realize the calculation of the degradation function, the old version application and the new version application can be installed in the memory 1 respectively. The old version application and the new version application are respectively run in the memory 2. The first CPU time interval occupied by each function to be tested during the operation of the old version application and the second CPU time interval corresponding to each function to be tested during the operation of the new version application are determined by CPU3, and the first target time interval in which the CPU state is in the running state in the first CPU time interval and the second target time interval in which the CPU state is in the running state are respectively determined, and then the degradation function can be determined according to the first target time interval and the second target time interval. In the process of CPU3 determining the degradation function, the intermediate data first CPU time interval and second CPU time interval can be stored in the disk 4.

[0040] Figure 2 A flowchart of an application optimization method provided in the first embodiment of the present disclosure is shown in FIG. Figure 2 As shown, the method includes:

[0041] Step 101: Run the old version application and the new version application respectively.

[0042] The execution subject of this embodiment is an application optimization device, which can be coupled to the server.

[0043] In this embodiment, in order to optimize the performance of the new version application, it is first necessary to determine the degradation function of the new version application relative to the old version application, and then the degradation function can be optimized subsequently.

[0044] Therefore, you first need to obtain the installation packages corresponding to the old version application and the new version application, install the two versions of the application respectively, and run the old version application and the new version application respectively, so as to subsequently obtain the running data of the two versions of the application during the running process.

[0045] Step 102: Determine a first CPU time interval corresponding to each function to be tested during the running of the old version application, and determine a second CPU time interval corresponding to each function to be tested during the running of the new version application.

[0046] In this embodiment, since the CPU allocates different processing time to different threads each time it processes the same function, the execution time values ​​of multiple tests for the same function to be tested fluctuate greatly. Therefore, in order to improve the detection accuracy of the degraded function, the CPU time interval of the function to be tested can be used to detect the degraded function.

[0047] Specifically, the first CPU time interval corresponding to each function to be tested during the running of the old version application can be determined, and the second CPU time interval corresponding to each function to be tested during the running of the new version application can be determined. The functions to be tested correspond to the CPU time intervals one by one.

[0048] Step 103: for each first CPU time interval corresponding to the function to be tested, determine a first target time interval in which the CPU state is a running state in the first CPU time interval.

[0049] Step 104: for each second CPU time interval corresponding to the function to be tested, determine a second target time interval in which the CPU is in a running state during the second CPU time interval.

[0050] In this embodiment, after determining the first CPU time interval corresponding to each function to be tested during the operation of the old version application, the CPU may spend part of the time processing the function to be tested and part of the time processing other threads during the first CPU time interval. When processing the function to be tested, the corresponding state of the CPU is the running state, and when processing other threads, the state of the CPU may be a sleeping state, a waiting state, etc. Therefore, in order to more accurately determine the time consumed by the CPU to process the function to be tested, the first target time interval in which the CPU state is the running state in the first CPU time interval and the second target time interval in which the CPU state is the running state in the second CPU time interval can be determined respectively.

[0051] Step 105: Determine a degradation function in the new version application according to the difference between the first target time interval and the second target time interval.

[0052] In this embodiment, after determining the first target time interval in which the CPU state is in the running state in the first CPU time interval and the second target time interval in which the CPU state is in the running state in the second CPU time interval, the degradation function in the new version application can be determined according to the difference between the first target time interval and the second target time interval. After determining the degradation function, the degradation function can be optimized to achieve performance optimization operations on the new version application.

[0053] The degraded function may specifically be a function whose execution time in the new version application increases relative to that in the old version application.

[0054] Specifically, based on the first embodiment, step 105 specifically includes:

[0055] For each function to be tested, a difference between the first target time interval and the second target time interval is calculated.

[0056] If the difference is greater than a preset time threshold, the function to be tested is determined to be a degraded function.

[0057] If the difference is less than or equal to a preset time threshold, the function to be tested is determined to be a normal function.

[0058] In this embodiment, in order to determine the degraded function in the new version of the application, for each function to be tested, the difference between the first target time interval corresponding to the old version of the application and the second time interval corresponding to the new version of the application can be calculated, and the difference can be compared with the preset time threshold. Based on the comparison result, it is determined whether the function to be tested is a degraded function.

[0059] Specifically, if the difference is greater than a preset time threshold, it indicates that the function to be tested is a degraded function and needs to be optimized. Conversely, if the difference is not greater than the preset time threshold, it indicates that the function to be tested is a normal function.

[0060] Taking actual application as an example, in the old version of the application, the first target time interval corresponding to the function A to be tested is 5ms, and in the new version of the application, the second target time interval corresponding to the function A to be tested is 10ms. Calculate the difference between the first target time interval and the second target time interval, and determine that the difference is 5ms. Compare the difference with the preset time threshold of 3ms, and determine that the difference is greater than the preset time threshold, indicating that the function A to be tested is a degraded function, and it is necessary to inform the R&D personnel to optimize the degraded function.

[0061] Figure 3 A schematic diagram of the CPU operating state provided in the embodiment of the present disclosure, such as Figure 3As shown, the CPU's operating state may specifically include an operating state, a waiting state, a sleeping state, and a termination state. Depending on the different threads being processed, the CPU may switch between multiple states. When processing a function to be tested, the corresponding operation is the operating state.

[0062] Further, based on the first embodiment, after step 101, the following steps are further included:

[0063] Filtering functions existing in both the old version application and the new version application as the functions to be tested; and / or;

[0064] Functions that do not exist in the old version application and are newly added in the new version application are screened as the functions to be tested, wherein the first CPU time interval corresponding to the functions newly added in the new version application is zero.

[0065] In this embodiment, each application has multiple functions, so it is necessary to select a function to be tested that needs to be degraded from the multiple functions.

[0066] Specifically, functions that exist in both the old version application and the new version application can be determined as functions to be tested. Functions that do not exist in the old version application but are newly added to the new version application can also be determined as functions to be tested. It should be noted that the newly added function in the new version may be a function added to achieve a certain function, or it may be a fault function, so it needs to be tested for degradation. Since the function does not exist in the old version application, the first CPU time interval corresponding to the function can be set to 0, so that the difference calculation can be performed on the second CPU time interval corresponding to the newly added function.

[0067] In addition, theoretically, functions that exist in the old version of the application but do not exist in the new version of the application will not be degraded, so degradation detection may not be performed on them.

[0068] Further, based on the first embodiment, after step 102, the following steps are further included:

[0069] For each first CPU time interval corresponding to the function to be tested, determining a third target time interval in which the CPU state is a non-operating state in the first CPU time interval;

[0070] For each second CPU time interval corresponding to the function to be tested, determining a fourth target time interval in which the CPU state is a non-operating state in the second CPU time interval;

[0071] The performance of the CPU is detected according to the third target time interval and the fourth target time interval.

[0072] In this embodiment, after obtaining the first CPU time interval and the second CPU time interval, on the one hand, the degradation function can be detected according to the first CPU time interval and the second CPU time interval, and on the other hand, the CPU performance can also be detected according to the first CPU time interval and the second CPU time interval.

[0073] Specifically, a third target time interval in which the CPU is in a non-operating state during the first CPU time interval can be determined, and a fourth target time interval in which the CPU is in a non-operating state during the second CPU time interval can be determined. The CPU performance is detected based on the third target time interval and the fourth target time interval.

[0074] Taking a practical application as an example, if the CPU is in a non-operating state for too long, such as being in a sleep state for a long time, it can be determined that the CPU performance is poor.

[0075] The application optimization method provided by this embodiment is to determine the first CPU time interval occupied by each function to be tested during the operation of the old version application and the second CPU time interval corresponding to each function to be tested during the operation of the new version application, respectively determine the first target time interval in which the CPU state is in the running state in the first CPU time interval, and the second target time interval in which the CPU state is in the running state in the second CPU time interval, so that the degraded function in the new version application can be accurately determined according to the first target time interval and the second target time interval. By determining the first target time interval and the second target time interval, the time interval in which the CPU is in other running states when processing each function to be tested can be removed, that is, the time required for the CPU to process the function to be tested can be determined. By using the first target time interval and the second target time interval to detect the degraded function, the problem of large fluctuations in multiple detection values ​​caused by the CPU processing other threads while processing the function to be tested in the detection process of the application optimization method based on the time-consuming function execution can be effectively reduced, thereby improving the accuracy of the degraded function detection, and then accurately optimizing the degraded function in the new version application, thereby improving the efficiency of application optimization.

[0076] Figure 4 This is a flow chart of the application optimization method provided in the second embodiment of the present disclosure, based on the first embodiment, such as Figure 4 As shown, step 102 specifically includes:

[0077] Step 201: determine a first execution time corresponding to each function to be tested in the old version application during the running of the old version application, and determine a second execution time corresponding to each function to be tested in the new version application during the running of the new version application.

[0078] Step 202: Capture the first CPU time occupied during the running of the old version application, and capture the second CPU time occupied during the running of the new version application.

[0079] Step 203: match the first CPU time interval corresponding to each function to be tested in the old version application in the first CPU time according to the first execution time, and match the second CPU time interval corresponding to each function to be tested in the new version application in the second CPU time according to the second execution time.

[0080] In this embodiment, when capturing the CPU running time, only the time taken by the CPU to process a certain thread can be determined, and the time taken by the CPU to process a certain function cannot be determined in fine granularity. Therefore, in order to determine the first CPU time interval and the second CPU time interval required for the CPU to process the function to be tested, the execution time corresponding to the function to be tested can be matched with the CPU time required to execute the application.

[0081] Specifically, the first execution time corresponding to each function to be tested during the running of the old version application can be determined. And the second execution time corresponding to each function to be tested during the running of the new version application can be determined. The first CPU time occupied during the running of the old version application is captured, and the second CPU time occupied during the running of the new version application is captured. According to the first execution time, the first CPU time interval corresponding to each function to be tested in the old version application is matched in the first CPU time, and according to the second execution time, the second CPU time interval corresponding to each function to be tested in the new version application is matched in the second CPU time.

[0082] Specifically, based on the first embodiment, the first execution time includes the starting timestamp of each function to be tested in the old version application during the execution; the second execution time includes the starting timestamp of each function to be tested in the new version application during the execution; step 203 specifically includes:

[0083] Determine, in the first CPU time according to the first execution time, a time interval that is consistent with a start timestamp during the execution of each function to be tested in the old version application, to obtain the first CPU time interval;

[0084] According to the second execution time, a time interval consistent with a start timestamp in the running process of each function to be tested in the new version application is determined in the second CPU time to obtain the second CPU time interval.

[0085] In this embodiment, the first execution time includes the start timestamp of each function to be tested in the old version application during operation; the second execution time includes the start timestamp of each function to be tested in the new version application during operation. For example, the first execution time may include a start timestamp of 3ms and an end timestamp of 6ms corresponding to the function to be tested. According to the start timestamp corresponding to the first execution time, the time interval consistent with the start timestamp of each function to be tested in the old version application is determined in the first CPU time to obtain the first CPU time interval. And according to the start timestamp corresponding to the second execution time, the time interval consistent with the start timestamp of each function to be tested in the new version application during operation is determined in the second CPU time to obtain the second CPU time interval.

[0086] By determining the CPU time interval according to the start timestamp, the time interval occupied by the CPU processing the function to be tested can be accurately captured.

[0087] Figure 5 A schematic diagram of CPU time interval matching provided by an embodiment of the present disclosure, such as Figure 5 As shown, after determining the execution time of the function to be tested, the time interval consistent with the start timestamp can be determined in the CPU time axis according to the start timestamp in the execution time to obtain CPU time interval matching.

[0088] Further, in order to improve the matching efficiency of the CPU time interval, based on the first embodiment, step 203 specifically includes:

[0089] Extracting a first target CPU time corresponding to the main thread in the first CPU time according to a first main thread identifier corresponding to the main thread in the old version application, and extracting a second target CPU time corresponding to the main thread in the second CPU time according to a second main thread identifier corresponding to the main thread in the new version application;

[0090] According to the first execution duration, a first CPU time interval corresponding to each function to be tested in the old version application is matched in the first target CPU time, and according to the second execution duration, a second CPU time interval corresponding to each function to be tested in the new version application is matched in the second target CPU time.

[0091] In this embodiment, each function to be tested generally exists in the main thread of the old version application and the new version application. Therefore, in order to further improve the efficiency of degraded function detection and reduce the amount of calculation, the CPU time of the main thread of the old version application and the new version application can be captured first.

[0092] Specifically, the first target CPU time corresponding to the main thread in the first CPU time can be extracted according to the first main thread identifier corresponding to the main thread preset in the old version application. The second target CPU time corresponding to the main thread in the second CPU time can be extracted according to the second main thread identifier corresponding to the main thread preset in the new version application. Furthermore, the first CPU time interval corresponding to each function to be tested in the old version application can be matched in the first target CPU time according to the first execution time corresponding to each function to be tested in the old version application. The second CPU time interval corresponding to each function to be tested in the new version application can be matched in the second target CPU time according to the second execution time corresponding to each function to be tested in the new version application.

[0093] Further, based on the first embodiment, step 201 specifically includes:

[0094] Performing a plugging operation on each function to be tested in the old version application respectively, and determining, according to the plugging operation, a first execution time consumption corresponding to each function to be tested in the old version application during the running of the old version application;

[0095] Performing an instrumentation operation on each function to be tested in the new version application respectively, and determining, according to the instrumentation operation, a second execution time consumption corresponding to each function to be tested in the new version application during the running of the new version application.

[0096] In this embodiment, the execution time consumption of the function to be tested may be determined by using an instrumentation method.

[0097] Specifically, an instrumentation operation may be performed on each function to be tested in the old version of the application, and a first execution time corresponding to each function to be tested in the old version of the application may be determined based on the instrumentation operation. Also, an instrumentation operation may be performed on each function to be tested in the new version of the application, and a second execution time corresponding to each function to be tested in the new version of the application may be determined based on the instrumentation operation.

[0098] Further, based on the first embodiment, step 202 specifically includes:

[0099] The first CPU time occupied by the old version application during its operation is captured through systrace, and the second CPU time occupied by the new version application during its operation is captured through systrace.

[0100] In this embodiment, the systrace method may be used to capture the first CPU time occupied during the running of the old version application and the second CPU time occupied during the running of the new version application.

[0101] The application optimization method provided in this embodiment can accurately capture the time interval taken by the CPU to process the function to be tested by matching the execution time corresponding to the function to be tested with the CPU time required to execute the application. Then, the degraded function can be accurately detected based on the time interval taken by the CPU to process the function to be tested.

[0102] Figure 6 A flowchart of an application optimization method provided in Embodiment 3 of the present disclosure is provided. Based on any of the above embodiments, Figure 6 As shown, after step 102, the following steps are also included:

[0103] Step 301: Obtain a degradation detection instruction, wherein the degradation detection instruction includes an identifier of a stage to be detected.

[0104] Step 302: Determine at least one target function to be tested corresponding to the identification of the stage to be tested according to the degradation detection instruction.

[0105] Step 303: Determine whether the stage to be detected is a degradation stage according to the first CPU time interval and the second CPU time interval corresponding to the at least one target function to be tested.

[0106] In this embodiment, the application process can be divided into multiple different stages according to actual needs, and each stage can correspond to at least one function to be tested. Taking application startup as an example, the startup process can be divided into a cold start process, that is, the time from when the user triggers the icon to when a blank page appears, and a first frame process, which can also be the time from a blank page to the first frame page of the application. Therefore, the degradation of a certain stage can also be detected according to the first and second CPU time intervals. Thereby, optimization operations can be performed on a stage where degradation occurs later.

[0107] Specifically, a degradation detection instruction may be obtained, and the degradation detection instruction may include a stage identifier to be detected. The degradation detection instruction may be specifically sent by a user through a terminal device. According to the degradation detection instruction, at least one target function to be tested corresponding to the stage identifier to be detected is determined. According to the first CPU time interval and the second CPU time interval corresponding to the at least one target function to be tested, it is determined whether the stage to be detected is a degradation stage.

[0108] Figure 7 Schematic diagram of the system architecture based on the embodiment of the present disclosure, such as Figure 7 As shown, the system architecture based on the present disclosure includes at least a server 1 and a terminal device 2, wherein an application optimization device is provided in the server 1. The terminal device 2 can be a computer, a mobile phone, a tablet or other device, and the server 1 is connected to the terminal device 2 in communication so that the two can exchange information.

[0109] The application optimization method provided in this embodiment determines at least one target function to be tested corresponding to the identification of the stage to be tested according to the degradation detection instruction, and determines whether the stage to be tested is a degradation stage according to the first CPU time interval and the second CPU time interval corresponding to the at least one target function to be tested, so as to implement degradation detection on the stage to be detected.

[0110] Figure 8 A schematic diagram of the structure of the application optimization device provided in the fourth embodiment of the present disclosure, such as Figure 8 As shown, the device includes: an operation module 41, a determination module 42, a processing module 43 and an identification module 44. Among them, the operation module 41 is used to run the old version application and the new version application respectively. The determination module 42 is used to determine the first CPU time interval corresponding to each function to be tested during the operation of the old version application, and determine the second CPU time interval corresponding to each function to be tested during the operation of the new version application. The processing module 43 is used to determine, for each first CPU time interval corresponding to the function to be tested, a first target time interval in which the CPU state is a running state in the first CPU time interval. The processing module 43 is also used to determine, for each second CPU time interval corresponding to the function to be tested, a second target time interval in which the CPU state is a running state in the second CPU time interval. The identification module 44 is used to determine the degraded function in the new version application according to the difference between the first target time interval and the second target time interval.

[0111] Further, based on Example 4, the identification module is used to: for each function to be tested, calculate the difference between the first target time interval and the second target time interval; if the difference is greater than a preset time threshold, determine that the function to be tested is a degraded function; if the difference is less than or equal to the preset time threshold, determine that the function to be tested is a normal function.

[0112] Furthermore, based on the fourth embodiment, the device also includes: a processing module, which is used to determine, for each first CPU time interval corresponding to the function to be tested, a third target time interval in which the CPU is in a non-operating state during the first CPU time interval; the processing module is also used to determine, for each second CPU time interval corresponding to the function to be tested, a fourth target time interval in which the CPU is in a non-operating state during the second CPU time interval; and a detection module, which is used to detect the performance of the CPU according to the third target time interval and the fourth target time interval.

[0113] Furthermore, based on the fourth embodiment, the device further includes: an optimization module, configured to perform optimization operations on the degradation function.

[0114] Further, on the basis of Example 4, the device also includes: a screening module, used to screen functions that exist in both the old version application and the new version application as the functions to be tested; and / or; a screening module, also used to screen functions that do not exist in the old version application but are newly added to the new version application as the functions to be tested, wherein the first CPU time interval corresponding to the functions newly added to the new version application is zero.

[0115] Further, on the basis of Example 4, the determination module is used to: determine a first execution time corresponding to each function to be tested in the old version application during the running of the old version application, and determine a second execution time corresponding to each function to be tested in the new version application during the running of the new version application; capture the first CPU time occupied during the running of the old version application, and capture the second CPU time occupied during the running of the new version application; match the first CPU time interval corresponding to each function to be tested in the old version application in the first CPU time according to the first execution time, and match the second CPU time interval corresponding to each function to be tested in the new version application in the second CPU time according to the second execution time.

[0116] Further, on the basis of Example 4, the first execution time includes the starting timestamp of each function to be tested in the old version application during its execution; the second execution time includes the starting timestamp of each function to be tested in the new version application during its execution; the determination module is used to: determine the time interval consistent with the starting timestamp of each function to be tested in the old version application in the first CPU time according to the first execution time, and obtain the first CPU time interval; determine the time interval consistent with the starting timestamp of each function to be tested in the new version application in the second CPU time according to the second execution time, and obtain the second CPU time interval.

[0117] Further, on the basis of Example 4, the determination module is used to: extract the first target CPU time corresponding to the main thread in the first CPU time according to the first main thread identifier corresponding to the main thread in the old version application, and extract the second target CPU time corresponding to the main thread in the second CPU time according to the second main thread identifier corresponding to the main thread in the new version application; match the first CPU time interval corresponding to each function to be tested in the old version application in the first target CPU time according to the first execution time, and match the second CPU time interval corresponding to each function to be tested in the new version application in the second target CPU time according to the second execution time.

[0118] Further, on the basis of Example 4, the determination module is used to: perform an instrumentation operation on each function to be tested in the old version application, and determine, according to the instrumentation operation, a first execution time corresponding to each function to be tested in the old version application during the running of the old version application; perform an instrumentation operation on each function to be tested in the new version application, and determine, according to the instrumentation operation, a second execution time corresponding to each function to be tested in the new version application during the running of the new version application.

[0119] Further, based on the fourth embodiment, the determination module is used to: capture the first CPU time occupied by the old version application during the running process through systrace, and capture the second CPU time occupied by the new version application during the running process through systrace.

[0120] Further, based on any of the above embodiments, the device further includes: an acquisition module, a determination module, and an identification module. The acquisition module is used to acquire a degradation detection instruction, wherein the degradation detection instruction includes a detection stage identifier; the determination module is used to determine at least one target function to be tested corresponding to the detection stage identifier according to the degradation detection instruction; and the identification module is used to determine whether the detection stage is a degradation stage according to a first CPU time interval and a second CPU time interval corresponding to the at least one target function to be tested.

[0121] The application optimization device provided in this embodiment can be used to execute the technical solution of the above-mentioned method embodiment. Its implementation principle and technical effects are similar and will not be described in detail in this embodiment.

[0122] Fig. 9 This is a schematic diagram of the structure of an electronic device provided in Embodiment 5 of the present disclosure, such as Fig. 9 , which shows a schematic diagram of the structure of an electronic device 500 suitable for implementing the embodiment of the present disclosure, and the electronic device 500 may be a terminal device or a server. The terminal device may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, personal digital assistants (PDAs), tablet computers (Portable Android Devices, PADs), portable multimedia players (PMPs), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig. 9 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0123] like Fig. 9As shown, the electronic device 500 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 to a random access memory (RAM) 503. Various programs and data required for the operation of the electronic device 500 are also stored in the RAM 503. The processing device 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0124] Typically, the following devices may be connected to the I / O interface 505: input devices 506 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 507 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 508 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 509. The communication devices 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. Although Fig. 9 The electronic device 500 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0125] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 509, or installed from a storage device 508, or installed from a ROM 502. When the computer program is executed by the processing device 501, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.

[0126] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0127] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0128] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device executes the method shown in the above embodiment.

[0129] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0130] Yet another embodiment of the present disclosure provides a computer program product, including a computer program, which implements the method shown in the above embodiment when executed by a processor.

[0131] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0132] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware. The name of a unit does not limit the unit itself in some cases. For example, the first acquisition unit may also be described as a "unit for acquiring at least two Internet Protocol addresses".

[0133] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0134] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0135] In a first aspect, according to one or more embodiments of the present disclosure, there is provided an application optimization method, comprising:

[0136] Run the old version application and the new version application separately; determine a first CPU time interval corresponding to each function to be tested during the running of the old version application, and determine a second CPU time interval corresponding to each function to be tested during the running of the new version application; for each first CPU time interval corresponding to the function to be tested, determine a first target time interval in which the CPU state is a running state during the first CPU time interval; for each second CPU time interval corresponding to the function to be tested, determine a second target time interval in which the CPU state is a running state during the second CPU time interval; and determine a degradation function in the new version application according to a difference between the first target time interval and the second target time interval.

[0137] According to one or more embodiments of the present disclosure, determining the first CPU time interval corresponding to each function to be tested during the running of the old version application, and determining the second CPU time interval corresponding to each function to be tested during the running of the new version application, includes: determining the first execution time corresponding to each function to be tested in the old version application during the running of the old version application, and determining the second execution time corresponding to each function to be tested in the new version application during the running of the new version application; capturing the first CPU time occupied during the running of the old version application, and capturing the second CPU time occupied during the running of the new version application; matching the first CPU time interval corresponding to each function to be tested in the old version application in the first CPU time according to the first execution time, and matching the second CPU time interval corresponding to each function to be tested in the new version application in the second CPU time according to the second execution time.

[0138] According to one or more embodiments of the present disclosure, the first execution time includes the starting timestamp of each function to be tested in the old version application during operation; the second execution time includes the starting timestamp of each function to be tested in the new version application during operation; matching the first CPU time interval corresponding to each function to be tested in the old version application in the first CPU time according to the first execution time, and matching the second CPU time interval corresponding to each function to be tested in the new version application in the second CPU time according to the second execution time, includes: determining the time interval consistent with the starting timestamp of each function to be tested in the old version application in the first CPU time according to the first execution time, to obtain the first CPU time interval; determining the time interval consistent with the starting timestamp of each function to be tested in the new version application in the second CPU time according to the second execution time, to obtain the second CPU time interval.

[0139] According to one or more embodiments of the present disclosure, matching the first CPU time interval corresponding to each function to be tested in the old version application in the first CPU time according to the first execution time, and matching the second CPU time interval corresponding to each function to be tested in the new version application in the second CPU time according to the second execution time, includes: extracting the first target CPU time corresponding to the main thread in the first CPU time according to the first main thread identifier corresponding to the main thread in the old version application, and extracting the second target CPU time corresponding to the main thread in the second CPU time according to the second main thread identifier corresponding to the main thread in the new version application; matching the first CPU time interval corresponding to each function to be tested in the old version application in the first target CPU time according to the first execution time, and matching the second CPU time interval corresponding to each function to be tested in the new version application in the second target CPU time according to the second execution time.

[0140] According to one or more embodiments of the present disclosure, determining the first execution time corresponding to each function to be tested in the old version application during the running of the old version application, and determining the second execution time corresponding to each function to be tested in the new version application during the running of the new version application, include: performing instrumentation operations on each function to be tested in the old version application respectively, and determining the first execution time corresponding to each function to be tested in the old version application during the running of the old version application according to the instrumentation operations; performing instrumentation operations on each function to be tested in the new version application respectively, and determining the second execution time corresponding to each function to be tested in the new version application during the running of the new version application according to the instrumentation operations.

[0141] According to one or more embodiments of the present disclosure, capturing the first CPU time occupied during the running of the old version application, and capturing the second CPU time occupied during the running of the new version application, include: capturing the first CPU time occupied during the running of the old version application through systrace, and capturing the second CPU time occupied during the running of the new version application through systrace.

[0142] According to one or more embodiments of the present disclosure, determining the degradation function in the new version application based on the difference between the first target time interval and the second target time interval includes: for each function to be tested, calculating the difference between the first target time interval and the second target time interval; if the difference is greater than a preset time threshold, determining that the function to be tested is a degradation function; if the difference is less than or equal to the preset time threshold, determining that the function to be tested is a normal function.

[0143] According to one or more embodiments of the present disclosure, after determining the second CPU time interval corresponding to each function to be tested during the running process of the new version application, it also includes: for each first CPU time interval corresponding to the function to be tested, determining a third target time interval during the first CPU time interval during which the state of the CPU is a non-running state; for each second CPU time interval corresponding to the function to be tested, determining a fourth target time interval during the second CPU time interval during which the state of the CPU is a non-running state; and detecting the performance of the CPU based on the third target time interval and the fourth target time interval.

[0144] According to one or more embodiments of the present disclosure, after determining that each function to be tested during the running of the new version of the application corresponds to the second CPU time interval, the method further includes: obtaining a degradation detection instruction, the degradation detection instruction including a detection stage identifier; determining, according to the degradation detection instruction, at least one target function to be tested corresponding to the detection stage identifier; and determining whether the detection stage is a degradation stage according to the first CPU time interval and the second CPU time interval corresponding to the at least one target function to be tested.

[0145] According to one or more embodiments of the present disclosure, after determining the degradation function in the new version application according to the first target time interval and the second target time interval, the method further includes: optimizing the degradation function.

[0146] According to one or more embodiments of the present disclosure, after respectively running the old version application and the new version application, it also includes: screening functions existing in both the old version application and the new version application as the functions to be tested; and / or; screening functions that do not exist in the old version application but are newly added to the new version application as the functions to be tested, wherein the first CPU time interval corresponding to the functions newly added to the new version application is zero.

[0147] In a second aspect, according to one or more embodiments of the present disclosure, an application optimization device is provided, comprising: an operation module, used to respectively run an old version application and a new version application; a determination module, used to determine a first CPU time interval corresponding to each function to be tested during the operation of the old version application, and to determine a second CPU time interval corresponding to each function to be tested during the operation of the new version application; a processing module, used to determine, for each first CPU time interval corresponding to the function to be tested, a first target time interval in which the CPU state is a running state in the first CPU time interval; the processing module is also used to determine, for each second CPU time interval corresponding to the function to be tested, a second target time interval in which the CPU state is a running state in the second CPU time interval; an identification module, used to determine a degraded function in the new version application based on the difference between the first target time interval and the second target time interval.

[0148] According to one or more embodiments of the present disclosure, the determination module is used to: determine a first execution time corresponding to each function to be tested in the old version application during the running of the old version application, and determine a second execution time corresponding to each function to be tested in the new version application during the running of the new version application; capture the first CPU time occupied during the running of the old version application, and capture the second CPU time occupied during the running of the new version application; match the first CPU time interval corresponding to each function to be tested in the old version application in the first CPU time according to the first execution time, and match the second CPU time interval corresponding to each function to be tested in the new version application in the second CPU time according to the second execution time.

[0149] According to one or more embodiments of the present disclosure, the first execution time includes the starting timestamp of each function to be tested in the old version application during its execution; the second execution time includes the starting timestamp of each function to be tested in the new version application during its execution; the determination module is used to: determine, in the first CPU time according to the first execution time, a time interval consistent with the starting timestamp of each function to be tested in the old version application during its execution, to obtain the first CPU time interval; determine, in the second CPU time according to the second execution time, a time interval consistent with the starting timestamp of each function to be tested in the new version application during its execution, to obtain the second CPU time interval.

[0150] According to one or more embodiments of the present disclosure, the determination module is used to: extract the first target CPU time corresponding to the main thread in the first CPU time according to the first main thread identifier corresponding to the main thread in the old version application, and extract the second target CPU time corresponding to the main thread in the second CPU time according to the second main thread identifier corresponding to the main thread in the new version application; match the first CPU time interval corresponding to each function to be tested in the old version application in the first target CPU time according to the first execution time, and match the second CPU time interval corresponding to each function to be tested in the new version application in the second target CPU time according to the second execution time.

[0151] According to one or more embodiments of the present disclosure, the determination module is used to: respectively perform an instrumentation operation on each function to be tested in the old version application, and determine, according to the instrumentation operation, a first execution time corresponding to each function to be tested in the old version application during the running of the old version application; respectively perform an instrumentation operation on each function to be tested in the new version application, and determine, according to the instrumentation operation, a second execution time corresponding to each function to be tested in the new version application during the running of the new version application.

[0152] According to one or more embodiments of the present disclosure, the determination module is used to: capture the first CPU time occupied by the old version application during operation through systrace, and capture the second CPU time occupied by the new version application during operation through systrace.

[0153] According to one or more embodiments of the present disclosure, the identification module is used to: calculate the difference between the first target time interval and the second target time interval for each function to be tested; if the difference is greater than a preset time threshold, determine that the function to be tested is a degraded function; if the difference is less than or equal to the preset time threshold, determine that the function to be tested is a normal function.

[0154] According to one or more embodiments of the present disclosure, the device also includes: a processing module, which is used to determine, for each first CPU time interval corresponding to the function to be tested, a third target time interval in which the CPU is in a non-operating state during the first CPU time interval; the processing module is also used to determine, for each second CPU time interval corresponding to the function to be tested, a fourth target time interval in which the CPU is in a non-operating state during the second CPU time interval; and a detection module, which is used to detect the performance of the CPU based on the third target time interval and the fourth target time interval.

[0155] According to one or more embodiments of the present disclosure, the device also includes: an acquisition module for acquiring a degradation detection instruction, wherein the degradation detection instruction includes an identifier of a stage to be detected; a determination module for determining, based on the degradation detection instruction, at least one target function to be tested corresponding to the identifier of the stage to be detected; and an identification module for determining whether the stage to be detected is a degradation stage based on a first CPU time interval and a second CPU time interval corresponding to the at least one target function to be tested.

[0156] According to one or more embodiments of the present disclosure, the device further includes: an optimization module, configured to perform optimization operations on the degradation function.

[0157] According to one or more embodiments of the present disclosure, the device also includes: a screening module, used to screen functions that exist in both the old version application and the new version application as the functions to be tested; and / or; a screening module, also used to screen functions that do not exist in the old version application but are newly added to the new version application as the functions to be tested, wherein the first CPU time interval corresponding to the functions newly added to the new version application is zero.

[0158] In a third aspect, according to one or more embodiments of the present disclosure, there is provided an electronic device, comprising: at least one processor and a memory;

[0159] The memory stores computer-executable instructions;

[0160] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the application optimization method described in the first aspect and various possible designs of the first aspect.

[0161] In a fourth aspect, according to one or more embodiments of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer execution instructions. When a processor executes the computer execution instructions, the application optimization method described in the first aspect and various possible designs of the first aspect is implemented.

[0162] In a fifth aspect, according to one or more embodiments of the present disclosure, a computer program product is provided, including a computer program, which, when executed by a processor, implements the application optimization method described in the first aspect and various possible designs of the first aspect.

[0163] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.

[0164] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.

[0165] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.

Claims

1. An application optimization method, characterized in that: include: Run the old version of the application and the new version of the application respectively; Determine a first execution time corresponding to each function to be tested in the old version application during the running of the old version application, and determine a second execution time corresponding to each function to be tested in the new version application during the running of the new version application; the first execution time includes a start timestamp of each function to be tested in the old version application during the running process; The second execution time includes the starting timestamp of each function to be tested in the new version application during its execution; Capturing a first CPU time occupied during the running of the old version application, and capturing a second CPU time occupied during the running of the new version application; Determine, in the first CPU time according to the first execution time, a time interval that is consistent with a start timestamp during the execution of each function to be tested in the old version application, to obtain the first CPU time interval; Determine, in the second CPU time according to the second execution time, a time interval that is consistent with a start timestamp during the execution of each function to be tested in the new version application, to obtain the second CPU time interval; For each first CPU time interval corresponding to the function to be tested, determining a first target time interval in which the CPU state is a running state in the first CPU time interval; For each second CPU time interval corresponding to the function to be tested, determining a second target time interval in which the CPU state is a running state in the second CPU time interval; A degradation function in the new version application is determined according to the difference information between the first target time interval and the second target time interval.

2. The method according to claim 1, characterized in that The matching of the first CPU time interval corresponding to each function to be tested in the old version application in the first CPU time according to the first execution time, and the matching of the second CPU time interval corresponding to each function to be tested in the new version application in the second CPU time according to the second execution time, includes: Extracting a first target CPU time corresponding to the main thread in the first CPU time according to a first main thread identifier corresponding to the main thread in the old version application, and extracting a second target CPU time corresponding to the main thread in the second CPU time according to a second main thread identifier corresponding to the main thread in the new version application; According to the first execution duration, a first CPU time interval corresponding to each function to be tested in the old version application is matched in the first target CPU time, and according to the second execution duration, a second CPU time interval corresponding to each function to be tested in the new version application is matched in the second target CPU time.

3. The method according to claim 1 or 2, characterized in that: The determining of a first execution time corresponding to each function to be tested in the old version application during the running of the old version application, and the determining of a second execution time corresponding to each function to be tested in the new version application during the running of the new version application, include: Performing a plugging operation on each function to be tested in the old version application respectively, and determining, according to the plugging operation, a first execution time consumption corresponding to each function to be tested in the old version application during the running of the old version application; Performing an instrumentation operation on each function to be tested in the new version application respectively, and determining, according to the instrumentation operation, a second execution time consumption corresponding to each function to be tested in the new version application during the running of the new version application.

4. The method according to claim 1, characterized in that: The determining, according to the difference between the first target time interval and the second target time interval, the degradation function in the new version application includes: For each function to be tested, calculating the difference between the first target time interval and the second target time interval; If the difference is greater than a preset time threshold, determining that the function to be tested is a degraded function; If the difference is less than or equal to a preset time threshold, the function to be tested is determined to be a normal function.

5. The method according to claim 1, characterized in that After determining that each function to be tested corresponds to a second CPU time interval during the running of the new version application, the method further includes: For each first CPU time interval corresponding to the function to be tested, determining a third target time interval in which the CPU state is a non-operating state in the first CPU time interval; For each second CPU time interval corresponding to the function to be tested, determining a fourth target time interval in which the CPU state is a non-operating state in the second CPU time interval; The performance of the CPU is detected according to the third target time interval and the fourth target time interval.

6. The method according to any one of claims 1, 2, 4 or 5, characterized in that: After determining that each function to be tested corresponds to a second CPU time interval during the running of the new version application, the method further includes: Obtaining a degradation detection instruction, wherein the degradation detection instruction includes an identifier of a stage to be detected; Determining, according to the degradation detection instruction, at least one target to-be-tested function corresponding to the to-be-tested stage identifier; It is determined whether the stage to be detected is a degradation stage according to a first CPU time interval and a second CPU time interval corresponding to the at least one target function to be tested.

7. An application optimization device, characterized in that: include: A running module is used to run the old version application and the new version application respectively; A determination module, used to determine a first CPU time interval corresponding to each function to be tested during the running of the old version application, and to determine a second CPU time interval corresponding to each function to be tested during the running of the new version application; A processing module, configured to determine, for each first CPU time interval corresponding to the function to be tested, a first target time interval in which the CPU state is a running state in the first CPU time interval; The processing module is further used to determine, for each second CPU time interval corresponding to the function to be tested, a second target time interval in which the CPU state is a running state in the second CPU time interval; an identification module, configured to determine a degradation function in the new version application according to a difference between the first target time interval and the second target time interval; The determination module is specifically used to determine the first execution time corresponding to each function to be tested in the old version application during the running of the old version application, and determine the second execution time corresponding to each function to be tested in the new version application during the running of the new version application; the first execution time includes the starting timestamp of the running process of each function to be tested in the old version application; The second execution time includes the starting timestamp of each function to be tested in the new version application during its execution; Capturing a first CPU time occupied during the running of the old version application, and capturing a second CPU time occupied during the running of the new version application; Determine, in the first CPU time according to the first execution time, a time interval that is consistent with a start timestamp during the execution of each function to be tested in the old version application, to obtain the first CPU time interval; According to the second execution time, a time interval consistent with a start timestamp in the running process of each function to be tested in the new version application is determined in the second CPU time to obtain the second CPU time interval.

8. An electronic device, characterized in that: include: at least one processor and memory; The memory stores computer-executable instructions; The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the application optimization method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the processor executes the computer-executable instructions, the application optimization method according to any one of claims 1 to 6 is implemented.

10. A computer program product, characterized in that The invention comprises a computer program, which implements the application optimization method according to any one of claims 1 to 6 when being executed by a processor.

Citation Information

Patent Citations

  • Function execution time testing method and device

    CN107025173A

  • System and method for maximizing data processing throughput via application load adaptive scheduling and content switching

    GB201103195D0