Time-consuming function determination method and device, electronic equipment and storage medium
By analyzing the code difference analysis results and dynamically executing logical branches, the actual time-consuming function is determined, and the problem of discovering and attribution of the deterioration problem of multi-logical branches is solved, and the accurate identification and analysis of the deterioration time-consuming function introduced by the AB experiment is achieved.
Patent Information
- Application Number
- CN202311103645.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-29
- Publication Date
- 2025-03-04
AI Technical Summary
The prior art has difficulties in discovering and attributing the deterioration problems of multi-logical branches, and it is impossible to effectively identify and analyze the introduced deterioration time-consuming functions.
By analyzing the code difference analysis results, the candidate time-consuming function of the candidate logical branch code is determined, and each logical branch is executed to determine the time-consuming information of the candidate time-consuming function, and finally determine the actual time-consuming function based on this information.
It realizes effective discovery and attribution of multi-logical branch degradation problems, can accurately identify and analyze the introduced degradation time-consuming functions, and improves the AB experiment anti-degradation capability in the code submission stage.
Smart Images

Figure CN119557187A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to computer technology, and more particularly to a method, device, electronic device and storage medium for determining a time-consuming function. Background Art
[0002] The existing anti-degradation tasks can only cover one of the scenarios when facing logical branches during execution. For example, when facing a new AB experiment (also known as a control experiment), the new degraded time-consuming function appears in the logical branch of the experimental group, but the anti-degradation task covers the control group branch. In this case, the degraded time-consuming function introduced by the AB experiment cannot be successfully discovered. Therefore, it is difficult to discover and attribute the existing multi-logic branch degradation problem. Summary of the invention
[0003] The present disclosure provides a time-consuming function determination method, device, electronic device and storage medium to solve the technical problem that multi-logic branch degradation problems are difficult to discover and attribute.
[0004] In a first aspect, an embodiment of the present disclosure provides a method for determining a time-consuming function, comprising:
[0005] Analyze the code difference analysis result to determine the candidate time-consuming function of the candidate logic branch code, wherein the candidate logic branch code is a candidate code with at least two logic branches that causes indicator degradation;
[0006] Execute each logic branch in the candidate logic branch code, and determine the time consumption information of the candidate time-consuming function in each logic branch;
[0007] Based on each of the time-consuming information, an actual time-consuming function among the candidate time-consuming functions is determined.
[0008] In a second aspect, the embodiment of the present disclosure further provides a time-consuming function determination device, including:
[0009] An analysis module, used to analyze the code difference analysis result and determine a candidate time-consuming function of a candidate logic branch code, wherein the candidate logic branch code is a candidate code having at least two logic branches that causes indicator degradation;
[0010] A time-consuming information determination module, used to execute each logic branch in the candidate logic branch code and determine the time-consuming information of the candidate time-consuming function in each logic branch;
[0011] The time-consuming function determination module is used to determine the actual time-consuming function among the candidate time-consuming functions based on each of the time-consuming information.
[0012] In a third aspect, an embodiment of the present disclosure further provides an electronic device, characterized in that the electronic device includes:
[0013] one or more processing devices;
[0014] a storage device for storing one or more programs,
[0015] When the one or more programs are executed by the one or more processing devices, the one or more processing devices implement the time-consuming function determination method provided in the embodiment of the present disclosure.
[0016] In a fourth aspect, an embodiment of the present disclosure further provides a storage medium comprising computer executable instructions, which, when executed by a computer processor, are used to execute a method for determining a time-consuming function as provided in an embodiment of the present disclosure.
[0017] In the disclosed embodiment, by analyzing the results of code difference analysis, candidate time-consuming functions of candidate logic branch codes are determined, wherein the candidate logic branch codes are candidate codes with at least two logic branches that cause indicator degradation; each logic branch in the candidate logic branch codes is executed to determine the timing information of the candidate time-consuming functions in each logic branch; based on each of the timing information, the actual time-consuming functions in the candidate time-consuming functions are determined, thereby solving the technical problems of difficulty in discovering and attributing degradation problems of multiple logic branches. The candidate time-consuming functions are statically analyzed, and then the timing information of the candidate time-consuming functions is dynamically determined, and then the actual time-consuming functions are analyzed, thereby realizing the determination of the actual time-consuming functions in the submitted code, that is, realizing the attribution of the degradation problem of the code with at least two logic branches. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0019] Figure 1 It is a flowchart of a method for determining a time-consuming function provided by an embodiment of the present disclosure;
[0020] Figure 2 It is a schematic diagram of the execution scenario of the anti-degradation task in the prior art;
[0021] Figure 3 It is a flowchart of another method for determining a time-consuming function provided by an embodiment of the present disclosure;
[0022] Figure 4 It is a schematic diagram of a call point modification scenario of an AB experiment provided by an embodiment of the present disclosure;
[0023] Figure 5It is a schematic diagram of a scenario directly affected by an AB experiment provided by an embodiment of the present disclosure;
[0024] Figure 6 is a schematic diagram of an indirect impact scenario of an AB experiment provided by an embodiment of the present disclosure;
[0025] Figure 7 A schematic diagram of a scenario of a candidate time-consuming function provided by an embodiment of the present disclosure;
[0026] Figure 8 is a call relationship diagram provided by an embodiment of the present disclosure;
[0027] Fig. 9 is a schematic diagram of an analysis process of a candidate time-consuming function provided by an embodiment of the present disclosure;
[0028] Fig.10 is a schematic diagram of an attribution scenario provided by an embodiment of the present disclosure;
[0029] Fig.11 It is a schematic diagram of a flow chart of determining a time-consuming function provided by an embodiment of the present disclosure;
[0030] Fig.12 It is a schematic diagram of the structure of a time-consuming function determination device provided by an embodiment of the present disclosure;
[0031] Fig.13 It is a structural schematic diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0032] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0033] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0034] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0035] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0036] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0037] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0038] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0039] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.
[0040] As an optional but non-limiting implementation, in response to receiving an active request from the user, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0041] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet the relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0042] It is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and relevant provisions.
[0043] Figure 1It is a flow chart of a method for determining a time-consuming function provided by an embodiment of the present disclosure. The embodiment of the present disclosure is applicable to situations where a time-consuming function in a code is determined. The method can be executed by a time-consuming function determination device, which can be implemented in the form of software and / or hardware, and optionally, by an electronic device, which can be a mobile terminal, a PC or a server, etc.
[0044] Figure 2 is a schematic diagram of the execution scenario of the anti-degradation task in the prior art. Figure 2 It shows that when the existing anti-degradation task faces the newly added AB experiment during the code execution process, it can only cover the control group without the newly added time-consuming method, and cannot cover the experimental group with the time-consuming method.
[0045] In one embodiment, static analysis can be used to discover the time-consuming methods introduced by AB experiments in core indicator scenarios (core indicator scenarios are not limited here and can be determined based on actual business conditions) from a global code perspective, but it also faces the problem of low accuracy. The time-consuming methods discovered by static analysis may not be time-consuming in actual operation because the specific time consumption is unknown. The present disclosure provides a code submission stage merge request (MR) level AB experiment anti-degradation to solve the problem of difficulty in discovering and attributing AB experiment degradation.
[0046] like Figure 1 As shown, the method includes:
[0047] S110: Analyze the code difference analysis result to determine the candidate time-consuming functions of the candidate logic branch codes.
[0048] After the code is developed, the content of the developed code is merged into the branch that the code wants to be merged in a way of requesting a merge. This process is called MR. Code difference analysis will be performed in the MR stage. The objects of code difference analysis are the commit ID of the baseline (i.e., commit ID) and the commit ID of the update, and the difference between the codes of the two is analyzed. Among them, the commit ID of the baseline can represent the commit node before the modification. The commit ID of the update can represent the commit node after the code is modified based on the code corresponding to the commit ID of the baseline.
[0049] The code difference analysis result can be considered as the result of the code difference analysis. The candidate logic branch code is the candidate code with at least two logic branches that causes the index degradation. The candidate code with at least two logic branches that causes the index degradation can be the code with at least two logic branches that causes the index degradation newly added by the code submission. The candidate time-consuming function can be considered as the candidate time-consuming function. The code with at least two logic branches can be considered as the code with at least two logic branches.
[0050] In this embodiment, when analyzing the code difference analysis results, the analysis is performed from the following three dimensions:
[0051] Whether the MR has added or modified code with at least two logical branches. If so, it can be used as a candidate logical branch code;
[0052] Whether the candidate logic branch code affects the scene. If so, whether the candidate logic branch code adds a time-consuming function. If so, the newly added time-consuming function is determined as a candidate time-consuming function.
[0053] Code with at least two logical branches can be considered as code with multiple logical branches. The logic of each logical branch can be independent, such as AB experiment (also known as control experiment). Among them, AB experiment is to divide the code into two or more groups, one group keeps the existing solution called control group corresponding to a part of users, and the other group uses the improved solution called experimental group corresponding to another part of users. The difference in indicators between the two groups is analyzed using statistical methods to evaluate whether it meets expectations.
[0054] The process of analyzing the code difference analysis results in this step can be considered as a process of statically analyzing the bytecode to determine whether a function is suspected to be time-consuming. Candidate time-consuming functions are also called suspected time-consuming functions, that is, time-consuming functions that are initially determined. Whether they are actually time-consuming still needs further judgment.
[0055] S120: Execute each logic branch in the candidate logic branch code, and determine the time consumption information of the candidate time-consuming function in each logic branch.
[0056] The time-consuming information can be considered as information that characterizes the time consumption. After determining the candidate time-consuming function, this operation can execute each logic branch in the candidate logic branch code, and determine the time-consuming information of the candidate time-consuming function in each logic branch in turn. The above process can be considered as the dynamic execution of the candidate time-consuming function.
[0057] This step enforces the execution of each logical branch in the candidate logical branch during dynamic execution, obtains dynamic data of each logical branch, and then determines the time-consuming information of the candidate time-consuming function under different logical branches, which is used to determine the time-consuming function that actually generates time. Among them, dynamic data can be considered as data generated during dynamic execution.
[0058] S130: Determine an actual time-consuming function among the candidate time-consuming functions based on each piece of time-consuming information.
[0059] The actual time-consuming function can be considered as the function that actually generates the time consumption.
[0060] After determining the time-consuming information, this operation can analyze the value of each time-consuming information to determine the actual time-consuming function in the candidate time-consuming function. The means of analysis are not limited here, such as determining the actual time-consuming function in the candidate time-consuming function based on the dynamic data of the experimental group (the dynamic data includes the time-consuming information of the candidate time-consuming function) and / or the dynamic data of the control group (the dynamic data includes the time-consuming information of the candidate time-consuming function).
[0061] For example, if a candidate time-consuming function A is added to the experimental group, and the time-consuming information of the candidate time-consuming function A is greater than the set value, it can be considered that the candidate time-consuming function A in the experimental group is the actual time-consuming function.
[0062] For another example, if a candidate time-consuming function B is added to the experimental group, and the time consumption information of the candidate time-consuming function B is less than the set value, it can be considered that although the candidate time-consuming function B is added to the experimental group, the candidate time-consuming function B is not the actual time-consuming function, and the candidate time-consuming function B is not regarded as the actual time-consuming function.
[0063] The technical solution of the embodiment of the present disclosure determines the candidate time-consuming function of the candidate logic branch code by analyzing the code difference analysis result, and the candidate logic branch code is the candidate code with at least two logic branches that causes indicator degradation; executes each logic branch in the candidate logic branch code to determine the timing information of the candidate time-consuming function in each logic branch; based on each of the timing information, determines the actual time-consuming function in the candidate time-consuming function, which solves the technical problem that the degradation problem of multiple logic branches is difficult to discover and attribute. By statically analyzing the candidate time-consuming function, and then dynamically determining the timing information of the candidate time-consuming function, and then analyzing the actual time-consuming function, the determination of the actual time-consuming function in the submitted code is realized, that is, the attribution of the code degradation problem with at least two logic branches is realized.
[0064] Figure 3 is a flow chart of another method for determining a time-consuming function provided by an embodiment of the present disclosure. This embodiment further illustrates determining a candidate time-consuming function. This embodiment includes the following steps:
[0065] S310: Analyze the code difference analysis results to determine candidate logic branch codes.
[0066] This operation analyzes the code difference analysis results to determine the candidate logic branch code in the code submitted this time. The candidate logic branch code may be a newly added code with at least two logic branches that is suspected of causing indicator degradation.
[0067] In the determination process, this operation can determine the candidate logic branch code based on the annotations used to modify the class in the code difference analysis result. It can also be combined with whether the code with at least two logic branches affects the scene to further determine whether it is a candidate logic branch code.
[0068] In one embodiment, the code with at least two logic branches affecting the scenario may be determined first, and then it may be determined whether the code with at least two logic branches affecting the scenario is newly added or modified, and if so, it may be used as a candidate logic analysis code.
[0069] In one embodiment, the newly added or modified code with at least two logic branches may be determined first, and then it may be determined whether the newly added or modified code with at least two logic branches affects the scenario, and if so, it may be used as a candidate logic branch code.
[0070] S320: Determine candidate time-consuming functions in the candidate logic branch code.
[0071] This step can analyze all functions or affected functions in the candidate logic branch code, such as analyzing whether the function directly or indirectly includes time-consuming features. Direct inclusion of time-consuming features can be considered as time-consuming features directly in the function. Indirect inclusion of time-consuming features can be considered as time-consuming features introduced into functions directly or indirectly called by the function.
[0072] The functions affected by the candidate logic branch code may include functions newly added in the candidate logic branch code, and the means of adding are not limited here, such as being determined by corresponding annotation information or by corresponding benchmark comparison.
[0073] S330: Execute each logic branch in the candidate logic branch code, and determine the time-consuming information of the candidate time-consuming function in each logic branch.
[0074] S340: Determine an actual time-consuming function among the candidate time-consuming functions based on each piece of time-consuming information.
[0075] This embodiment further describes the operation of determining candidate time-consuming functions. In the process of determining candidate time-consuming functions, candidate logical branches are first determined, and then candidate time-consuming functions in the candidate logical branches are determined. Through hierarchical filtering and screening, static analysis results, i.e., candidate time-consuming functions, are determined, providing an accurate data basis for subsequent dynamic analysis.
[0076] Based on the above embodiment, a variant embodiment of the above embodiment is proposed. It should be noted that in order to make the description concise, only the differences from the above embodiment are described in the variant embodiment.
[0077] In one embodiment, analyzing the code difference analysis results to determine the candidate logic branch codes includes:
[0078] Determine whether there is newly added or modified code with at least two logical branches in the code difference analysis result;
[0079] If so, determine whether the newly added or modified code with at least two logical branches is associated with the scenario;
[0080] If so, the newly added or modified code with at least two logic branches of the associated scenario is determined as a candidate logic branch code.
[0081] When determining the candidate logic branch code, this embodiment first determines whether there is a newly added or modified code with at least two logic branches in the code difference analysis results, and then performs subsequent analysis on the newly added or modified code with at least two logic branches. Among them, the newly added or modified code with at least two logic branches can be determined by the modification data of the class. The code with at least two logic branches can be identified by identification information, such as the class of each AB experiment plus the annotation of the AB experiment. Determine whether there is a newly added or modified code with at least two logic branches by the change of the identification information.
[0082] In this embodiment, whether the newly added or modified code with at least two logical branches is associated with the scene can be determined by the method set corresponding to the scene. If the class of the newly added or modified code with at least two logical branches is included in the method set corresponding to the scene, it can be considered that the newly added or modified code with at least two logical branches is associated with the scene, that is, the newly added or modified code with at least two logical branches will affect the scene and will cause time consumption of the scene.
[0083] In this embodiment, a newly added or modified code with at least two logic branches associated with a scenario may be determined as a candidate logic branch code.
[0084] In one embodiment, determining whether there is newly added or modified code with at least two logical branches in the code difference analysis result includes:
[0085] Determine whether there is a newly added class modified by the identification information in the code difference analysis result, and if so, determine that the code with at least two logical branches corresponding to the newly added class modified by the identification information is the newly added code with at least two logical branches, and the class modified by the identification information is the class of the code with at least two logical branches;
[0086] Determine whether there is a class modified by the identification information of the call point modification in the code difference analysis result. If so, determine that the code with at least two logical branches corresponding to the class modified by the identification information of the call point modification is the modified code with at least two logical branches.
[0087] This embodiment further illustrates the means for determining whether there is a newly added or modified code with at least two logical branches. For the newly added code with at least two logical branches, determine whether there is a newly added class modified with identification information in the code difference analysis result. The code difference analysis result will include the difference between the code submitted this time and the code before modification. Based on the difference, it can be determined whether there is an added class modified with identification information. If there is a newly added @ABKey modified class in MR, it can be explained that there is a newly added AB experiment, that is, the code with at least two logical branches corresponding to the newly added class modified with identification information is determined as the newly added code with at least two logical branches. Each class of code with at least two logical branches corresponds to an annotation of the code with at least two logical branches (such as can be added by the developer in the code writing stage, or automatically added, here is not limited to the automatic adding means, it can be to analyze the code first, and then automatically added after analysis), which is used to determine whether it is a newly added code with at least two logical branches. The newly added class modified with identification information can be considered as a newly added class modified with identification information.
[0088] For the modified code with at least two logical branches, this embodiment may consider call point modification. If the call point of the code with at least two logical branches is changed or refactored, traces will be left on the code modification. For example, it can be determined through identification information, and all AB experiment information, such as class adjustment and call point migration, can be determined through identification information.
[0089] If it is determined from the code difference analysis result that there is a class modified with identification information with a call point modification, it can be considered that there is a modified code with at least two logical branches. The class modified with identification information with a call point modification can be considered as a class modified with a call point modification and with identification information.
[0090] Figure 4 This is a schematic diagram of a call point modification scenario of an AB experiment provided by an embodiment of the present disclosure; before the code is modified, method A calls method B and class AB (corresponding to the class modified with identification information), that is, AB class. After the code is modified, the AB experiment is called by method C, and method C also calls method D. Figure 4 It can be seen that class AB is called by method C instead of method A, and the AB delay corresponding to class AB is migrated to the new usage point, namely method C.
[0091] In one embodiment, determining whether the newly added or modified code having at least two logical branches is associated with a scene includes:
[0092] Determining whether a newly added or modified class of code having at least two logical branches is included in a method set of the scenario;
[0093] If so, the code having at least two logic branches is determined as a candidate logic branch code.
[0094] In this embodiment, the newly added or modified class of code with at least two logical branches is matched with the method set of the scene. If the newly added or modified class of code with at least two logical branches is included in the method set of the scene, the newly added or modified class of code with at least two logical branches can be considered as a candidate logical branch code.
[0095] In this embodiment, there is no limitation on the scene, and the scene may be all scenes in the application or a scene set in the application. The set scene is not limited and may be determined according to actual conditions.
[0096] The application may be the application to which the submitted code is applied, and the scene may be a startup scene.
[0097] Different scenarios may correspond to different method sets. For example, in the startup scenario, if multiple methods are used to start an application, the set of multiple methods can be considered as the method set of the scenario.
[0098] If a newly added or modified class of code with at least two logical branches is included in the method set of the scene, it can be considered that the newly added or modified code with at least two logical branches may cause indicator degradation to the scene. Whether it will actually cause indicator degradation will be determined through dynamic analysis.
[0099] If the newly added or modified AB experiment class in the modified code directly or indirectly appears in the scene's method set, it can be considered that the newly added or modified AB experiment will have an impact on the scene. Directly, it can be considered as adding an AB experiment directly to the scene method. Indirectly, it can be considered as adding a method D to the scene method and calling the AB experiment in method D.
[0100] Figure 5 Schematic diagram of a scenario directly affected by an AB experiment provided by an embodiment of the present disclosure. Figure 5 For the startup scenario, there is a startup scenario method, such as the additional basic context method. The startup scenario method calls method B, method C and the newly added AB experiment. The AB experiment further calls method E and method F. Figure 5The scenario shown is that the addition of AB experiments directly affects the startup scenario. In the startup scenario, a new AB experiment introduces a time-consuming method, which directly affects the page for the first time.
[0101] Figure 6 It is a schematic diagram of an indirect impact scenario of an AB experiment provided by an embodiment of the present disclosure. Figure 6 It shows that method D is added in the startup scenario method, and method D calls the AB experiment, which reflects the indirect addition of the AB experiment.
[0102] In one embodiment, determining the candidate time-consuming function in the candidate logic branch code includes:
[0103] Determine the method corresponding to the candidate logic branch code;
[0104] For each of the included methods, determine layer by layer whether the calling link of the method includes a time-consuming feature, and if so, determine the method as a candidate time-consuming function.
[0105] This embodiment further illustrates the operation of determining the candidate time-consuming function, that is, determining whether the AB experiment adds a new time-consuming function. The method corresponding to the candidate logic branch code can be a method newly added to the candidate logic branch, a method included, or a method affected. The newly added method can be determined by the code difference analysis results, and the affected method and the included method can be determined by the call graph of the candidate logic branch code. The method called by multiple logic branches is determined by the call graph, and then the affected method and the included method are analyzed. Among them, multiple logic branches can be considered as at least two logic branches.
[0106] For each method in the corresponding method, the call graph of the method can be used to analyze layer by layer whether the method of each node includes time-consuming features. If so, the method is determined as a candidate time-consuming function. Time consumption is transitive. If it is determined that the method includes time-consuming features on the lower-level call link of the method, all methods between the method and the method including the time-consuming features on the call link can be used as candidate time-consuming functions.
[0107] Figure 7 A schematic diagram of a scenario of a candidate time-consuming function provided by an embodiment of the present disclosure. Figure 7 Method B, method C and a newly added method D included in method A are shown. When determining whether method D is a candidate time-consuming function, a call graph of method D can be obtained to determine whether the method called by method D includes a time-consuming feature. If so, method D can be considered a candidate time-consuming function due to the transitivity of time consumption. Figure 7In the example, because method F called by method D calls the time-consuming feature, method D is a candidate time-consuming function, and method F can also be considered a candidate time-consuming function. That is, the newly added method D itself has no time-consuming operation, and is indirectly caused by method F. Therefore, it is necessary to obtain the complete method call path through the call graph, that is, CallGraph static analysis to find all suspected time-consuming operations.
[0108] Time-consuming features can be considered as features that may cause method time consumption, such as locks, loops, and special method calls. Special method calls include IO, Native methods, thread-related, etc. Table 1 is an example table of time-consuming features provided in an embodiment of the present disclosure.
[0109] Table 1 An example table of time-consuming features provided by an embodiment of the present disclosure
[0110]
[0111] Figure 8 It is a call relationship diagram provided by the embodiment of the present disclosure. In addition to analyzing the bytecode instructions, it is also necessary to perform suspected time-consuming analysis on all methods and count which public methods have time-consuming operations. Figure 8 , the App_A method and the App_B method in the App method directly or indirectly call a time-consuming method Android_B in the Android SDK, then the App methods APP_A and APP_B are considered to be time-consuming methods, which further reflects the degraded transitivity.
[0112] Fig. 9 It is a schematic diagram of an analysis flow of a candidate time-consuming function provided by an embodiment of the present disclosure. Fig. 9 It is a specific flow chart of the static time analysis service analysis. It relies on the reachability analysis tool to build the new method affected by the AB experiment. The CallGraph of this method serves as the basis for the static time analysis. The static time analysis tool analyzes the functions on the call link of the new method of the AB experiment layer by layer to see if they hit the time-consuming features. If they do, the corresponding function will be marked as a suspected time-consuming function, i.e., a candidate time-consuming function. Finally, the results are organized into a static time analysis report, which mainly involves the modification of the indicator path method and the newly added time-consuming method.
[0113] In one embodiment, executing each logic branch in the candidate logic branch code and determining the time-consuming information of the candidate time-consuming function in each logic branch includes:
[0114] Solidify network variables through network proxy tools;
[0115] The code of the degraded scenario in each logic branch of the candidate logic branch code is run to determine the time consumption information of the candidate time-consuming function in each logic branch.
[0116] Since an MR will undergo multiple modifications during the period from creation to merging, the degradation analysis of AB experiments will be triggered multiple times. In order to eliminate the interference of other experiments on the testing of AB experiments, it is necessary to ensure that the status of other AB experiments is consistent during each degradation analysis except for the AB experiment to be analyzed. Therefore, it is necessary to use network proxy tools such as MitmProxy to implement network solidification of experiments (i.e., Chinese painting network variables) to ensure that there is only one variable of concern, the AB experiment.
[0117] The network variables may be variables in the network, such as AB experiments other than the AB experiment to be analyzed, and the solidified network variables may also include a lock screen and a lock core.
[0118] This embodiment makes the environment of multiple operations consistent by solidifying network variables. The network proxy tool can be considered as a tool for implementing network variable solidification. The network proxy tool can implement forced execution of multiple logical branches by adjusting network variables, that is, mockAB experiment (simulated AB experiment).
[0119] The degradation scenario can be considered as a scenario associated with the candidate logic branch code determination process, which may cause degradation.
[0120] In this embodiment, during dynamic operation, the dynamic task of the degraded scenario is run, that is, the code of the degraded scenario is run on a real machine, and then the time consumption information of the candidate time-consuming function is determined. The dynamic task can be a task in the degraded scenario, and the specific task content can be determined based on the scenario.
[0121] Although static analysis can be used to discover all potential new degraded time-consuming functions (i.e., candidate time-consuming functions) from a global perspective. However, performance analysis is different from stability analysis. Code rationality cannot be analyzed simply from the source code level. Clear function time consumption is also required to prove function degradation. If there is only tracking (i.e., trace) information of the control group, such as dynamic data, then the time-consuming functions newly added to the experimental group will definitely escape. In this embodiment, the trace information of both the experimental group and the control group is determined, so the time consumption information of the potential new degraded functions can be completed. Fig.10 It is a schematic diagram of an attribution scenario provided by an embodiment of the present disclosure. Fig.10 It is shown that through the comparison of tracking information, it is found that a new time-consuming function method G is added to the tracking information of the experimental group. That is, a new time-consuming method G is added to the AB experiment added to the experimental group. It can be considered that there is no new time-consuming method in the new AB experiment of the control group.
[0122] The time-consuming function determination method provided in this disclosure can be considered as a technical solution for preventing AB experiment performance degradation at the MR stage. For AB experiment degradation prevention at the MR level, it is necessary to know in which scenarios AB experiments are added or modified. From the perspective of static analysis, it can be broken down into the following three questions:
[0123] Whether AB experiments are newly added or modified in MR (i.e., whether there are newly added or modified codes with at least two logical branches in the code difference analysis results);
[0124] Whether the AB experiment affects which scenarios (i.e., determine whether the newly added or modified code with at least two logical branches is related to the scenario);
[0125] Whether to add a time-consuming function in the AB experiment (ie, determine whether the candidate logic branch code includes a candidate time-consuming function).
[0126] Regarding whether AB experiments are added or modified in MR, since there are some differences in the code level between adding and modifying AB experiments, the problem is broken down into two angles: adding AB experiments and modifying AB experiments.
[0127] For the processing of newly added AB experiments, you need to find the AB experiments in MR. The specific steps are as follows: add AB experiment annotations to each AB experiment class. After forming this set of specifications, you can know whether the modification of MR involves the addition or deletion of AB experiments. For example, in the example below, as long as there is a new class modified by @ABKey in MR, it means that there is a new AB experiment (that is, determine whether there is a new class modified by identification information in the code difference analysis results. If so, determine that the code with at least two logical branches corresponding to the class modified by the identification information is the new code with at least two logical branches).
[0128] Regarding the modification of AB experiments, this disclosure considers the call point modification scenario: if the AB experiment call point is changed or refactored, this will definitely leave traces in the code modification. At the same time, all the information of the AB experiment can be mastered through the @ABkey annotation, so the modification of the AB class can be accurately located.
[0129] Regarding whether a time-consuming function is added to the AB experiment, we know which AB experiments are added and which scenarios are affected by the AB experiment. The next thing to analyze is whether the new function in the AB experiment is time-consuming.
[0130] Static time analysis is based on bytecode. It can analyze and locate time-consuming functions based on function and instruction calls in the bytecode without running the APP. The source code of the Android App project will eventually be compiled into bytecode. The Android virtual machine supports 200+ bytecode instructions, of which time-consuming instructions are limited. The bytecode instructions can be statically analyzed to determine whether a method is suspected to be time-consuming. If all instructions in a method body are not time-consuming, it means that this method is more likely to be less time-consuming. Similarly, for method call instructions, if the called method is not time-consuming, then the method call instruction is also not time-consuming. That is, determine the method corresponding to the candidate logic branch code; for each method included in the method, determine layer by layer whether the call link of the method includes time-consuming features. If so, determine the method as a candidate time-consuming function; if not, the method is not a candidate time-consuming function.
[0131] The present disclosure covers all execution branches of AB experiments during the dynamic task running process. According to the results of static analysis of AB experiments, during dynamic running, the control group and experimental group of the newly added / modified experiments are forcibly covered (i.e., each logical branch in the candidate logical branch code is executed), and the dynamic data of AB experiments under different groups are obtained (i.e., the time-consuming information of the candidate time-consuming functions in each logical branch is determined). Thus, the time-consuming degradation points of the newly added AB experiments are determined by combining dynamic and static methods, and degradation attribution and consumption are performed.
[0132] Fig.11 is a flowchart of determining a time-consuming function provided by an embodiment of the present disclosure. Fig.11 , in the MR update phase, code difference analysis is performed to obtain code difference analysis results. Then, based on the code difference analysis results, it is determined whether to add or modify the AB experiment, whether the AB experiment will affect the scenario, and whether the AB experiment adds a time-consuming function. If all are true, the candidate logic branch code and the candidate time-consuming function are determined to form a static analysis report. The static analysis report may include the determined candidate logic branch and candidate time-consuming function, so that the static analysis is completed and the dynamic task of the AB experiment is triggered. For example, the control group and all experimental groups, such as experimental group A and experimental group B, are solidified. After the network is solidified, the degradation scenario is dynamically run for each logic branch in turn, so that the dynamic analysis is completed. After running the degradation scenario, an analysis report for each logic branch can be obtained, such as a control group time-consuming function analysis report, a control group A time-consuming function analysis report, and a control group B time-consuming function analysis report. In the analysis report, the candidate time-consuming function in the static analysis report and the corresponding time-consuming information can be mapped, that is, the time-consuming information of each candidate time-consuming function is determined, so as to perform attribution, such as comparing each analysis report to determine the newly added time-consuming function of the experimental group and the control group, that is, the actual time-consuming function.
[0133] The following is a summary of the process of determining the time-consuming function:
[0134] Static analysis: When a user submits a MR, the static analysis service is triggered to find new / modified AB experiments (i.e. candidate logic branch codes) that may cause indicator degradation:
[0135] Trigger the static time-consuming analysis service to analyze whether the MR modification has a degraded function, i.e., a time-consuming function, through pre-designed static time-consuming rules (such as determining the method corresponding to the candidate logic branch code; for each method included in the method, determining layer by layer whether the call link of the method includes a time-consuming feature, and if so, determining the method as a candidate time-consuming function);
[0136] Determine the newly added AB experiments, and determine whether the AB experiments will affect the core indicators in combination with the indicator path collection service (that is, determine whether there is any new or modified code with at least two logical branches in the code difference analysis results; if so, determine whether the new or modified code with at least two logical branches is related to the scenario).
[0137] Dynamic analysis: When static analysis finds that a certain scenario has a new AB experiment and there are suspected new time-consuming functions, a dynamic anti-degradation test will be triggered to obtain the actual degradation time of the MR modified code.
[0138] First, solidify through AB experiments (that is, solidify network variables through network proxy tools) to ensure that all experiments are consistent and control variables to the greatest extent.
[0139] Then, according to the scenarios affected by the AB experiment, the logic branches of the experimental group and the control group of the AB experiment are triggered respectively through the MockAB experiment, so as to execute dynamic tasks for the affected core scenarios respectively. That is, the dynamic tasks of the degraded scenarios in each logic branch of the candidate logic branch code are run to determine the time consumption information of the candidate time-consuming functions in each logic branch.
[0140] Degradation attribution: Use the combined dynamic and static attribution service capabilities to determine whether the newly added AB experiment introduces effective degradation (i.e., based on each of the time-consuming information, determine the actual time-consuming function in the candidate time-consuming functions). If effective, notify the relevant objects.
[0141] For example, after static analysis, it is determined which time-consuming functions have been added, but whether the newly added time-consuming functions are time-consuming requires dynamic analysis to determine. Dynamic analysis is used to determine the specific time consumption of the newly added time-consuming functions, that is, the time consumption information. Based on the value of the time consumption, it can be determined whether the time-consuming function is really time-consuming. For example, a time-consuming function with a value greater than a certain value is determined to be an actual time-consuming function. The attribution operation includes establishing a mapping relationship between the static analysis report and the report generated by the dynamic analysis.
[0142] The time-consuming function determination method provided by the present disclosure locates and discovers the AB experiment that causes performance degradation by combining dynamic operation and static analysis. The degradation is located in a specific function (ie, the actual time-consuming function), and the attribution is more accurate.
[0143] Fig.12 is a schematic diagram of the structure of a time-consuming function determination device provided by an embodiment of the present disclosure, such as Fig.12 As shown, the device comprises:
[0144] An analysis module 1210 is used to analyze the code difference analysis result and determine a candidate time-consuming function of a candidate logic branch code, where the candidate logic branch code is a candidate code with at least two logic branches that causes indicator degradation;
[0145] The time-consuming information determining module 1220 is used to execute each logic branch in the candidate logic branch code and determine the time-consuming information of the candidate time-consuming function in each logic branch;
[0146] The time-consuming function determination module 1230 is used to determine the actual time-consuming function among the candidate time-consuming functions based on each of the time-consuming information.
[0147] The technical solution provided by the embodiments of the present disclosure solves the technical problem that it is difficult to discover and attribute the degradation problem of multiple logical branches. By statically analyzing the candidate time-consuming functions, and then dynamically determining the timing information of the candidate time-consuming functions, and then analyzing the actual time-consuming functions, the determination of the actual time-consuming functions in the submitted code is achieved, that is, the attribution of the degradation problem of the code with at least two logical branches is achieved.
[0148] The time-consuming function determination device provided in the embodiments of the present disclosure can execute the time-consuming function determination method provided in any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.
[0149] In one embodiment, the analysis module 1210 includes:
[0150] A first determination unit, configured to analyze the code difference analysis result and determine a candidate logic branch code;
[0151] The second determining unit is used to determine a candidate time-consuming function in the candidate logic branch code.
[0152] In one embodiment, the first determining unit includes:
[0153] A first determination subunit is used to determine whether there is a newly added or modified code with at least two logical branches in the code difference analysis result;
[0154] a second determining subunit, configured to, if yes, determine whether the newly added or modified code having at least two logical branches is associated with a scenario;
[0155] The third determining subunit is configured to determine, if yes, the newly added or modified code with at least two logic branches of the associated scenario as a candidate logic branch code.
[0156] In one embodiment, the first determining subunit is specifically configured to:
[0157] Determine whether there is a newly added class modified by the identification information in the code difference analysis result, and if so, determine that the code with at least two logical branches corresponding to the class modified by the identification information is the newly added code with at least two logical branches, and the class modified by the identification information is the class of the code with at least two logical branches;
[0158] Determine whether there is a class modified by the identification information with call point modification in the code difference analysis result, and if so, determine that the code with at least two logical branches corresponding to the class is the modified code with at least two logical branches.
[0159] In one embodiment, the second determining subunit is specifically configured to:
[0160] Determining whether a newly added or modified class of code having at least two logical branches is included in a method set of the scenario;
[0161] If so, the code having at least two logic branches is determined as a candidate logic branch code.
[0162] In one embodiment, the second determining unit is specifically configured to:
[0163] Determine the method corresponding to the candidate logic branch code;
[0164] For each of the included methods, it is determined layer by layer whether the calling link of the method includes a time-consuming feature. If so, the method is determined as a candidate time-consuming function.
[0165] In one embodiment, the time consumption information determination module 1220 is specifically used to:
[0166] Solidify network variables through network proxy tools;
[0167] The code of the degraded scenario in each logic branch of the candidate logic branch code is run to determine the time consumption information of the candidate time-consuming function in each logic branch.
[0168] It is worth noting that the various units and modules included in the above-mentioned device are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the embodiments of the present disclosure.
[0169] Fig.13 Schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure. Fig.13 , which shows an electronic device (eg, Fig.13 A schematic diagram of the structure of a terminal device or server) 500.
[0170] The electronic device 500 includes:
[0171] One or more processing devices 501;
[0172] The storage device 508 is used to store one or more programs.
[0173] When the one or more programs are executed by the one or more processing devices 501 , the one or more processing devices 501 implement the time-consuming function determination method provided by the present disclosure.
[0174] The terminal devices in the embodiments of the present disclosure may include but are not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., as well as fixed terminals such as digital TVs, desktop computers, etc. Fig.13 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.
[0175] like Fig.13 As 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 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic device 500 are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An edit / output (I / O) interface 505 is also connected to the bus 504.
[0176] Typically, the following devices may be connected to the I / O interface 505: an input device 506 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 507 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 508 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 509. The communication device 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. Although Fig.13 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.
[0177] 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 non-transitory 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.
[0178] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0179] The electronic device provided by the embodiment of the present disclosure and the time-consuming function determination method provided by the above embodiment belong to the same inventive concept. The technical details not fully described in this embodiment can be referred to the above embodiment, and this embodiment has the same beneficial effects as the above embodiment.
[0180] An embodiment of the present disclosure provides a computer storage medium on which a computer program is stored. When the program is executed by a processor, the method for determining a time-consuming function provided in the above embodiment is implemented.
[0181] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the two.
[0182] The computer storage medium may be a storage medium of computer executable instructions, which, when executed by a computer processor, are used to perform the methods provided by the present disclosure.
[0183] Computer readable storage media may be, for example, but not limited to: electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any combination thereof. 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 thereof. 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. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A 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 used by or in combination with an instruction execution system, device, or device. The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to: wire, optical cable, RF (radio frequency), etc., or any suitable combination of the foregoing.
[0184] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0185] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0186] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device:
[0187] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: analyzes the code difference analysis result to determine a candidate time-consuming function of a candidate logic branch code, wherein the candidate logic branch code is a candidate code having at least two logic branches that causes index degradation;
[0188] Execute each logic branch in the candidate logic branch code, and determine the time consumption information of the candidate time-consuming function in each logic branch;
[0189] Based on each of the time-consuming information, an actual time-consuming function among the candidate time-consuming functions is determined.
[0190] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or combinations thereof, including, but not limited to, 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 a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through 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).
[0191] 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.
[0192] The modules or units involved in the embodiments described in the present disclosure may be implemented by software or hardware. The name of a module or unit does not, in some cases, constitute a limitation on the unit itself. For example, an analysis module may also be described as a "code difference analysis result analysis module".
[0193] 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.
[0194] 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.
[0195] According to one or more embodiments of the present disclosure, [Example 1] provides a method for determining a time-consuming function, including:
[0196] Analyze the code difference analysis result to determine the candidate time-consuming function of the candidate logic branch code, wherein the candidate logic branch code is a candidate code with at least two logic branches that causes indicator degradation;
[0197] Execute each logic branch in the candidate logic branch code, and determine the time consumption information of the candidate time-consuming function in each logic branch;
[0198] Based on each of the time-consuming information, an actual time-consuming function among the candidate time-consuming functions is determined.
[0199] According to one or more embodiments of the present disclosure, [Example 2] provides the method described in Example 1, wherein analyzing the code difference analysis results to determine the candidate time-consuming functions of the candidate logic branch code includes:
[0200] Analyze the code difference analysis results to determine the candidate logic branch codes;
[0201] Determine candidate time-consuming functions in the candidate logic branch code.
[0202] According to one or more embodiments of the present disclosure, [Example 3] provides the method described in Example 2, wherein analyzing the code difference analysis result to determine the candidate logic branch code includes:
[0203] Determine whether there is newly added or modified code with at least two logical branches in the code difference analysis result;
[0204] If so, determine whether the newly added or modified code with at least two logical branches is associated with the scenario;
[0205] If so, the newly added or modified code with at least two logic branches of the associated scenario is determined as a candidate logic branch code.
[0206] According to one or more embodiments of the present disclosure, [Example 4] provides the method described in Example 3, wherein determining whether there is newly added or modified code with at least two logical branches in the code difference analysis result includes:
[0207] Determine whether there is a newly added class modified by the identification information in the code difference analysis result, and if so, determine that the code with at least two logical branches corresponding to the class modified by the identification information is the newly added code with at least two logical branches, and the class modified by the identification information is the class of the code with at least two logical branches;
[0208] Determine whether there is a class modified by the identification information with call point modification in the code difference analysis result, and if so, determine that the code with at least two logical branches corresponding to the class is the modified code with at least two logical branches.
[0209] According to one or more embodiments of the present disclosure, [Example 5] provides the method described in Example 3, wherein determining whether the newly added or modified code having at least two logical branches is associated with a scenario includes:
[0210] Determining whether a newly added or modified class of code having at least two logical branches is included in a method set of the scenario;
[0211] If so, the code having at least two logic branches is determined as a candidate logic branch code.
[0212] According to one or more embodiments of the present disclosure, [Example 6] provides the method described in Example 2, wherein determining the candidate time-consuming function in the candidate logic branch code includes:
[0213] Determine the method corresponding to the candidate logic branch code;
[0214] For each of the included methods, it is determined layer by layer whether the calling link of the method includes a time-consuming feature. If so, the method is determined as a candidate time-consuming function.
[0215] According to one or more embodiments of the present disclosure, [Example 7] provides the method described in Example 1, wherein executing each logic branch in the candidate logic branch code and determining the time-consuming information of the candidate time-consuming function in each logic branch includes:
[0216] Solidify network variables through network proxy tools;
[0217] The code of the degraded scenario in each logic branch of the candidate logic branch code is run to determine the time consumption information of the candidate time-consuming function in each logic branch.
[0218] According to one or more embodiments of the present disclosure, [Example 8] provides an example of a time-consuming function determination device, including:
[0219] An analysis module, used to analyze the code difference analysis result and determine a candidate time-consuming function of a candidate logic branch code, wherein the candidate logic branch code is a candidate code having at least two logic branches that causes indicator degradation;
[0220] A time-consuming information determination module, used to execute each logic branch in the candidate logic branch code and determine the time-consuming information of the candidate time-consuming function in each logic branch;
[0221] The time-consuming function determination module is used to determine the actual time-consuming function among the candidate time-consuming functions based on each of the time-consuming information.
[0222] According to one or more embodiments of the present disclosure, [Example 9] provides an example of an electronic device, the electronic device comprising:
[0223] one or more processing devices;
[0224] a storage device for storing one or more programs,
[0225] When the one or more programs are executed by the one or more processing devices, the one or more processing devices implement the time-consuming function determination method as described in any one of Examples 1-7.
[0226] According to one or more embodiments of the present disclosure, [Example 10] provides an example of a storage medium containing computer executable instructions, which, when executed by a computer processor, are used to execute a time-consuming function determination method as described in any one of Examples 1-7.
[0227] 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.
[0228] 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.
[0229] 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. A method for determining a time-consuming function, characterized in that: include: Analyze the code difference analysis result to determine the candidate time-consuming function of the candidate logic branch code, wherein the candidate logic branch code is a candidate code with at least two logic branches that causes indicator degradation; Execute each logic branch in the candidate logic branch code, and determine the time consumption information of the candidate time-consuming function in each logic branch; Based on each of the time-consuming information, an actual time-consuming function among the candidate time-consuming functions is determined.
2. The method according to claim 1, characterized in that The step of analyzing the code difference analysis results to determine the candidate time-consuming functions of the candidate logic branch codes includes: Analyze the code difference analysis results to determine the candidate logic branch codes; Determine candidate time-consuming functions in the candidate logic branch code.
3. The method according to claim 2, characterized in that The step of analyzing the code difference analysis result to determine the candidate logic branch code includes: Determine whether there is newly added or modified code with at least two logical branches in the code difference analysis result; If so, determine whether the newly added or modified code with at least two logical branches is associated with the scenario; If so, the newly added or modified code with at least two logic branches of the associated scenario is determined as a candidate logic branch code.
4. The method according to claim 3, characterized in that The determining whether there is newly added or modified code with at least two logical branches in the code difference analysis result includes: Determine whether there is a newly added class modified by the identification information in the code difference analysis result, and if so, determine that the code with at least two logical branches corresponding to the class modified by the identification information is the newly added code with at least two logical branches, and the class modified by the identification information is the class of the code with at least two logical branches; Determine whether there is a class modified by the identification information with call point modification in the code difference analysis result, and if so, determine that the code with at least two logical branches corresponding to the class is the modified code with at least two logical branches.
5. The method according to claim 3, characterized in that: The determining whether the newly added or modified code having at least two logic branches is associated with a scene includes: Determining whether a newly added or modified class of code having at least two logical branches is included in a method set of the scenario; If so, the code having at least two logic branches is determined as a candidate logic branch code.
6. The method according to claim 2, characterized in that The determining of the candidate time-consuming functions in the candidate logic branch code includes: Determine the method corresponding to the candidate logic branch code; For each of the included methods, determine layer by layer whether the calling link of the method includes a time-consuming feature, and if so, determine the method as a candidate time-consuming function.
7. The method according to claim 1, characterized in that The executing each logic branch in the candidate logic branch code and determining the time-consuming information of the candidate time-consuming function in each logic branch includes: Solidify network variables through network proxy tools; The code of the degraded scenario in each logic branch of the candidate logic branch code is run to determine the time consumption information of the candidate time-consuming function in each logic branch.
8. A time-consuming function determination device, characterized in that: include: An analysis module, used to analyze the code difference analysis result and determine a candidate time-consuming function of a candidate logic branch code, wherein the candidate logic branch code is a candidate code having at least two logic branches that causes indicator degradation; A time-consuming information determination module, used to execute each logic branch in the candidate logic branch code and determine the time-consuming information of the candidate time-consuming function in each logic branch; The time-consuming function determination module is used to determine the actual time-consuming function among the candidate time-consuming functions based on each of the time-consuming information.
9. An electronic device, characterized in that: The electronic device comprises: one or more processing devices; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processing devices, the one or more processing devices implement the time-consuming function determination method as described in any one of claims 1-7.
10. A storage medium comprising computer executable instructions, wherein the computer executable instructions are used to perform the method for determining a time-consuming function as claimed in any one of claims 1 to 7 when executed by a computer processor.