Data processing method and device, equipment and storage medium

CN115712565BActive Publication Date: 2026-08-07ALIBABA (CHINA) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ALIBABA (CHINA) CO LTD
Filing Date
2022-11-10
Publication Date
2026-08-07

AI Technical Summary

Technical Problem

该方法的追踪精度高,但存在追踪成本高、追踪时间长的问题,影响了系统性能

Benefits of technology

[0016] In this embodiment, by obtaining the IR control flow graph of the target software source code after execution and the execution frequency of functions in the IR control flow graph, a target optimization function with a set of tracking functions as independent variables and the constraints of the target optimization function are generated based on the basic block information and function execution frequencies in the IR control flow graph. Finally, based on the constraints, the target optimization function is solved using the Max-Min Ant System (MMAS) algorithm to obtain the target tracking function set in the IR control flow graph. In this technical solution, the target tracking function set obtained by solving the target optimization function using the MMAS algorithm can, while satisfying the constraints, maximize tracking accuracy, reduce tracking cost and tracking time, thereby minimizing the impact on system performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115712565B_ABST
    Figure CN115712565B_ABST
Patent Text Reader

Abstract

The application provides a data processing method and device, equipment and a storage medium, and relates to the technical field of computers. The method comprises the following steps: obtaining an IR control flow graph after a target software source code is run and the execution frequency of functions in the IR control flow graph; generating a target optimization function with a function set for tracing as an independent variable and a constraint condition of the target optimization function according to the basic block information in the IR control flow graph and the execution frequency of the functions; solving the target optimization function by using a Max-Min Ant System (MMAS) algorithm based on the constraint condition to obtain a target function set for tracing in the IR control flow graph. In the technical solution, the target function set for tracing obtained by solving the target optimization function by using the MMAS algorithm can improve the tracing accuracy and reduce the tracing cost as much as possible under the condition of meeting the constraint condition, thereby reducing the influence on the system performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a data processing method, apparatus, device, and storage medium. Background Technology

[0002] With the rapid development of computer technology, software systems are becoming increasingly larger and their processing logic more complex. To ensure system stability, system logs can be relied upon as a basis for fault diagnosis. However, if the system logs do not record valid error information, it will affect the efficiency of fault diagnosis, potentially leading to significant economic losses.

[0003] Dynamic tracing, as a technique for acquiring information about software execution, allows for the acquisition of finer-grained software runtime information without halting the target software. Therefore, function-level dynamic tracing is a common method for fault diagnosis in target software. This method dynamically traces all functions defined in the target software and constructs a function call tree. It determines whether the target software has malfunctioned by comparing the runtime-constructed function call tree with the function call tree collected under normal conditions. If they match, the first different function is found through preorder traversal and identified as the faulty function. This method offers high tracing accuracy but suffers from high tracing costs and long tracing times, impacting system performance. Summary of the Invention

[0004] This application provides a data processing method, apparatus, device, and storage medium to balance tracking accuracy, tracking cost, and tracking time during function tracing, thereby reducing the impact on system performance.

[0005] Firstly, this application provides a data processing method, including:

[0006] Obtain the intermediate representation IR control flow graph of the target software source code and the execution frequency of functions in the IR control flow graph, wherein the functions cover at least one basic block in the IR control flow graph;

[0007] Based on the basic block information in the IR control flow graph and the execution frequency of the function, a target optimization function with the set of tracking functions as independent variables and the constraints of the target optimization function are generated.

[0008] Based on the constraints, the objective optimization function is solved using the Max Minimum Ant Colony System (MMAS) algorithm to obtain the set of objective tracking functions in the IR control flow graph.

[0009] Secondly, this application provides a data processing apparatus, comprising:

[0010] The acquisition module is used to acquire the intermediate representation IR control flow graph of the target software source code and the execution frequency of the functions in the IR control flow graph, wherein the functions cover at least one basic block in the IR control flow graph;

[0011] The generation module is used to generate a target optimization function with the set of tracking functions as independent variables and the constraints of the target optimization function based on the basic block information in the IR control flow graph and the execution frequency of the function;

[0012] The processing module is used to solve the objective optimization function based on the constraints using the Max Minimum Ant Colony System (MMAS) algorithm, and obtain the set of objective tracking functions in the IR control flow graph.

[0013] Thirdly, this application provides an electronic device including a processor for invoking a computer program (also referred to as code or instructions) to cause the electronic device to perform the method described in the first aspect.

[0014] Fourthly, this application provides a computer-readable storage medium including a computer program that, when executed by a processor, causes the processor to perform the method described in the first aspect.

[0015] Fifthly, this application provides a computer program product, comprising: a computer program (also referred to as code or instructions) that, when run by a processor, causes the processor to perform the method described in the first aspect.

[0016] In this embodiment, by obtaining the IR control flow graph of the target software source code after execution and the execution frequency of functions in the IR control flow graph, a target optimization function with a set of tracking functions as independent variables and the constraints of the target optimization function are generated based on the basic block information and function execution frequencies in the IR control flow graph. Finally, based on the constraints, the target optimization function is solved using the Max-Min Ant System (MMAS) algorithm to obtain the target tracking function set in the IR control flow graph. In this technical solution, the target tracking function set obtained by solving the target optimization function using the MMAS algorithm can, while satisfying the constraints, maximize tracking accuracy, reduce tracking cost and tracking time, thereby minimizing the impact on system performance. Attached Figure Description

[0017] Figure 1 This is a schematic diagram illustrating an application scenario applicable to an embodiment of this application;

[0018] Figure 2 A flowchart illustrating the data processing method provided in the first embodiment of this application;

[0019] Figure 3 This is a schematic diagram of an IR control flow graph;

[0020] Figure 4 A schematic flowchart illustrating the data processing method provided in the second embodiment of this application;

[0021] Figure 5 A schematic flowchart illustrating the data processing method provided in the third embodiment of this application;

[0022] Figure 6 A schematic flowchart illustrating the data processing method provided in the fourth embodiment of this application;

[0023] Figure 7 A schematic block diagram of a data processing apparatus provided in the embodiments of this application;

[0024] Figure 8 A schematic block diagram of an electronic device provided in an embodiment of this application. Detailed Implementation

[0025] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.

[0026] Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

[0027] In the embodiments of this application, the terms "first," "second," etc., are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. Furthermore, the term "comprising" and any variations thereof are intended to cover non-exclusive inclusion.

[0028] The following is a brief explanation of the relevant terms used in the embodiments of this application.

[0029] 1. Dynamic tracking: A technology that can collect software running status information in a customized way without stopping the normal operation of the target software.

[0030] 2. Intermediate Representation (IR): The intermediate representation of source code between the source code and the generated target code when the source code is run by the compiler.

[0031] 3. Basic Block: A sequence of statements executed sequentially within a program. It has only one entry point and one exit point. The entry point is the first statement of the basic block, and the exit point is the last statement of the basic block. Execution of a basic block begins only at its entry point and ends only at its exit point.

[0032] 4. Control Flow Graph (CFG): An abstract representation of a process or program, it is an abstract data structure used in the compiler and maintained internally. It represents all paths traversed during program execution. It uses a graph to represent the possible flow of all basic blocks within a process and can also reflect the real-time execution process of a process.

[0033] 5. Ant colony system: A system for solving non-deterministic polynomial (NP) problems that mimics the behavior of ant colonies.

[0034] With the rapid development of computer technology, software systems are becoming increasingly larger and their processing logic more complex, while people have increasingly higher requirements for the reliability of computer systems. Therefore, timely detection and diagnosis of system faults are crucial to improving system reliability.

[0035] Currently, logs are the most commonly used analytical basis for fault diagnosis. Once a system problem occurs, operations and maintenance personnel will usually check the system logs first, and then diagnose the fault manually or using tools. However, since logs are subjectively designed by developers and are not easily dynamically modified during operation, if the logs fail to record valid error information or do not contain error information, it will affect the efficiency of fault diagnosis and may cause huge economic losses.

[0036] To address the aforementioned issues, a dynamic tracking technology has been introduced. As a technique for acquiring information about the software's execution process, it can acquire more granular software operation information without stopping the target software, thereby improving fault diagnosis efficiency.

[0037] Currently, dynamic tracing technology can be divided into component-level dynamic tracing and function-level dynamic tracing. Component-level dynamic tracing can collect the operational information of all components in the entire system, i.e., it traces faults on a component-by-component basis. However, it cannot pinpoint the actual fault location, resulting in low fault diagnosis accuracy. Function-level dynamic tracing collects the operational information of functions within components. It offers high precision in tracing, but suffers from high tracing overhead and significant investment in selecting the tracing function.

[0038] Optionally, dynamic tracing techniques include component-level dynamic tracing and function-level dynamic tracing. The following sections describe the applications of component-level dynamic tracing and function-level dynamic tracing in real-world scenarios, as well as the problems that arise during their application:

[0039] For example, a fault diagnosis method based on component-level tracing and pinpoint fault injection works as follows: This method dynamically traces key communication / task management functions within components, such as send(), receive(), and fork(), to construct the execution trajectory between components during request execution. This trajectory is modeled as a function call tree, and fault injection is used to obtain function execution trajectory information under various faults, thus forming a fault diagnosis database. The Gaussian distance (similarity, determining whether they belong to the same class) between the runtime-constructed function call tree and the corresponding function call trees in the fault diagnosis database determines whether a component has failed and performs fault localization. However, this method suffers from a drawback: the construction of the fault diagnosis database requires manual selection of fault points, and the accuracy of fault point selection heavily relies on human testing experience, resulting in low precision in fault point selection.

[0040] A fault diagnosis method based on function-level tracing and tree edit distance analysis: This method dynamically traces all functions defined in the diagnostic target and constructs a function call tree. It compares the runtime-constructed function call tree with the function call tree collected under normal conditions. If they don't match, it uses a preorder traversal to find the first different function in the runtime-constructed function call tree and identifies it as the faulty function. However, this method requires dynamic tracing of all functions defined in the diagnostic target, which leads to high tracing overhead and workload, impacting system performance.

[0041] In view of this, this application provides a data processing method. By obtaining the IR control flow graph of the target software source code after execution and the execution frequency of functions in the IR control flow graph, a target optimization function with a set of tracking functions as independent variables and its constraints are generated based on the basic block information and function execution frequencies in the IR control flow graph. Finally, based on these constraints, the target optimization function is solved using the Max-Min Ant System (MMAS) algorithm to obtain the target tracking function set in the IR control flow graph. In this technical solution, the target tracking function set obtained by solving the target optimization function using the MMAS algorithm can, while satisfying the constraints, maximize tracking accuracy, minimize tracking cost and tracking time, and reduce the impact on system performance.

[0042] For example, Figure 1 This is a schematic diagram illustrating an application scenario applicable to an embodiment of this application. For example... Figure 1As shown, this application scenario may include interconnected terminal device 11 and data processing device 12. The terminal device 11 and data processing device 12 can communicate via wired or wireless means.

[0043] Optionally, when the terminal device 11 and the data processing device 12 communicate wirelessly, the application scenario may also include a network 13, that is, the terminal device 11 and the data processing device 12 can communicate through the network 13.

[0044] For example, terminal device 11 can be a user terminal with a human-computer interaction interface, where researchers can perform software development on the human-computer interaction interface of terminal device 11 to generate target software source code.

[0045] Optionally, the terminal device 11 can send the generated target software source code to the data processing device 12 based on the sending instructions of the R&D personnel, so that the data processing device 12 can execute the program code of the data processing method provided in this application to determine the target tracking function set in the IR control flow graph corresponding to the target software source code.

[0046] Optionally, the terminal device 11 itself can also be used as a data processing device to execute the program code of the data processing method provided in this application, so as to determine the target tracking function set in the IR control flow graph corresponding to the target software source code.

[0047] In practical applications, the data processing device 12 can also display the determined set of target tracking functions (when the data processing device 12 has a human-computer interaction interface) or send it to the terminal device 11 for display. The specific method can be determined according to the actual scenario, which will not be elaborated here.

[0048] Optional, Figure 1 The application scenario shown may also include a data storage device 14, which can communicate with both the terminal device 11 and the data processing device 12 to store data output by the terminal device 11 and / or data output by the data processing device 12.

[0049] It should be noted that the appendix Figure 1 This is merely a schematic diagram illustrating one application scenario applicable to the embodiments of this application. The embodiments of this application do not necessarily represent... Figure 1 The included equipment is not limited, nor is it restricted. Figure 1 The positional relationships between devices are defined, for example, in Figure 1 In this process, there can be multiple terminal devices. The data storage device 14 can be either an external memory or an internal memory, relative to the data processing device 12.

[0050] In practical applications, since both terminal devices and servers are processing devices with data processing capabilities, therefore, the above... Figure 1 The data processing device in the application scenario shown can be implemented through either a terminal device or a server; this embodiment does not limit it.

[0051] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.

[0052] For example, Figure 2 This is a flowchart illustrating the data processing method provided in the first embodiment of this application. The data processing method is applied to... Figure 1 Data processing devices in the application scenarios shown, such as Figure 2 As shown, the data processing method may include the following steps:

[0053] S201. Obtain the IR control flow graph of the target software source code and the execution frequency of the functions in the IR control flow graph.

[0054] This function covers at least one basic block in the IR control flow graph.

[0055] In the embodiments of this application, when the target software source code is loaded into the data processing device, the data processing device can use the deployed compilation tools to compile the target software source code, thereby generating an intermediate representation (IR) corresponding to the target software source code.

[0056] Optionally, the compilation tools deployed in the data processing device may be, for example, clang or LLVM, and this application embodiment does not limit them.

[0057] In the IR (Integrated Flow Graph) of software, each software-defined function can be represented by a series of basic blocks. Each basic block contains a label representing that basic block, a label of the preceding basic block, and the content of the basic block. Therefore, the IR of the target software source code can be represented as an IR control flow graph in the form of basic blocks.

[0058] It is understood that in the embodiments of this application, "function" generally refers to the functions involved in the IR control flow graph, which can be one, two or more, and can be determined according to the actual scenario, which will not be elaborated here.

[0059] In practical applications, in order to determine the set of target tracking functions from the functions included in the IR control flow graph, the function can usually be understood as each or all the functions included in the IR control flow graph, which will not be elaborated here.

[0060] For example, Figure 3 This is a schematic diagram of an IR control flow graph. For example... Figure 3 As shown, in this IR control flow graph, the inlet basic block is A, the outlet basic block is M, and there are various reference relationships between the basic blocks.

[0061] Reference Figure 3 As shown, in this IR control flow diagram, basic blocks C and H are used for explanation. For example, basic block C is labeled 60, and its predecessor basic block A is labeled 42. This is indicated by "preds=%42" in basic block C. The basic block content of basic block C includes "%61=load…, %62=call fun1,……,%xx=callfun2,……,br il%77,label%79,label%99". Basic block H is labeled 79, and its predecessor basic block C is labeled 60. This is indicated by "preds=%60" in basic block H. The basic block content of basic block H includes "%80=load…, %81=call fun2,……,%xx=call fun3,……,br label%153".

[0062] For each basic block, the function call relationship can be obtained by analyzing the call instruction. For example, if both basic block C and basic block H call fun2, tracing fun2 can cover both basic blocks C and basic block H.

[0063] Optionally, during the generation of the IR control flow graph, an instrumentation function can be deployed at the beginning of each function to collect the execution frequency of the corresponding function. Therefore, in practical applications, when the data processing device runs the target software source code, the execution frequency of functions in the IR control flow graph can be collected using the instrumentation functions deployed in the functions.

[0064] S202. Based on the basic block information and function execution frequency in the IR control flow graph, generate a target optimization function with the tracking function set as the independent variable and the constraints of the target optimization function.

[0065] In the embodiments of this application, if it is desired to select the target tracking function set from all functions included in the IR control flow graph while ensuring tracking accuracy and controlling tracking costs, the selection of the target tracking function set can be modeled as a minimum weighted set coverage problem with upper bound total weight constraint (MWSCP-UBC).

[0066] Optionally, the set of basic blocks included in the above IR control flow graph can be defined as B = {b1, b2, ..., b}. n},For example, Figure 3 The set of basic blocks A to M in the IR control flow graph is F = {f1, f2, ..., f...}. m At this point, according to the definitions of functions and basic blocks, we know that function f... j It can cover several subsets of B, tracking the cost generated by the function, i.e., the set of weights of the function, specifically W = {w1, w2, ..., w...} m} indicates that the weight value of a function is equal to its execution frequency. Therefore, the optimization objective is to select a target tracking function set F′ from the function set F such that the total weight value of the functions contained in the target tracking function set F′ does not exceed a given weight threshold w. ub In this case, try to cover as many basic blocks as possible.

[0067] Where n equals the number of basic blocks included in the IR control flow graph, m equals the number of functions included in the IR control flow graph, and both n and m are positive integers greater than or equal to 1.

[0068] That is, in this embodiment, the objective optimization function, with the set of tracking functions as the independent variable, selects the target tracking function set F′ from the function set F to cover as many basic blocks as possible. Correspondingly, the constraint condition of the objective optimization function is that the total weight value of the functions contained in the target tracking function set F′ is less than or equal to a given weight threshold w. ub .

[0069] S203. Based on the above constraints, the objective optimization function is solved using the MMAS algorithm to obtain the set of objective tracking functions in the IR control flow graph.

[0070] In this embodiment, in order to improve the efficiency of solving the above objective optimization function, the solution algorithm of the above objective optimization function (i.e., the MWSCP-UBC optimization problem) can be constructed based on the MMAS algorithm.

[0071] It is understandable that the MMAS algorithm is an optimization of the ant colony algorithm. The ant colony algorithm is a probabilistic algorithm used to find optimal paths in a graph. It may experience local convergence, leading to low accuracy due to early stagnation during the search process. To address this issue, this application utilizes the MMAS algorithm to avoid early convergence by limiting the pheromone concentration on each function. This allows for the acquisition of a set of target tracking functions with higher accuracy while satisfying the aforementioned constraints.

[0072] Optionally, in the MMAS algorithm, the following variable can be defined: the number of ants is N.ant The number of iterations is N run In the t-th iteration, the function f j The pheromone on it is τ j (t), ant h(N) ant (any one of them) selection function f j The probability is The heuristic function is η j (t), ant h in function f j The pheromone increment on Ant h has not yet selected (but can select) the set of functions as allowed. h .

[0073] Understandably, in practical applications, ants in each iteration cycle start from allowed h Choose a function, so in the t-th iteration, if the function f j Belongs to allowed h Then the ant h chooses the function f. j probability From function f j On the pheromone τ j (t) and heuristic function η j (t) is determined. If the function f j Not allowed h Then the ant h chooses the function f. j probability It equals 0.

[0074] In the embodiments of this application, in each iteration round, each ant can be based on Candidate functions are selected from the set of functions F included in the IR control flow graph. Then, the pheromone values ​​used in the next iteration are updated based on the pheromone and pheromone increment of the candidate function until all iterations are completed. This allows the set of target tracking functions to be selected from the set of functions F included in the IR control flow graph.

[0075] The data processing method provided in this application, upon obtaining the IR control flow graph of the target software source code and the execution frequency of functions within that IR control flow graph, generates a target optimization function with a set of tracking functions as independent variables and constraints on that target optimization function based on the basic block call relationships represented by the IR control flow graph and the function execution frequencies. Finally, based on these constraints, the MMAS algorithm is used to solve the target optimization function, yielding the target tracking function set within the IR control flow graph. In this technical solution, using the MMAS algorithm to solve the target optimization function to obtain the target tracking function set can, while satisfying the constraints, maximize tracking accuracy, minimize tracking costs, and reduce the impact on system performance.

[0076] To enable readers to more deeply understand the implementation principles of the embodiments of this application, the following describes... Figure 2 The illustrated embodiments are further refined.

[0077] For example, based on the above embodiments, Figure 4 This is a flowchart illustrating the data processing method provided in the second embodiment of this application. Figure 4 As shown, in this embodiment, the above-mentioned S202 can be implemented through the following steps:

[0078] S401. Based on the basic block information in the IR control flow graph, determine the first parameter and the second parameter. The first parameter is used to indicate whether the basic block is covered by a function, and the second parameter is used to indicate whether the function belongs to the target tracking function set.

[0079] In embodiments of this application, the data processing device can determine the association information between basic blocks and functions based on basic block information in the IR control flow graph, such as the content of each basic block. For example, a first parameter can be used to indicate whether a basic block is covered by a function.

[0080] For example, suppose we use h ij Represents basic block b i Is it by function f? j Overlay, therefore, when basic block b i The function f j When covering, h ij =1, when basic block b i Not by function f j When covering, h ij =0. Assume using x j Represents the function f j Whether it belongs to the target tracking function set F′, therefore, when function f j When x belongs to the target tracking function set F′, j =1, when the function f j When x does not belong to the target tracking function set F′, j =0.

[0081] Accordingly, in this embodiment, c is used i This represents the number of times the basic block i is covered by a function, which can be based on h. ij and x j The value of is determined, and can be specifically expressed by the following formula (1):

[0082]

[0083] Using variable a i Represents basic block b i Whether it is overwritten, ai The value is based on c i The value of a is determined. i and c i The specific relationship is shown in formula (2):

[0084]

[0085] It is understood that in this embodiment, a i That is, the first parameter, x j That is, the second parameter.

[0086] S402. Based on the execution frequency and second parameter of the function in the IR control flow graph, determine the total weight value of the functions included in the target tracking function set.

[0087] In this embodiment, based on the content recorded in S202 above, it is known that the set of weights of the function is W = {w1, w2, ..., w...} m The weight of a function is equal to its execution frequency. The total weight of the functions in the target tracking function set can be determined based on whether each function in the IR control flow graph belongs to the target tracking function set and the execution frequency of each function.

[0088] For example, in this embodiment, the total weight value of the functions included in the target tracking function set can be expressed as:

[0089] S403. Based on the first parameter, the total weight value of the functions included in the target tracking function set, and the preset weight threshold, generate a target optimization function with the target tracking function set as the independent variable. The constraint condition of the target optimization function is that the total weight value of the functions included in the target tracking function set is less than or equal to the weight threshold.

[0090] Optionally, in this embodiment, to ensure tracking accuracy and control tracking costs, based on whether the basic block is covered by a function, the total weight value of the functions contained in the target tracking function set, and a preset weight threshold, the mathematical form of MWSCP-UBC can be expressed through the following objective optimization function and its constraints, as follows:

[0091] The objective optimization function is expressed by formula (3):

[0092]

[0093] Where x represents the set of target tracking functions; δ1 = n / (n+1), δ2 = 1 / (n+1), δ1 is The weight information, δ2 is Weight information.

[0094] The constraint conditions are expressed by formula (4):

[0095]

[0096] In the embodiments of this application, a first parameter indicating whether a basic block is covered by a function and a second parameter indicating whether a function belongs to the target tracking function set can be determined based on the basic block information in the IR control flow graph. Then, based on the execution frequency of the function in the IR control flow graph and the second parameter, the total weight value of the functions included in the target tracking function set can be determined. Finally, based on the first parameter, the total weight value of the functions included in the target tracking function set, and a preset weight threshold, a target optimization function with the target tracking function set as the independent variable is generated. The constraint condition of the target optimization function is that the total weight value of the functions included in the target tracking function set is less than or equal to the weight threshold. This technical solution transforms the problem of selecting a tracking function into a mathematical problem of solving a target optimization function under constraints, laying the foundation for balancing tracking accuracy and tracking cost in practical applications and providing conditions for improving system performance.

[0097] Optionally, based on the above embodiments, Figure 5 This is a schematic flowchart illustrating the data processing method provided in the third embodiment of this application. Figure 5 As shown, in this embodiment, the above-mentioned S203 can be implemented through the following steps:

[0098] S501. Based on the basic block information and target optimization function in the IR control flow graph, determine the function pheromone increment formula expressed by the MMAS algorithm.

[0099] In practical applications, the problem of selecting a set of target tracking functions from the set of functions included in the IR control flow graph can be transformed into the ant path selection (function) problem in the MMAS algorithm. In this embodiment, based on the variables and target optimization function defined in S203 above, the ant h selects the target path (function) in the t-th iteration. j pheromone increment It can be expressed by formula (5):

[0100]

[0101] Where Q is the total amount of pheromones, and N is the total amount of pheromones. ant Let F(x) be the number of ants. best ) represents the above set of target tracking functions x best Let τ be the objective optimization function for the variable. j (t) represents the function f in the t-th iteration. j The pheromone on the surface, t is less than or equal to N run Positive integers.

[0102] S502. Determine the function pheromone formula based on the function pheromone increment formula and the function pheromone relationship between adjacent iterations.

[0103] Optionally, in the (t+1)th iteration, the function f j The pheromone on the surface can be determined based on the function f in the t-th iteration. j The pheromone on and the function f in the t-th iteration j The pheromone increment is calculated, therefore, in the (t+1)th iteration, the function f j The pheromones on the surface can be calculated using formula (6):

[0104]

[0105] Where ρ is the pheromone evaporation factor, and the value of ρ ranges from [0, 1), and 1-p represents the pheromone residue coefficient.

[0106] S503. Determine the heuristic function formula based on the execution frequency of the function in the IR control flow graph.

[0107] In the embodiments of this application, in the function f j heuristic function η j (t) is calculated using formula (7):

[0108]

[0109] Among them, w j For function f j The weights, that is, the weights of the function f j Execution frequency; η max η is the maximum value of the heuristic function. max Greater than 0.

[0110] S504. Substitute the function pheromone formula and the heuristic function formula into the probability formula defined by the MMAS algorithm to obtain the function selection probability formula.

[0111] In the embodiments of this application, ant h can, based on the heuristic function of the function and the pheromone value on the function, select from the set of functions that have never been selected (or can be selected). h In the selection of a function, for example, in the t-th iteration, ant h selects the function f. j probability It can be expressed by the following formula (8):

[0112]

[0113] Where, τ j (t) represents the function f j On the pheromone, ηj (t) represents the function f j The heuristic function is α, which is the pheromone factor, also known as the information heuristic factor, used to reflect the relative importance of the amount of information left by the ant colony during its movement, and β, which is the heuristic factor, also known as the expectation heuristic factor, used to reflect the relative importance of the expected value.

[0114] S505. Based on the preset value range of the function pheromone, the set of target tracking functions that satisfy the above constraints is selected from the set of functions included in the IR control flow graph using the function selection probability formula.

[0115] Optionally, to limit excessively high pheromone concentration on a certain function and avoid early convergence of the search, the MMAS algorithm defines a preset range of pheromone values ​​for the function, thereby limiting the range of pheromone values ​​on the function. Therefore, in this embodiment, the data processing device can, in each iteration, enable each ant to select a candidate function that satisfies the above constraints from the set of functions included in the IR control flow graph using the function selection probability formula shown in formula (8). Thus, when all iterations are completed, the set of target tracking functions selected from the set of functions included in the IR control flow graph can be determined.

[0116] For example, in MMAS, the function f j On the pheromone τ j (t)∈[τ min , τ max ], where τ max The initial value is τ j (0), τ min =τ max / l, where l is the value in the function f j The length of the path already traversed. That is, after each iteration, the pheromone on the function needs to be processed to ensure that the pheromone used in the next iteration is located within [τ]. min , τ max ]middle.

[0117] Optionally, in embodiments of this application, S505 can be implemented through the following steps:

[0118] A1. In the t-th iteration of the MMAS algorithm, based on the constraints, the function selection probability formula is used to perform H function selection processes to obtain the t-th candidate function set.

[0119] Where t is an integer greater than 0 and less than or equal to T, and T is equal to the iteration round defined in the MMAS algorithm, or N. run This means that H equals the number of ants defined in the MMAS algorithm, or N. ant express.

[0120] In the embodiments of this application, the data processing device can perform a function selection process based on the iteration rounds and ant data defined in the MMAS algorithm. Specifically, the data processing device can execute T iteration rounds based on the MMAS algorithm, and in each iteration round, perform H function selection processes while ensuring that the selected function set satisfies the constraints, and finally obtain the target function set.

[0121] For example, in the t-th iteration of the MMAS algorithm, each ant is controlled to select a candidate function from the set of functions that each ant can choose in turn by roulette wheel according to the function selection probability formula (8) determined above. Then, it is determined whether the total weight value after selecting the candidate function still satisfies the above constraint conditions. If so, the set of functions obtained after the last ant selects the t-th candidate function set is determined.

[0122] In one possible implementation of this application, based on constraints, the function selection probability formula is used to perform H-times of function selection process to obtain the t-th candidate function set, which may include:

[0123] First, during the h-th function selection process, the set of selected functions and the set of unselected functions in the IR control flow graph are determined, where h is an integer greater than 0 and less than or equal to H. Then, when the total first weight of the functions included in the set of selected functions is less than the weight threshold, the first function is selected from the set of unselected functions using the function selection probability formula. In response to the first function's weight value and the sum of the first weight values ​​being less than or equal to the weight threshold, the first function is added to the set of selected functions to obtain the updated function set. It is then determined whether the value of the first function when the set of selected functions is the tracking object is less than the value of the second function when the updated function set is the tracking object. In response to the second function value being less than the first function value, the set of selected functions is updated using the updated function set. Finally, the set of selected functions obtained after performing H function selection processes is determined as the t-th candidate function set.

[0124] Optionally, at the start of the h-th function selection process, the current set of selected functions and the set of unselected functions are first determined. Then, the total first weight of the functions included in the set of selected functions is calculated. It is determined whether the total first weight is less than the weight threshold. If so, the first function is selected from the set of unselected functions by means of a roulette wheel using the function selection probability formula (8) determined above. The weight value of the first function is then superimposed with the total first weight. It is determined whether the total weight after superposition is less than or equal to the weight threshold. If so, the first function is determined as a selectable function in the h-th function selection process, and the set of selected functions is updated. By performing the H-th function selection process in this way, the set of candidate functions determined in the t-th iteration can be obtained.

[0125] A2. Based on the function pheromone formula and the function pheromone increment formula, update the function pheromone increment value and the function pheromone value in the t-th iteration.

[0126] In this embodiment, after the execution is completed in the t-th iteration, the t-th function pheromone increment value Δτ in the t-th iteration can be calculated using the above-mentioned function pheromone increment formula (5) and function pheromone formula (6). best (t) and the pheromone value of the t-th function τ(t).

[0127] A3. In response to the fact that the pheromone value of the t-th function is not within the preset value range, the pheromone value of the t-th function is processed so that the updated pheromone value of the t-th function is within the preset value range.

[0128] The aforementioned pheromone increment value for function t and the updated pheromone value for function t are used to determine the function pheromone in the (t+1)th iteration.

[0129] Optionally, after determining the pheromone value of the t-th function, it can be determined whether the pheromone value of the t-th function is within the preset value range. If so, the pheromone value of the t-th function remains unchanged; otherwise, the pheromone value of the t-th function is processed so that the updated pheromone value of the t-th function is within the preset value range.

[0130] As an example, if the pheromone value of the t-th function is less than the lower limit of the preset value range, then the pheromone value of the t-th function is updated using the lower limit value. For example, the lower limit value is assigned to the pheromone value of the t-th function.

[0131] As another example, if the pheromone value of the t-th function is greater than the upper limit of the preset value range, then the pheromone value of the t-th function is updated using the upper limit value, for example, the upper limit value is assigned to the pheromone value of the t-th function.

[0132] Optionally, in the (t+1)th iteration, the updated pheromone value of the t-th function and the pheromone increment value of the t-th function can be substituted into formula (6) to obtain the pheromone value of the (t+1)-th function used in the (t+1)th iteration.

[0133] A4. When the MMAS algorithm has been executed for T iterations, the set of target tracking functions that satisfy the preset value range is determined based on the objective optimization function and the set of candidate functions determined in the Tth iteration.

[0134] Optionally, the data processing device can perform T iterations based on the method described in A1 to A3 to obtain the set of candidate functions determined in the Tth iteration, and then determine whether the set of candidate functions satisfies the objective optimization function represented by the above formula (3) and the constraint conditions represented by the above formula (4).

[0135] For example, in an embodiment of this application, when the MMAS algorithm is executed for T iterations, the value of the third function when the Tth candidate function set is the tracking object can be calculated according to the target optimization function. It can be determined whether the value of the third function is less than or equal to the value of the fourth function determined in the (T-1)th iteration. In response to the value of the third function being less than or equal to the value of the fourth function, the (T-1)th candidate function set determined in the (T-1)th iteration is updated using the Tth candidate function set, and the Tth candidate function set is determined as the target tracking function set.

[0136] Optionally, when the MMAS algorithm has been executed for T iterations, the Tth candidate function set can be substituted into the target optimization function represented by the above formula (3) to obtain the third function value when the Tth candidate function set is the tracking object. Assume that in the T-1th iteration, after substituting the T-1th candidate function set into the above formula (3), the fourth function value when the T-1th candidate function set is the tracking object can be obtained. At this time, after obtaining the third function value, the third function value can be compared with the fourth function value. If the third function value is less than or equal to the fourth function value, the T-1th candidate function set determined in the T-1th iteration is updated using the Tth candidate function set, and the Tth candidate function set is determined as the target tracking function set; if the third function value is greater than the fourth function value, the T-1th candidate function set is determined as the target tracking function set.

[0137] In this embodiment, a function pheromone increment formula represented by the MMAS algorithm is determined based on the basic block information and target optimization function in the IR control flow graph. A function pheromone formula is then determined based on this increment formula and the function pheromone relationship between adjacent iterations. A heuristic function formula is determined based on the execution frequency of functions in the IR control flow graph. Subsequently, the function pheromone formula and the heuristic function formula are substituted into the probability formula defined by the MMAS algorithm to obtain the function selection probability formula. Finally, based on the preset value range of the function pheromone, the function selection probability formula is used to select a set of target tracking functions that satisfy the constraints from the set of functions included in the IR control flow graph. In this technical solution, solving the target optimization function based on the MMAS algorithm can maximize tracking accuracy, reduce tracking costs, and improve system performance while satisfying the constraints.

[0138] Based on the above embodiments, the following describes a detailed implementation scheme for determining the target tracking function set based on the MMAS algorithm. Figure 6 This is a schematic flowchart illustrating the data processing method provided in the fourth embodiment of this application. Figure 6 As shown, the data processing method includes the following steps:

[0139] S601. Obtain the function variables B, F, W, w to be used. ub N ant N run , α, β, ρ, τ ini η max ,Q,l.

[0140] Regarding B, F, W, w ub N ant N run , α, β, ρ, η max The meanings of variables such as Q and l are consistent with those described in the above embodiments, and will not be repeated here. ini The pheromone value to be initialized.

[0141] S602. Determine whether the iteration number t is greater than or equal to 1 and less than or equal to N. run If yes, execute S603; otherwise, execute S614.

[0142] S603. Determine whether the number of ants h is greater than or equal to 1 and less than or equal to N. ant If yes, execute S604; otherwise, execute S608.

[0143] S604, the total weight of the first weight in the (t-1)th candidate function set is less than the weight threshold w. ub When the time is right, determine the set of candidate functions for the t-th time.

[0144] Optionally, in this step, if the total weight of the first set of candidate functions at the (t-1)th digit is less than the weight threshold w... ub When, the function f is selected from F using the function selection probability formula. j Then calculate the function f j weight value w j The sum of the first and second weighted totals is used to obtain the second weighted total. If the second weighted total is less than or equal to the weight threshold w, then... ub When, determine the function f j Let be the candidate functions, and then obtain the set of candidate functions for the t-th digit.

[0145] S605. Determine whether the value of the objective optimization function F(x) of the t-th candidate function set is less than the value of the objective optimization function F(x) of the (t-1)-th candidate function set. ibIf yes, execute S606; otherwise, execute S607.

[0146] S606. Replace the (t-1)th candidate function set with the t-th candidate function set;

[0147] S607. Take the (t-1)th candidate function set as the tth candidate function set.

[0148] S608. Using the function pheromone formula, calculate the t-th function pheromone value in the t-th iteration.

[0149] S609. Determine whether the pheromone value of the t-th function is within the preset value range. If yes, execute S610; if no, execute S611.

[0150] S610. Keep the pheromone value of the t-th function unchanged;

[0151] S611. Process the pheromone value of the t-th function so that the updated pheromone value of the t-th function is within the preset value range;

[0152] S612. Determine the value of the objective function F(x) in the t-th candidate function set. ib Is the objective function value F(x) less than or equal to the value of the selected function set? best If yes, execute S613; otherwise, proceed to S602.

[0153] S613. Assign the t-th candidate function set to the already selected function set;

[0154] S614, the Nth run The set of selected functions determined in each iteration is the target tracking function set x. best .

[0155] S615, Output target tracking function set x best and the set of target tracking functions x best The objective optimization function takes the value F(x) best ).

[0156] It is understandable that the specific implementation principles of each of the above steps can be found in the above... Figures 2 to 5 The descriptions in the illustrated embodiments will not be repeated here.

[0157] Optionally, in practical applications, various function tracing schemes will more or less increase the response time of the target software. A Response Time Growth Rate (RTGR) can be defined to analyze the impact of different schemes on the target software's response time.

[0158]

[0159] Optionally, Table 1 shows the RTGR information of the full function tracing method and the data processing method provided in the embodiments of this application on Redis, Nginx, Httpd, and SQLite. By analyzing the experimental data on four open-source software programs (Redis, Nginx, Httpd, and SQLite), the response time growth rate of different tracing methods can be determined, thereby determining the impact on the target software. In the experiment, w... ub The value is taken as 10% of the total frequency of function execution for explanation.

[0160] Table 1. RTGR of Redis, Nginx, Httpd, and SQLite under different trace point selection methods.

[0161] method Redis Nginx Httpd SQlite Full tracking method 684% 94% 55% 119% This article's method 81% 19% 19% 49%

[0162] As can be seen from the above analysis, the embodiments of this application propose an automatic selection algorithm for tracing function sets based on IR control flow graph and function execution frequency analysis, which can cover basic blocks as much as possible and minimize tracing overhead, thus solving the shortcomings of excessive tracing overhead and the need for manual selection of tracing points in the prior art.

[0163] Figure 7 This is a schematic block diagram of a data processing apparatus provided in an embodiment of this application. This data processing apparatus can be implemented using an electronic device, or it can be implemented using a device within an electronic device. Figure 7 As shown, the data processing device may include: an acquisition module 701, a generation module 702, and a processing module 703.

[0164] The acquisition module 701 is used to acquire the intermediate representation IR control flow graph of the target software source code and the execution frequency of the functions in the IR control flow graph, wherein the functions cover at least one basic block in the IR control flow graph.

[0165] The generation module 702 is used to generate a target optimization function with the set of tracking functions as independent variables and the constraints of the target optimization function based on the basic block information in the IR control flow graph and the execution frequency of the function;

[0166] The processing module 703 is used to solve the objective optimization function based on the constraints using the Max Minimum Ant Colony System (MMAS) algorithm, and obtain the set of objective tracking functions in the IR control flow graph.

[0167] In one possible implementation of this application embodiment, the processing module 703 is specifically used for:

[0168] Based on the basic block information in the IR control flow graph and the target optimization function, the pheromone increment formula expressed by the MMAS algorithm is determined.

[0169] The function pheromone formula is determined based on the function pheromone increment formula and the function pheromone relationship between adjacent iterations;

[0170] The heuristic function formula is determined based on the execution frequency of the functions in the IR control flow graph.

[0171] Substituting the function pheromone formula and the heuristic function formula into the probability formula defined by the MMAS algorithm, we obtain the function selection probability formula.

[0172] Based on the preset value range of the function pheromone, the set of target tracking functions that satisfy the constraints is selected from the set of functions included in the IR control flow graph using the function selection probability formula.

[0173] Optionally, the processing module 703 is used to select a set of target tracking functions that satisfy the constraints from the set of functions included in the IR control flow graph, based on a preset range of function pheromones and using the function selection probability formula, specifically:

[0174] Processing module 703 is specifically used for:

[0175] In the t-th iteration of the MMAS algorithm, based on the constraints, the function selection probability formula is used to perform H function selection processes to obtain the t-th candidate function set; where t is an integer greater than 0 and less than or equal to T, T is equal to the iteration number defined in the MMAS algorithm, and H is equal to the number of ants defined in the MMAS algorithm.

[0176] Based on the function pheromone formula and the function pheromone increment formula, update the t-th function pheromone increment value and the t-th function pheromone value in the t-th iteration round. The t-th function pheromone increment value and the t-th function pheromone value are used to determine the function pheromone in the (t+1)-th iteration round.

[0177] When the MMAS algorithm is executed for T iterations, a set of target tracking functions that satisfy the preset value range is determined based on the target optimization function and the set of candidate functions determined in the Tth iteration.

[0178] Optionally, the processing module 703 is used to perform H function selection processes based on the constraints and using the function selection probability formula to obtain the t-th candidate function set, specifically:

[0179] Processing module 703 is specifically used for:

[0180] During the h-th function selection process, the set of selected functions and the set of unselected functions in the IR control flow graph are determined, where h is an integer greater than 0 and less than or equal to H;

[0181] When the total first weight of the functions included in the selected function set is less than the weight threshold, the first function is selected from the unselected function set using the function selection probability formula.

[0182] In response to the fact that the sum of the weight value of the first function and the total weight value of the first function is less than or equal to the weight threshold, the first function is added to the selected function set to obtain the updated function set;

[0183] Determine whether the value of the first function when the selected function set is the tracking object is less than the value of the second function when the updated function set is the tracking object;

[0184] If the value of the second function is less than the value of the first function, then the set of selected functions is updated using the set of update functions;

[0185] The set of selected functions obtained after performing H function selection processes is determined as the t-th candidate function set.

[0186] Optionally, the processing module 703 is configured to, when the MMAS algorithm has been executed for T iterations, determine a set of target tracking functions that satisfy the preset value range based on the target optimization function and the set of candidate functions determined in the Tth iteration, specifically:

[0187] Processing module 703 is specifically used for:

[0188] When the MMAS algorithm is executed for T iterations, the value of the third function is calculated based on the objective optimization function, with the Tth candidate function set as the tracking object;

[0189] Determine whether the value of the third function is less than the value of the fourth function determined in the (T-1)th iteration.

[0190] In response to the fact that the value of the third function is less than the value of the fourth function, the set of candidate functions determined in the (T-1)th iteration is updated using the set of candidate functions of the Tth iteration.

[0191] The T-th candidate function set is determined as the target tracking function set.

[0192] Optionally, the processing module 703 is further configured to:

[0193] Determine whether the pheromone value of the t-th function is within the preset value range;

[0194] In response to the fact that the t-th function pheromone value is not within the preset value range, the t-th function pheromone value is processed so that the updated t-th function pheromone value is within the preset value range. The t-th function pheromone increment value and the updated t-th function pheromone value are used to determine the function pheromone in the (t+1)-th iteration round.

[0195] Optionally, the processing module 703 is configured to process the pheromone value of the t-th function when the pheromone value of the t-th function is not within the preset value range, so that the updated pheromone value of the t-th function falls within the preset value range, specifically:

[0196] The processing module 703 is specifically used to: if the pheromone value of the t-th function is less than the lower limit of the preset value range, then update the pheromone value of the t-th function using the lower limit; if the pheromone value of the t-th function is greater than the upper limit of the preset value range, then update the pheromone value of the t-th function using the upper limit.

[0197] In another possible implementation of the embodiments of this application, the generation module 702 is specifically used for:

[0198] Based on the basic block information in the IR control flow graph, a first parameter and a second parameter are determined. The first parameter is used to indicate whether the basic block is covered by a function, and the second parameter is used to indicate whether the function belongs to the target tracking function set.

[0199] Based on the execution frequency of the functions in the IR control flow graph and the second parameter, determine the total weight value of the functions included in the target tracking function set;

[0200] Based on the first parameter, the total weight value of the functions included in the target tracking function set, and a preset weight threshold, a target optimization function is generated with the target tracking function set as the independent variable. The constraint condition of the target optimization function is that the total weight value of the functions included in the target tracking function set is less than or equal to the weight threshold.

[0201] Regarding the data processing apparatus provided in the embodiments of this application, which is used to implement the technical solutions of the above method embodiments, the specific implementation schemes and beneficial effects are described in the above embodiments and will not be repeated here.

[0202] Figure 8 This is a schematic block diagram of an electronic device provided in an embodiment of this application. The electronic device 800 can be as described above. Figure 1 Data processing equipment in the middle. For example... Figure 8As shown, the electronic device 800 may include at least one processor 810, which can be used to implement the data processing method provided in this application. See the detailed description in the method examples for further details, which will not be repeated here.

[0203] The electronic device 800 may further include a memory 820 for storing program instructions and / or data. The memory 820 is coupled to the processor 810. The coupling in this application is an indirect coupling or communication connection between devices, units, or modules, which can be electrical, mechanical, or other forms, for information exchange between devices, units, or modules. The processor 810 may operate in conjunction with the memory 820. The processor 810 may execute program instructions stored in the memory 820. At least one of the at least one memories may be included in the processor.

[0204] The electronic device 800 may further include a communication interface 830 for communicating with other devices via a transmission medium, thereby enabling the devices in the electronic device 800 to communicate with other devices. The communication interface 830 may be, for example, a transceiver, interface, bus, circuit, or a device capable of transmitting and receiving functions. The processor 810 may utilize the communication interface 830 to transmit and receive data and / or information, and to implement the data processing methods described in the above embodiments.

[0205] This application does not limit the specific connection medium between the processor 810, memory 820, and communication interface 830. Figure 8 The processor 810, memory 820, and communication interface 830 are connected via bus 840. Bus 840 is in Figure 8 The connections between other components are shown in bold and are for illustrative purposes only, not as limiting information. The bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, Figure 8 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0206] In the embodiments of this application, the processor may be a general-purpose processor, a digital signal processor, an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in this application. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in this application can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.

[0207] According to the method provided in this application, this application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, causes the processor to perform the technical solutions described above.

[0208] According to the method provided in this application, this application also provides a computer program product, including: computer program code. When the computer program code is executed by a processor, it causes the processor to perform the technical solutions in the above embodiments.

[0209] The technical solutions provided in this application can be implemented in whole or in part through software, hardware, firmware, or any combination thereof. When implemented using software, they can be implemented in whole or in part as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, a network device, a terminal device, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired means, such as coaxial cable, optical fiber, digital subscriber line (DSL), or wireless means (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium such as a digital video disc (DVD), or a semiconductor medium, etc.

[0210] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A data processing method, characterized in that, include: Obtain the intermediate representation IR control flow graph of the target software source code and the execution frequency of functions in the IR control flow graph, wherein the functions cover at least one basic block in the IR control flow graph; Based on the basic block information in the IR control flow graph and the execution frequency of the function, a target optimization function and constraints of the target optimization function are generated with the set of tracking functions as independent variables, wherein the weight value of the function is equal to the execution frequency of the function; Based on the constraints, the objective optimization function is solved using the Max-Min Ant Colony System (MMAS) algorithm to obtain the target tracking function set in the IR control flow graph. The constraint of the objective optimization function is that the total weight value of the functions included in the target tracking function set is less than or equal to a preset weight threshold.

2. The method as described in claim 1, characterized in that, Based on the constraints, the objective optimization function is solved using the Max Minimum Ant Colony System (MMAS) algorithm to obtain the set of objective tracking functions in the IR control flow graph, including: Based on the basic block information in the IR control flow graph and the target optimization function, the pheromone increment formula expressed by the MMAS algorithm is determined. The function pheromone formula is determined based on the function pheromone increment formula and the function pheromone relationship between adjacent iterations; The heuristic function formula is determined based on the execution frequency of the functions in the IR control flow graph. Substituting the function pheromone formula and the heuristic function formula into the probability formula defined by the MMAS algorithm, we obtain the function selection probability formula. Based on the preset value range of the function pheromone, the set of target tracking functions that satisfy the constraints is selected from the set of functions included in the IR control flow graph using the function selection probability formula.

3. The method as described in claim 2, characterized in that, The preset value range based on the function pheromone, using the function selection probability formula, selects a set of target tracking functions that satisfy the constraints from the function set included in the IR control flow graph, including: In the t-th iteration of the MMAS algorithm, based on the constraints, the function selection probability formula is used to perform H function selection processes to obtain the t-th candidate function set; where t is an integer greater than 0 and less than or equal to T, T is equal to the iteration number defined in the MMAS algorithm, and H is equal to the number of ants defined in the MMAS algorithm. Based on the function pheromone formula and the function pheromone increment formula, update the t-th function pheromone increment value and the t-th function pheromone value in the t-th iteration round. The t-th function pheromone increment value and the t-th function pheromone value are used to determine the function pheromone in the (t+1)-th iteration round. When the MMAS algorithm is executed for T iterations, a set of target tracking functions that satisfy the preset value range is determined based on the target optimization function and the set of candidate functions determined in the Tth iteration.

4. The method as described in claim 3, characterized in that, Based on the constraints, and using the function selection probability formula, the process performs H function selection operations to obtain the t-th candidate function set, including: During the h-th function selection process, the set of selected functions and the set of unselected functions in the IR control flow graph are determined, where h is an integer greater than 0 and less than or equal to H; When the total first weight of the functions included in the selected function set is less than the weight threshold, the first function is selected from the unselected function set using the function selection probability formula. In response to the fact that the sum of the weight value of the first function and the total weight value of the first function is less than or equal to the weight threshold, the first function is added to the selected function set to obtain the updated function set; Determine whether the value of the first function when the selected function set is the tracking object is less than the value of the second function when the updated function set is the tracking object; If the value of the second function is less than the value of the first function, then the set of selected functions is updated using the set of update functions; The set of selected functions obtained after performing H function selection processes is determined as the t-th candidate function set.

5. The method as described in claim 3, characterized in that, When the MMAS algorithm is executed for T iterations, the set of target tracking functions that satisfy the preset value range is determined based on the target optimization function and the set of candidate functions determined in the Tth iteration, including: When the MMAS algorithm is executed for T iterations, the value of the third function is calculated based on the objective optimization function, with the Tth candidate function set as the tracking object; Determine whether the value of the third function is less than the value of the fourth function determined in the (T-1)th iteration. In response to the fact that the value of the third function is less than the value of the fourth function, the set of candidate functions determined in the (T-1)th iteration is updated using the set of candidate functions of the Tth iteration. The T-th candidate function set is determined as the target tracking function set.

6. The method as described in claim 3, characterized in that, After updating the t-th function pheromone increment value and the t-th function pheromone value in the t-th iteration according to the function pheromone formula and the function pheromone increment formula, the method further includes: Determine whether the pheromone value of the t-th function is within the preset value range; In response to the fact that the t-th function pheromone value is not within the preset value range, the t-th function pheromone value is processed so that the updated t-th function pheromone value is within the preset value range. The t-th function pheromone increment value and the updated t-th function pheromone value are used to determine the function pheromone in the (t+1)-th iteration round.

7. The method as described in claim 6, characterized in that, The step of processing the pheromone value of the t-th function when it is not within the preset value range, so that the updated pheromone value of the t-th function falls within the preset value range, includes: If the pheromone value of the t-th function is less than the lower limit of the preset value range, then the pheromone value of the t-th function is updated using the lower limit value; If the pheromone value of the t-th function is greater than the upper limit of the preset value range, then the pheromone value of the t-th function is updated using the upper limit value.

8. The method according to any one of claims 1 to 7, characterized in that, The step of generating a target optimization function and constraints for the target optimization function, with the set of tracking functions as independent variables, based on the basic block information in the IR control flow graph and the execution frequency of the functions, includes: Based on the basic block information in the IR control flow graph, a first parameter and a second parameter are determined. The first parameter is used to indicate whether the basic block is covered by a function, and the second parameter is used to indicate whether the function belongs to the target tracking function set. Based on the execution frequency of the functions in the IR control flow graph and the second parameter, determine the total weight value of the functions included in the target tracking function set; Based on the first parameter, the total weight value of the functions contained in the target tracking function set, and the preset weight threshold, a target optimization function is generated with the target tracking function set as the independent variable.

9. A data processing apparatus, characterized in that, include: The acquisition module is used to acquire the intermediate representation IR control flow graph of the target software source code and the execution frequency of the functions in the IR control flow graph, wherein the functions cover at least one basic block in the IR control flow graph; The generation module is used to generate a target optimization function and constraints of the target optimization function with the set of tracking functions as independent variables, based on the basic block information in the IR control flow graph and the execution frequency of the function, wherein the weight value of the function is equal to the execution frequency of the function; The processing module is used to solve the objective optimization function based on the constraints using the Max Minimum Ant Colony System (MMAS) algorithm to obtain the target tracking function set in the IR control flow graph, wherein the constraint condition of the objective optimization function is that the total weight value of the functions included in the target tracking function set is less than or equal to a preset weight threshold.

10. An electronic device, characterized in that, Includes a processor for invoking a computer program to cause the electronic device to perform the method as described in any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, causes the processor to perform the method as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Program instrumentation method and device for verifying data API execution process

    CN115221051A