An efficient dynamic calling method for functional testing

Through intelligent scheduling and memory management mechanisms, dynamically adjusting the execution order of functions and optimizing memory allocation, the problem that static scheduling in the existing technology is difficult to meet the needs of dynamic scenarios, and the efficient and stable operation of the system in complex testing tasks is achieved.

CN119127451BActive Publication Date: 2025-04-01SUZHOU JUDIAN INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411623762.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-14
Publication Date
2025-04-01
Estimated Expiration
2044-11-14

AI Technical Summary

Technical Problem

In the prior art, static scheduling and resource allocation schemes are difficult to meet the flexible scheduling needs in dynamic scenarios, resulting in excessive consumption of system resources, performance bottlenecks, uneven load, memory backlog and response time delay.

Method used

Through intelligent scheduling and memory management mechanisms, the execution order of functions is dynamically adjusted, combined with the analysis of disturbance path index, the memory allocation and release strategies are optimized to ensure efficient resource utilization and timely release memory after task execution.

Benefits of technology

It significantly improves the efficiency and stability of the system when performing complex test tasks, improves execution fluency, resource utilization efficiency and task response speed, and enhances the stability and flexibility of the system in a dynamic environment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119127451B_ABST
    Figure CN119127451B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for dynamic calling of efficient functional tests, which specifically relates to the field of intelligent system scheduling, and is used to solve the problems of resource optimization and stability in complex test tasks. It improves the efficiency and stability of the system in complex test tasks through intelligent scheduling and memory management. The function execution order is dynamically adjusted according to real-time monitoring, and tasks with small disturbances to the system and simple paths are scheduled preferentially to reduce resource occupation and load pressure. At the same time, the memory allocation and release strategy is combined with the disturbance path index to ensure that the memory is released in time after the task is completed to avoid memory backlog. Historical data is used to predict the resource requirements of future tasks, and group calling and load adjustment mechanisms are used to deal with high load or resource shortage situations to ensure efficient operation of the system. On the whole, the present invention improves the system execution fluency, resource utilization and task response speed, while enhancing the system stability and flexibility in a dynamic environment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of intelligent system scheduling, and more specifically, to an efficient function test dynamic calling method. Background Art

[0002] In the functional testing of modern complex systems, as the scale and complexity of tasks continue to increase, the rationality of the test framework and scheduling scheme directly affects the resource utilization and stability of the system. In actual test scenarios, when the system executes multiple function tasks, it is necessary to dynamically adjust resource allocation and priority to maximize the system operation efficiency. However, due to the different path structures and resource requirements of different function tasks, simply relying on static preset call order and resource allocation is often difficult to adapt to the dynamic changes in system operation. Ideally, the test system should be able to intelligently identify and optimize the function execution order, and automatically adjust according to the real-time monitoring of resource occupancy and path complexity to ensure system stability and efficiency.

[0003] However, the static scheduling and resource allocation schemes commonly used in the prior art have significant deficiencies and are difficult to meet the flexible scheduling requirements in dynamic scenarios. Traditional test frameworks mostly use fixed task priorities and resource allocation strategies. These strategies lack the ability to provide real-time feedback and adjust the system status during task execution, leading to the following problems: When certain function tasks generate high resource usage or complex path selection during execution, the system cannot adjust the execution order and resource allocation of other tasks in a timely manner, causing excessive consumption of system resources and performance bottlenecks. This problem is particularly prominent when test tasks involve high-frequency branches and loop structures, and system resource consumption increases dramatically, but static scheduling cannot reallocate resources according to the dynamic performance of the task, resulting in uneven system load, memory backlogs, and response time delays, thereby reducing test efficiency and the overall stability of the system.

[0004] In order to solve the above problems, a technical solution is now provided. Summary of the invention

[0005] In order to overcome the above-mentioned defects of the prior art, the embodiment of the present invention provides an efficient function test dynamic calling method, which significantly improves the efficiency and stability of the system when executing complex test tasks through intelligent scheduling and memory management mechanisms. First, the execution order of the function is dynamically adjusted according to the real-time monitoring data of the task, and the tasks with small disturbance to the system and simple paths are executed first, reducing the occupation of system resources and unnecessary load pressure. Secondly, the memory allocation and release strategy is combined with the analysis of the disturbance path index to ensure efficient use of resources, and release memory in time after the task is executed to avoid the accumulation of memory occupation. This mechanism can not only predict the resource requirements of future tasks based on historical data, but also effectively respond to the situation of high system load or resource shortage through group calling and load adjustment mechanism, and ensure the continuous and efficient operation of the system. Thereby greatly improving the execution fluency, resource utilization efficiency and task response speed of the system, while enhancing the stability and flexibility of the system in a dynamic environment. To solve the problems raised in the above background technology.

[0006] To achieve the above object, the present invention provides the following technical solutions:

[0007] S1, separate the test main program from the function, determine the function path according to the configuration file and dynamically load it when calling;

[0008] S2, set the standardized input and output interface of the function, adjust the input parameters according to the configuration file and define the output format;

[0009] S3, real-time monitoring of resource consumption and execution path structure during function execution, so as to dynamically sort the function call order;

[0010] S4, executes the task according to the optimized calculation results and releases the corresponding memory resources immediately after the function is executed.

[0011] In a preferred embodiment, step S1 includes the following contents:

[0012] S1.1, first, store all test functions in an independent directory structure. Each function corresponds to an independent file. The file path is associated with a unique identifier. The configuration file is responsible for managing the path information of these functions and storing them in the form of key-value pairs. Each key is the function name and the value is the corresponding storage path.

[0013] S1.2, when the main program starts, it first reads the configuration file to obtain the function path information, and according to the preset task flow, only when the function needs to be called during execution, it loads the corresponding function file through the path;

[0014] S1.3, the main program uses the reflection mechanism to load and call the function at runtime according to the definition of the function path in the configuration file; in the specific implementation process, the main program uses the dynamic loader to parse the function name and parameter signature, and finds and executes the corresponding function entry through reflection;

[0015] S1.4, after dynamically loading and executing the function, the execution results of the function are uniformly processed; the output of all test functions follows the pre-defined interface specifications, including output data type and output structure. The main program encapsulates the results returned by the function by reading the output specifications defined in the configuration file to ensure that the results can interact seamlessly with the main program.

[0016] In a preferred embodiment, step S2 includes the following contents:

[0017] For each test function, according to the different requirements of different functions for parameters, the input data is converted into a format that meets the function requirements through a type converter when the function is called;

[0018] The configuration file defines the entry parameters of each test function. Before calling the function, the main program first obtains the parameter settings by reading the configuration file and adjusts the parameters according to the current test requirements.

[0019] The dynamic adjustment of input parameters is achieved through the parameter mapping table; the parameter mapping table stores the mapping relationship of input parameters of different functions, and the main program binds parameters according to the mapping table when calling through the table lookup mechanism;

[0020] The output interface standardization is achieved through the dynamic data wrapper; the dynamic data wrapper automatically generates a standardized data structure according to the output definition in the configuration file, so that the output of the function is seamlessly transmitted in different test scenarios, and formats the data according to the rules in the configuration file to ensure that the output results meet the preset requirements;

[0021] Before calling a function, the main program will pre-verify the input parameters. Similarly, after the function is executed, the output results will also be verified through a standardized verification mechanism. If the verification fails, an error report will be automatically generated and the parameter configuration will be rolled back.

[0022] In a preferred embodiment, step S3 includes the following contents:

[0023] During the test, the resource consumption status and execution path structure during function execution are monitored in real time to obtain the key influencing factors of the function execution process, including entropy dissipation rate and execution path nonlinearity.

[0024] In a preferred embodiment, the process of obtaining the entropy dissipation rate is:

[0025] During the function execution process, the system's timing behavior, that is, the task completion time at different stages, is collected; for the task completion status of each time slice, the start and end time of the task is recorded, and a timing fluctuation curve is established;

[0026] During the execution of a function, the transmission rate and directionality of the data flow are analyzed. The data flow is regarded as the core ordered structure of the system. By measuring the rate changes of input and output data packets during the execution of the function, a data flow change curve is generated.

[0027] After obtaining the time series fluctuation data and data flow changes, the entropy dissipation rate is obtained by combining the time series behavior with the data flow changes. The specific calculation formula is: ; EDR: Entropy dissipation rate; T total : The overall execution time of the function; F in (t): input data flow rate of the function at time slice t; F out (t): the output data flow rate of the function at time slice t; T i : The time it takes to complete a task within time slice t, representing timing fluctuations.

[0028] In a preferred embodiment, the process of acquiring the nonlinearity of the execution path is as follows:

[0029] When the function is executed, the control flow structure inside the function is collected, that is, each branch node B i and loop node L i ,By dynamically tracing the execution path, we record all the branch nodes and loop nodes passed by each function when executing, and mark the depth and nesting level of these nodes;

[0030] B i : The i-th branch node, representing the path bifurcation point in the function; L i : The i-th loop node represents the loop structure in the control flow; D(B i ): the depth of the branch node; N(l i ): the nesting level of loop nodes;

[0031] P(B i ): The uncertainty change of the branch node is defined as the path bifurcation index of each branch node, which is proportional to the branch depth. The formula is: ; Among them, n(B i ) is the number of path selections corresponding to the branch node;

[0032] R(L i ): The complexity change of the loop node, defined as the combination of the nesting level and the number of loops of each loop node, is as follows: ; Among them, C(L i) is the number of loops of the corresponding loop node;

[0033] Integrate the uncertainty changes of all paths into the nonlinearity of a path, combine the change values ​​of the branch nodes and loop nodes in the path, and calculate the execution path nonlinearity EPN of the entire path: ;EPN: execution path nonlinearity;T total : the total execution time of the function; B(t): the number of branch nodes of the function in time slice t; L(t): the number of loop nodes of the function in time slice t; P(B t ) and R(L t ) are the complexity changes of branch nodes and loop nodes respectively.

[0034] In a preferred embodiment, step S3 further includes the following contents:

[0035] The entropy dissipation rate and the nonlinearity of the execution path are processed by dimensionless transformation, EDR norm and EPN norm They represent the dimensionless entropy dissipation rate and the nonlinearity of the execution path respectively. The two are combined through a nonlinear function to calculate the disturbance path index DPI: ;

[0036] Step 1: Calculate the adaptive threshold △ adaptive , whose size changes dynamically according to the current system resource usage and load fluctuations, and is specifically defined as: ; where γ is the reference threshold, σ load is the current system load fluctuation rate, is the average value of the function perturbation path index in the current batch;

[0037] Step 2: For the functions of the current batch, if the perturbation path index difference between the two functions is If it is not greater than the adaptive threshold, the original sorting is retained and the calling order is not adjusted;

[0038] Step three: divide the functions that meet the threshold requirements into efficient execution groups in the original order and call them in batches. The disturbance path index of these functions is small and the disturbance to the system is similar, so they are scheduled first to reduce the execution time overhead.

[0039] In a preferred embodiment, step S4 includes the following contents:

[0040] Memory allocation will be intelligently allocated based on the task's memory requirements, the current system resource status, and the perturbation path index value to ensure that high-priority tasks obtain sufficient resources, while low-priority tasks dynamically adjust resource allocation based on system load; specifically, task memory allocation follows the following formula: ; Among them, Malloc The memory resources allocated to the task, M available The current available memory of the system;

[0041] During the task execution, the main program tracks the task execution status in real time through the embedded monitoring module, including memory usage, execution time and task completion;

[0042] After the task is completed, the main program will immediately release the memory resources occupied by the corresponding task to ensure that the system resources can be recovered in time for subsequent tasks. By analyzing the historical disturbance path index, the memory requirements of subsequent tasks are predicted, so as to manage the released memory. The memory recovery strategy formula is: ; Among them, M release is the amount of memory released, M alloc is the amount of memory allocated, △DPI next is the difference in perturbation path index between the next task and the current task, and △t is the time interval between the two tasks.

[0043] The technical effects and advantages of the present invention's efficient function test dynamic calling method are as follows:

[0044] Through intelligent scheduling and memory management mechanisms, the efficiency and stability of the system in executing complex test tasks are significantly improved. First, the execution order of functions is dynamically adjusted according to the real-time monitoring data of the task, and tasks with small disturbances to the system and simple paths are given priority, reducing the occupation of system resources and unnecessary load pressure. Secondly, the memory allocation and release strategy is combined with the analysis of the disturbance path index to ensure efficient use of resources, and release memory in time after the task is completed to avoid the accumulation of memory usage. This mechanism can not only predict the resource requirements of future tasks based on historical data, but also effectively respond to high system load or resource shortage situations through group calls and load adjustment mechanisms, ensuring the continuous and efficient operation of the system. This greatly improves the execution fluency, resource utilization efficiency and task response speed of the system, while enhancing the stability and flexibility of the system in a dynamic environment. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 The present invention is a flowchart of an efficient function test dynamic calling method.

[0046] Figure 2 This is a flow chart of step S1 of an efficient function test dynamic calling method of the present invention. DETAILED DESCRIPTION

[0047] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0048] Embodiment 1: Figure 1 The present invention provides an efficient function test dynamic calling method, comprising:

[0049] S1, separate the test main program from the function, determine the function path according to the configuration file and dynamically load it when calling.

[0050] S2, set the standardized input and output interface of the function, adjust the input parameters according to the configuration file and define the output format.

[0051] S3 monitors the resource consumption status and execution path structure of the function in real time, so as to dynamically sort the function calling order.

[0052] S4, executes the task according to the optimized calculation results and releases the corresponding memory resources immediately after the function is executed.

[0053] In traditional test frameworks, the main program is tightly bound to all test functions, which results in all functions being loaded together each time the program is started, which seriously occupies system memory and requires large-scale modifications to the entire framework when test requirements change, which lacks flexibility. To overcome this problem, a solution based on path storage and dynamic loading mechanism is proposed. By separating functions from the main program and introducing dynamic management of configuration files, functions are loaded only when needed, which improves memory utilization and enhances program adaptability.

[0054] Step S1 includes the following contents:

[0055] S1.1, first, store all test functions in an independent directory structure. Each function corresponds to an independent file, and the file path is associated with a unique identifier. The configuration file is responsible for managing the path information of these functions and storing them in the form of key-value pairs, where each key is the function name and the value is the corresponding storage path. This structure ensures that the function can be called flexibly without being embedded in the main program.

[0056] The path-based storage method avoids the problem of binding functions and main programs in traditional static calls, and the path information can be dynamically changed during execution to achieve flexible scheduling.

[0057] S1.2, when the main program starts, it no longer loads all functions, but first reads the configuration file to obtain the function path information, and only loads the corresponding function file through the path when the function needs to be called during execution according to the preset task flow. The function loading adopts the lazy loading mechanism to ensure that it is loaded when the function is called, and unloads the function and releases the memory after execution.

[0058] Through delayed loading and dynamic configuration file management, the problem of forced loading of functions in traditional static calls is avoided, on-demand calls are implemented, the memory usage at system startup is greatly reduced, and the flexibility of the program is improved.

[0059] S1.3, the main program uses the reflection mechanism (Reflection) or dynamic link library (DLL) to load and call the function at runtime according to the definition of the function path in the configuration file. The reflection mechanism can generate a call object in real time according to the function name and path, ensuring that the function can be called without modifying the main program. In the specific implementation process, the main program uses the dynamic loader to parse the function name and parameter signature, and finds and executes the corresponding function entry through reflection.

[0060] The introduction of the reflection mechanism makes the function call no longer dependent on the binding relationship at compile time, ensuring the flexibility and dynamism of function loading. When the test framework is updated, there is no need to recompile the main program, which enhances the maintainability and scalability of the system.

[0061] S1.4, after dynamically loading and executing the function, the main program needs to uniformly process the execution results of the function. The output of all test functions follows the pre-defined interface specifications, including output data types (such as numeric, Boolean, array, etc.) and output structures. The main program encapsulates the results returned by the function by reading the output specifications defined in the configuration file to ensure that the results can interact seamlessly with the main program.

[0062] Through standardized interface design, the output data format of different functions is guaranteed to be consistent. The main program can dynamically adapt to the output content of different functions, avoiding compatibility issues caused by inconsistent output.

[0063] S1.5, during the dynamic loading and calling of functions, abnormal situations such as path errors, function non-existence, or call failure may occur. To ensure the stable operation of the program, the main program uses a dynamic error handling mechanism. Every time a function fails to load, the program will try to fall back based on the alternative function path in the configuration file. If all attempts fail, the program will record an error log and skip this step to continue with subsequent tasks.

[0064] The system's fault tolerance is improved through the path alternative mechanism and error fallback strategy, ensuring that the main program can still run stably when the dynamic call fails.

[0065] Through this method, the main program does not need to load all functions during execution, and only calls them on demand according to actual needs, which significantly reduces the system memory usage. The delayed loading mechanism makes the program start faster when processing large projects. The combination of path management and reflection mechanism ensures the flexibility and dynamism of function calls, which not only reduces the need to modify the main program, but also improves the scalability and maintenance efficiency of the test framework. At the same time, the standardized interface design enables the output of the function to be processed uniformly, ensuring a high degree of decoupling between the main program and the test function, and improving the stability and compatibility of the system.

[0066] Step S2 includes the following contents:

[0067] For each test function, first set a standardized input interface format. The input interface needs to support multiple data types, including numeric, Boolean, array, string, etc. The main program automatically adjusts the input parameter structure of each function call according to the parameter type, quantity and order specified in the configuration file to ensure that the input data format meets the function requirements.

[0068] The standardized design of the input interface introduces a dynamic type adapter mechanism, which can convert input data into a format that meets the function's requirements through a type converter when the function is called, based on the different parameter requirements of different functions. This mechanism supports multiple types of input and automatically matches function signatures through a reflection mechanism, ensuring seamless adaptation of function parameters in different projects.

[0069] The configuration file defines the entry parameters of each test function, including parameter type, default value, value range, etc. Before calling the function, the main program first obtains the parameter settings by reading the configuration file and adjusts the parameters according to the current test requirements. The dynamic adjustment process can not only modify the parameter value, but also change the number and order of parameters to adapt to different test scenarios.

[0070] The dynamic adjustment of input parameters is achieved by introducing a parameter mapping table (ParameterMappingTable). The parameter mapping table stores the mapping relationship of input parameters of different functions. The main program uses a table lookup mechanism to bind parameters according to the mapping table when calling. This dynamic adjustment mechanism can flexibly change input parameters according to actual test scenarios, avoid hard coding, and enhance the flexibility of function calls.

[0071] In order to ensure that the output results of different functions can be processed uniformly, a standardized output interface is set. The output interface supports multiple types of data and defines a unified data encapsulation format. The output results will be encapsulated into a specific data structure, including output value, data type, unit and other information. This data structure is dynamically generated through the output format definition in the configuration file to ensure that the output results of all functions have a unified format.

[0072] The output interface is standardized by introducing a dynamic data wrapper. The dynamic data wrapper automatically generates a standardized data structure based on the output definition in the configuration file, so that the output of the function can be seamlessly transmitted in different test scenarios. The wrapper can also format the data according to the rules in the configuration file (such as numerical precision, data unit conversion, etc.) to ensure that the output results meet the preset requirements.

[0073] Before calling a function, the main program will pre-verify the input parameters to ensure that the parameter type, value range, and quantity meet the function requirements. Similarly, after the function is executed, the output results will also be verified through a standardized verification mechanism to ensure that the output values ​​meet the predefined format and data requirements. If the verification fails, the system will automatically generate an error report and roll back the parameter configuration to ensure data consistency and correctness.

[0074] The verification mechanism is implemented by introducing a bidirectional validator, which can pre-check the input parameters before the function is executed and check the consistency of the output results after the function is executed. This mechanism not only ensures the reliability of input and output, but also provides a convenient tool for fault diagnosis and testing and debugging, improving the robustness of the system.

[0075] In a multi-project environment, test functions in different projects may have different input and output interface requirements. In order to solve the interface compatibility problem across projects, the main program introduces an interface adapter module (InterfaceAdapter), which can automatically identify the differences in function input and output interfaces and dynamically adapt input and output data according to the interface adaptation rules in the configuration file, ensuring that functions in different projects can share the same test framework.

[0076] The interface adapter performs dynamic data conversion through the adaptation rules defined in the configuration file, and supports the input and output interface adaptation of multiple projects and multiple functions. It not only improves the scalability of the test framework, but also enables cross-project compatibility without modifying the original function code.

[0077] In order to optimize the function calling sequence, it is necessary to monitor the multi-dimensional characteristics of the function execution in real time and dynamically adjust the function calling sequence so that system resources can be used efficiently and the execution process is smoother and more orderly. During the execution process, the complexity of the function and its impact on system resources are usually not fixed. Therefore, relying solely on traditional execution time or resource consumption indicators cannot accurately reflect the state changes and system load during function execution. In order to better control the influencing factors during function execution, it is necessary to accurately evaluate the fluctuations of system resources and the complexity of the function execution path, so as to implement a more reasonable sorting strategy in the test process.

[0078] Step S3 includes the following contents:

[0079] During the test, the execution of the function not only occupies system resources, but also causes varying degrees of system disturbances. The execution path of the function often contains complex branches and loop structures, which leads to fluctuations in execution efficiency. Therefore, it is necessary to monitor the resource consumption status and execution path structure during the execution of the function in real time to obtain the key influencing factors of the function during execution, including entropy dissipation rate and execution path nonlinearity. By collecting this data, it can provide a basis for subsequent sorting decisions.

[0080] Among them, the entropy dissipation rate is used to measure the degree of disturbance to the ordered state of the system when the function is executed. By analyzing the fluctuations in the use of resources (such as CPU and memory), the rate at which the function execution increases the system entropy is evaluated, thereby quantifying its impact on system stability.

[0081] Among them, the execution path nonlinearity measures the complexity of the path during the function execution process by analyzing the control flow complexity inside the function. The higher the nonlinearity, the more complex the branch structure and loop nesting inside the function, and the greater the uncertainty in the execution process.

[0082] By embedding a real-time monitoring module in the main program, the system resource usage of each function is continuously collected, including key data such as CPU, memory, and I / O operations, to generate a resource usage curve. At the same time, the execution path within the function is monitored, and the selection of branches and loop nodes is recorded. These data will be used for further analysis and evaluation in the next steps.

[0083] The process of obtaining the entropy dissipation rate is:

[0084] During the function execution process, the system's timing behavior, that is, the task completion time at different stages, is collected to reflect the dynamic behavior characteristics during execution. For the task completion status of each time slice, the start and end time of the task are recorded, and a timing fluctuation curve is established.

[0085] By analyzing the volatility of task completion time, we can capture the tiny state changes of the system at different moments, and these timing fluctuations will serve as the basis for calculating the entropy dissipation rate.

[0086] During the execution of the function, the transmission rate and directionality of the data flow are analyzed. The data flow is regarded as the core ordered structure of the system, and its changes reflect the disturbance of the system entropy. By measuring the changes in the rate of input and output data packets during the execution of the function, a data flow change curve is generated. The fluctuation of the data flow reflects the transformation of the system from an ordered state to a disordered state.

[0087] After obtaining the time series fluctuation data and data flow changes, the entropy dissipation rate is obtained by combining the time series behavior with the data flow changes. This formula determines the entropy change of the system in each time slice by analyzing the interaction between the time series and the data flow. The specific calculation formula is: ; EDR: Entropy dissipation rate, which represents the rate of change of the ordered state of the system per unit time.

[0088] T total : The overall execution time period of the function, indicating the total execution cycle of the system.

[0089] F in (t): The input data flow rate of the function at time slice t.

[0090] F out (t): The output data flow rate of the function at time slice t.

[0091] Ti: The time it takes to complete a task within time slice t, representing timing fluctuations.

[0092] By combining the difference in data flow input and output rates with the task completion time of the time slice, the dissipation state of system resources is captured in a nonlinear logarithmic form. By analyzing each time slice, the entropy dissipation rate of the system is finally obtained. The difference in data flow and the timing fluctuations together reflect the dynamic changes in the ordered state of the system.

[0093] The entropy dissipation rate is used to indicate the rate at which the system transforms from an ordered state to a disordered state during the execution of a function, reflecting the degree of disturbance caused to the overall stability of the system during the execution of the function. The larger the entropy dissipation rate, the more severe the disturbance caused by the function execution to the system resources and state, and the faster the system turns from an ordered state to a disordered state, which may lead to increased instability of the system; while the smaller the entropy dissipation rate, the weaker the impact of the function on the system, the better the orderliness of the system can be maintained, the more stable the resource consumption, and the more stable the system state.

[0094] The process of obtaining the nonlinearity of the execution path is:

[0095] When the function is executed, the control flow structure inside the function is collected, that is, each branch node B i and loop node L i These nodes reflect the branch points and loop times of path selection during function execution. By dynamically tracing the execution path, all branch nodes and loop nodes passed by each function are recorded, and the depth and nesting level of these nodes are marked.

[0096] B i : The i-th branch node represents the path bifurcation point in the function and determines the different choices of the execution path.

[0097] L i : The i-th loop node represents the loop structure in the control flow and reflects the nesting and repeated execution of the loop.

[0098] D(B i ): The depth of the branch node, which indicates the hierarchical position of the branch in the entire control flow graph. The deeper the position, the higher the complexity of the path selection.

[0099] N(L i ): The nesting level of the loop node, which indicates the level of the current loop in the multiple loops. The more nesting levels there are, the greater the path complexity.

[0100] The uncertainty of each path is calculated through the collected branch nodes and loop nodes. For each branch node, the path bifurcation index of the node is calculated according to its depth and the number of selected paths. For each loop node, its nesting level and the number of loops are calculated to reflect the complexity of repeated execution in the path. Then, the influence of branches and loops is combined to obtain the uncertainty change value of each path.

[0101] P(B i ): The uncertainty change of the branch node is defined as the path bifurcation index of each branch node, which is proportional to the branch depth. The formula is: ; Among them, n(B i ) is the number of path choices corresponding to the branch node. This formula indicates that the greater the branch depth and the fewer the path choices, the higher the uncertainty of the path.

[0102] R(L i ): The complexity change of the loop node, defined as the combination of the nesting level and the number of loops of each loop node, is as follows: ; Among them, C(L i ) is the number of loops of the corresponding loop node.

[0103] Integrate the uncertainty changes of all paths into the nonlinearity of a path, combine the change values ​​of the branch nodes and loop nodes in the path, and calculate the execution path nonlinearity EPN of the entire path. Finally, it is calculated by the following formula: ;

[0104] EPN: Execution path nonlinearity, which represents the complexity caused by branch and loop structures during path execution.

[0105] T total : The total execution time of the function.

[0106] B(t): The number of branch nodes of the function in time slice t.

[0107] L(t): The number of loop nodes of the function in time slice t.

[0108] P(B t ) and R(L t ) are the complexity changes of branch nodes and loop nodes respectively.

[0109] By integrating the branch nodes and loop nodes during the function execution process, the uncertainty and complexity of the path are accumulated in the entire execution cycle. Through time integration, the dynamic changes of path selection and the impact of complex structures in the control flow on the execution path are reflected.

[0110] The nonlinearity of the execution path is used to indicate the complexity and uncertainty of the internal control flow of the function during execution, reflecting the complexity of the path selection, the depth of the branch structure, and the level of loop nesting. The larger the nonlinearity of the execution path, the more branches and bifurcations there are in the function execution path, the deeper the nesting level, the higher the uncertainty and complexity in the execution process, and the more complex and unpredictable the path selection is; while the smaller the nonlinearity of the execution path, the simpler the path structure is, the fewer branches and loop nestings there are, and the more linear and predictable the function execution process is.

[0111] In order to eliminate the unit effect, the entropy dissipation rate and the execution path nonlinearity are transformed into dimensionless form. The dimensionless formulas of entropy dissipation rate and execution path nonlinearity are as follows: ; ;

[0112] Among them, EDR norm and EPN norm They represent the dimensionless entropy dissipation rate and execution path nonlinearity, respectively, and are scaled to the range of 0, 1 to eliminate the direct impact of different units.

[0113] In order to comprehensively consider the interaction between system disturbance and path complexity, the two are combined through nonlinear functions. Logarithmic functions and exponential functions are used to characterize the relationship between the two, and the disturbance path index DPI is calculated to reflect the comprehensive effect of different parameters on the system: ;

[0114] The first part of the formula Nonlinearity combines two normalization parameters. A logarithmic function is used for the entropy dissipation rate to compress its growth into a smoother curve, while an exponential function is used for the execution path nonlinearity to emphasize the impact of path complexity on the sorting.

[0115] The second part of the formula Reflects the degree of difference between the two indicators. It captures the relative difference between the two indicators in absolute value form, and adds a small amount of ε to avoid the denominator being zero. This item is used to enhance the impact of the difference between the two indicators on the ranking, ensuring that when the gap between the two indicators is large, the sensitivity of the ranking can be improved.

[0116] The multiplication of the two parts reflects the interaction between entropy dissipation and path nonlinearity, ensuring that when one indicator is too high, the overall ranking value will be adjusted accordingly, and when the two are balanced, the ranking is more inclined to a function of smooth execution.

[0117] When the perturbation path index value is large, it means that the entropy dissipation of the function is large or the path complexity is high. The system will experience large perturbations and complex path selection when executing the function. It will be placed at a lower priority during sorting to avoid excessive load on the system.

[0118] When the perturbation path index value is small, it means that the entropy dissipation of the function is small and the path is simpler. The function has little impact on the system and will be placed at a higher priority position during sorting for priority execution.

[0119] The perturbation path index is used to indicate the degree of perturbation of the function to the ordered state of the system during execution and the complexity of path selection, reflecting the comprehensive impact of the function on stability and controllability during system execution. The larger the value, the greater the system perturbation caused by the function execution and the higher the path complexity, the greater the uncertainty and resource occupation risk during execution, and its priority should usually be lowered to avoid impacting system stability; the smaller the value, the less perturbation caused by the function execution to the system and the more linear and predictable the path, and it is suitable to be called at a higher priority to improve the overall execution efficiency and stability of the system.

[0120] Using an adaptive threshold mechanism during the sorting process can significantly optimize the decision-making process of function calls, allowing the system to maintain the original order when there are small differences, while making further adjustments when there are large differences. Compared with simple fixed thresholds, this mechanism has higher flexibility and pertinence. The following are the specific processing details:

[0121] Step 1: Calculate the adaptive threshold △ adaptive , whose size changes dynamically according to the current system resource usage and load fluctuation. It is specifically defined as: ;

[0122] Among them, γ is the reference threshold (initial setting), σ load is the current system load fluctuation rate, is the average value of the function perturbation path index in the current batch. This formula associates the average level of the perturbation path index with the system load, so that the threshold tends to be smaller when the load is stable, and is automatically relaxed when the load fluctuates greatly.

[0123] Step 2: For the functions of the current batch, if the perturbation path index difference between the two functions is If it is not greater than the adaptive threshold, the original sorting is retained and the calling order is not adjusted.

[0124] Adaptive thresholds ensure that unnecessary sorting adjustments are not made when the system load is low or stable. When the load is high or fluctuating, more sorting adjustments are allowed by relaxing the threshold conditions, which helps to better allocate resources under high load.

[0125] Step three: divide the functions that meet the threshold requirements into efficient execution groups in the original order and call them in batches. The disturbance path index of these functions is small and the disturbance to the system is similar, so they are scheduled first to reduce the execution time overhead.

[0126] On the basis of executing batch calls within the group, high-frequency sorting overhead is reduced through group scheduling, and task switching and system resource allocation overhead are reduced when similar perturbation path index value functions are called in batches.

[0127] Through the processing of step S3, real-time monitoring of system resource occupancy and path complexity during function execution is achieved, and the perturbation path index is generated by combining the two core parameters of entropy dissipation rate and execution path nonlinearity, and the sorting decision is further optimized through the adaptive threshold mechanism. When the system load is stable, unnecessary sorting adjustments are avoided, reducing the overhead of system resources and time. When the load fluctuates greatly, the adaptive threshold can be dynamically relaxed, and the sorting can be flexibly adjusted to ensure reasonable resource allocation. The group scheduling mechanism reduces the cost of task switching and resource reallocation by batch executing functions with similar perturbation path indexes, effectively improving the execution efficiency and stability of the system, and ensuring the smoothness and response speed of the system operation under high load conditions.

[0128] Step S4 includes the following contents:

[0129] According to the perturbation path index generated in step S3, each function task is executed according to the optimization result, and the real-time memory management mechanism is used to ensure that system resources can be released in time after the task is executed to avoid resource occupation and waste. In addition, the process will intelligently monitor the memory load and system status to ensure that resource redistribution and release strategy are adjusted when the load fluctuates greatly, thereby further improving the stability and execution efficiency of the system.

[0130] The function tasks are executed according to the perturbation path index calculated in step S3. The main program calls the functions in sequence according to the sorting priority through the scheduling system, and allocates the required system memory resources to each function. Memory allocation will be intelligently allocated based on the memory requirements of the task, the current system resource status, and the perturbation path index value to ensure that high-priority tasks obtain sufficient resources, while low-priority tasks dynamically adjust resource allocation according to the system load. Specifically, the memory allocation of tasks follows the following formula: ;

[0131] Among them, M alloc The memory resources allocated to the task, M available is the current available memory of the system. This formula ensures that tasks with smaller perturbation path index are allocated more memory resources, ensuring their fast and efficient execution.

[0132] By combining the disturbance path index with memory allocation, resource usage is dynamically optimized, and more system resources are preferentially allocated to tasks with low disturbance and simple paths to ensure that they can be completed quickly, thereby reducing the system load.

[0133] During the task execution process, the main program tracks the task execution status in real time through the embedded monitoring module, including memory usage, execution time and task completion. The monitoring module is not only responsible for capturing the execution efficiency of the task, but also continuously checks whether the resources meet the task requirements. Especially under high load conditions, the system will monitor whether the resources are insufficient or overflowing. Based on the real-time monitoring data, the program can dynamically adjust the memory allocation of the task to ensure that high-priority tasks get enough resources.

[0134] After the task is completed, the main program will immediately release the memory resources occupied by the task to ensure that system resources can be recovered in time for subsequent tasks. The memory release process not only relies on the traditional memory management mechanism, but also combines the historical data of the disturbance path index. By analyzing the historical disturbance path index, the system can predict the memory requirements of subsequent tasks, thereby intelligently managing the released memory. The specific memory recovery strategy formula is: ;

[0135] Among them, M release is the amount of memory released, M alloc is the amount of memory allocated, △DPI next is the difference between the perturbation path index of the next task and the current task, and △t is the time interval between the two tasks. This formula ensures that when the perturbation path index of the subsequent task increases faster, more memory will be released to ensure that high-load tasks have sufficient resources to execute.

[0136] The memory release strategy based on the historical data of the perturbation path index not only ensures the timely recovery of memory resources, but also optimizes the allocation and release of memory in advance by predicting the resource requirements of future tasks, thus avoiding insufficient system resources or waste of resources.

[0137] Under high load or abnormal conditions, the main program dynamically adjusts the load distribution strategy through real-time feedback of the perturbation path index and memory usage. When the system load is too high, the program will use the "task reduction" strategy, that is, skipping or delaying the execution of tasks with large perturbation path index values ​​to ensure the stability of the system. If the system memory is abnormal (such as overflow or leakage), the memory will be reallocated through the memory fallback mechanism to ensure that the task can be executed in a safe state.

[0138] The present invention prioritizes the rapid execution of tasks with small disturbances to the system and simple paths through dynamic memory allocation and intelligent sorting based on the disturbance path index, thereby improving the utilization efficiency of system resources and shortening the response time of high-priority tasks. Memory resources are released in a timely manner after the task is completed, effectively preventing resource waste and memory occupancy accumulation, and ensuring the continuous and efficient operation of the system. At the same time, the memory recovery strategy combined with historical disturbance path index data realizes predictive management of resource allocation, allowing the system to maintain stable load regulation and exception handling capabilities when under high load or resource constraints, significantly enhancing the stability of the system and overall execution efficiency.

[0139] The above formulas are all dimensionless and numerical calculations. The formula is a formula for the most recent real situation obtained by collecting a large amount of data and performing software simulation. The preset parameters in the formula are set by technicians in this field according to actual conditions.

[0140] The above description is only by way of illustration of certain exemplary embodiments of the present invention. It is undoubted that those skilled in the art can modify the described embodiments in various ways without departing from the spirit and scope of the present invention. Therefore, the above drawings and descriptions are illustrative in nature and should not be construed as limiting the scope of protection of the claims of the present invention.

[0141] It should be noted that, in this article, if there are relational terms such as first and second, etc., they are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "including a..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0142] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. An efficient function test dynamic calling method, characterized in that: Includes steps: S1, separate the test main program from the function, determine the function path according to the configuration file and dynamically load it when calling; S2, set the standardized input and output interface of the function, adjust the input parameters according to the configuration file and define the output format; S3, real-time monitoring of resource consumption and execution path structure during function execution, so as to dynamically sort the function call order; S4, execute the task according to the optimized calculation results, and release the corresponding memory resources immediately after the function is executed; Step S4 includes the following contents: Memory allocation will be intelligently allocated based on the task's memory requirements, the current system resource status, and the perturbation path index value to ensure that high-priority tasks obtain sufficient resources, while low-priority tasks dynamically adjust resource allocation based on system load; specifically, task memory allocation follows the following formula: ; Among them, M alloc The memory resources allocated to the task, M available The current available memory of the system; During the task execution, the main program tracks the task execution status in real time through the embedded monitoring module, including memory usage, execution time and task completion; After the task is completed, the main program will immediately release the memory resources occupied by the corresponding task to ensure that the system resources can be recovered in time for subsequent tasks. By analyzing the historical disturbance path index, the memory requirements of subsequent tasks are predicted, so as to manage the released memory. The memory recovery strategy formula is: ; Among them, M release is the amount of memory released, M alloc is the amount of memory allocated, △DPI next is the difference in perturbation path index between the next task and the current task, and △t is the time interval between the two tasks.

2. The method for efficiently dynamically calling a functional test according to claim 1, characterized in that: Step S1 includes the following contents: S1.1, first, store all test functions in an independent directory structure. Each function corresponds to an independent file. The file path is associated with a unique identifier. The configuration file is responsible for managing the path information of these functions and storing them in the form of key-value pairs. Each key is the function name and the value is the corresponding storage path. S1.2, when the main program is started, it first reads the configuration file to obtain the function path information, and according to the preset task flow, only when the corresponding function needs to be called during execution, it loads the corresponding function file through the path; S1.3, the main program uses the reflection mechanism to load and call the function at runtime according to the definition of the function path in the configuration file; in the specific implementation process, the main program uses the dynamic loader to parse the function name and parameter signature, and finds and executes the corresponding function entry through reflection; S1.4, after dynamically loading and executing the function, the execution results of the function are uniformly processed; the output of all test functions follows the pre-defined interface specifications, including output data type and output structure. The main program encapsulates the results returned by the function by reading the output specifications defined in the configuration file to ensure that the results can interact seamlessly with the main program.

3. The method for efficiently dynamically calling a functional test according to claim 2, characterized in that: Step S2 includes the following contents: For each test function, according to the different requirements of different functions for parameters, the input data is converted into a format that meets the function requirements through a type converter when the function is called; The configuration file defines the entry parameters of each test function. Before calling the function, the main program first obtains the parameter settings by reading the configuration file and adjusts the parameters according to the current test requirements. The dynamic adjustment of input parameters is achieved through the parameter mapping table; the parameter mapping table stores the mapping relationship of input parameters of different functions, and the main program binds parameters according to the mapping table when calling through the table lookup mechanism; The output interface standardization is achieved through the dynamic data wrapper; the dynamic data wrapper automatically generates a standardized data structure according to the output definition in the configuration file, so that the output of the function is seamlessly transmitted in different test scenarios, and formats the data according to the rules in the configuration file to ensure that the output results meet the preset requirements; Before calling a function, the main program will pre-verify the input parameters. Similarly, after the function is executed, the output results will also be verified through a standardized verification mechanism. If the verification fails, an error report will be automatically generated and the parameter configuration will be rolled back.

4. The method for efficiently dynamically calling a functional test according to claim 3, characterized in that: Step S3 includes the following contents: During the test, the resource consumption status and execution path structure during function execution are monitored in real time to obtain the key influencing factors of the function execution process, including entropy dissipation rate and execution path nonlinearity.

5. The method for efficiently dynamically calling a functional test according to claim 4, characterized in that: The process of obtaining the entropy dissipation rate is: During the function execution process, the system's timing behavior, that is, the task completion time at different stages, is collected; for the task completion status of each time slice, the start and end time of the task is recorded, and a timing fluctuation curve is established; During the execution of a function, the transmission rate and directionality of the data flow are analyzed. The data flow is regarded as the core ordered structure of the system. By measuring the rate changes of input and output data packets during the execution of the function, a data flow change curve is generated. After obtaining the time series fluctuation data and data flow changes, the entropy dissipation rate is obtained by combining the time series behavior with the data flow changes. The specific calculation formula is: ; EDR: Entropy dissipation rate; T total : The overall execution time of the function; F in (t): input data flow rate of the function at time slice t; F out (t): the output data flow rate of the function at time slice t; T i : The time it takes to complete a task within time slice t, representing timing fluctuations.

6. The method for efficiently dynamically calling a functional test according to claim 5, characterized in that: The process of obtaining the nonlinearity of the execution path is: When the function is executed, the control flow structure inside the function is collected, that is, each branch node B i and loop node L i ,By dynamically tracing the execution path, we record all the branch nodes and loop nodes passed by each function when executing, and mark the depth and nesting level of these nodes; B i : The i-th branch node, representing the path bifurcation point in the function; L i : The i-th loop node represents the loop structure in the control flow; D(B i ): the depth of the branch node; N(l i ): the nesting level of loop nodes; P(B i ): The uncertainty change of the branch node is defined as the path bifurcation index of each branch node, which is proportional to the branch depth. The formula is: ; Among them, n(B i ) is the number of path selections corresponding to the branch node; R(L i ): The complexity change of the loop node, defined as the combination of the nesting level and the number of loops of each loop node, is as follows: ; Among them, C(L i ) is the number of loops of the corresponding loop node; Integrate the uncertainty changes of all paths into the nonlinearity of a path, combine the change values ​​of the branch nodes and loop nodes in the path, and calculate the execution path nonlinearity EPN of the entire path: ;EPN: execution path nonlinearity;T total : the total execution time of the function; B(t): the number of branch nodes of the function in time slice t; L(t): the number of loop nodes of the function in time slice t; P(B t ) and R(L t ) are the complexity changes of branch nodes and loop nodes respectively.

7. The method for efficiently dynamically calling a functional test according to claim 6, characterized in that: Step S3 also includes the following: The entropy dissipation rate and the nonlinearity of the execution path are processed by dimensionless transformation, EDR norm and EPN norm They represent the dimensionless entropy dissipation rate and the nonlinearity of the execution path respectively. The two are combined through a nonlinear function to calculate the disturbance path index DPI: ; Step 1: Calculate the adaptive threshold △ adaptive , whose size changes dynamically according to the current system resource usage and load fluctuations, and is specifically defined as: ; where γ is the reference threshold, σ load is the current system load fluctuation rate, is the average value of the function perturbation path index in the current batch; Step 2: For the functions of the current batch, if the perturbation path index difference between the two functions is If it is not greater than the adaptive threshold, the original sorting is retained and the calling order is not adjusted; Step three: divide the functions that meet the threshold requirements into efficient execution groups in the original order and call them in batches. The disturbance path index of these functions is small and the disturbance to the system is similar, so they are scheduled first to reduce the execution time overhead.

Citation Information

Patent Citations

  • Adaptive adjustment policy-based DRX mechanism communication method

    CN109462839A

  • Efficient high-throughput calculation task scheduling method

    CN118656181A