System performance test method and apparatus, and computer device and storage medium

By inserting the target code into the system function of the embedded operating system and detecting it layer by layer, the problem of high resource consumption in the existing technology is solved, and the performance test of the embedded operating system is refined and efficient.

WO2024183429A1PCT designated stage expired Publication Date: 2024-09-12CHINA ELECTRONICS RELIABILITY AND ENVIRONMENTAL TESTING INSTITUTE ((THE FIFTH INSTITUTE OF ELECTRONICS MINISTRY OF INDUSTRY AND INFORMATION TECHNOLOGY) (CHINA SAIBAO LABORATORY)

Patent Information

Application Number
PCT/CN2023/143128
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-03-08
Filing Date
2023-12-29
Publication Date
2024-09-12

AI Technical Summary

Technical Problem

Existing system performance testing methods need to frequently call system functions to obtain timestamps and apply for resources when testing embedded operating systems, resulting in large resource consumption. They can only detect six key operating time parameters of the real-time operating system and cannot accurately locate the time. The specific operational phase of lag.

Method used

By inserting the target code into the system function corresponding to the performance category to be tested, the execution time of the function is obtained, and when the target conditions are not met, the lower-level functions are detected layer by layer, thereby reducing the number of target code insertions and reducing resource consumption.

Benefits of technology

It effectively reduces resource consumption during system performance testing, enables more precise detection of function execution time, locates specific code or system defects that cause low performance, and improves testing efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023143128_12092024_PF_FP_ABST
    Figure CN2023143128_12092024_PF_FP_ABST
Patent Text Reader

Abstract

The present application relates to a system performance test method and apparatus, and a computer device and a storage medium. The method comprises: acquiring a performance category to be tested of a tested system, and determining a system function corresponding to said performance category; inserting a first target code into a target detection position of a top-layer function in the system function, so as to obtain a first function; when a first test result obtained by testing the first function does not meet a first target condition, inserting a second target code into a target detection position of a lower-layer function of the top-layer function, so as to obtain a second function; and when a second test result obtained by testing the second function meets a second target condition, obtaining a performance test result of said performance category on the basis of the first test result and the second test result. The use of the method can reduce the consumption of system resources.
Need to check novelty before this filing date? Find Prior Art

Description

System performance testing method, device, computer equipment and storage medium Technical Field

[0001] The present application relates to the technical field of embedded system performance testing, and in particular to a system performance testing method, apparatus, computer equipment, and storage medium. Background Art

[0002] Current real-time performance testing metrics for embedded operating systems primarily focus on the timing parameters of six key RTOS operations: task switching time, interrupt response time, preemption time, semaphore shuffling time, deadlock release time, and message delivery latency. Existing system performance testing methods primarily rely on inserting specific functions at the start and end of interrupt functions to obtain the real-time timing at those locations, ultimately determining the function's execution time.

[0003] However, when conducting system performance testing, the existing technology needs to call system functions to obtain timestamps and apply for system resources. In addition, the existing methods only consider the time parameters of the six key operations of the real-time operating system. Although this can be used to discover whether the real-time performance of a large functional module in the operating system can meet the requirements during the testing phase, it still requires various detections and investigations to determine at which specific operating stage the module has a time lag problem, which will lead to the problem of excessive consumption of system resources.

[0004] Summary of the Invention

[0005] Based on this, it is necessary to provide a system performance testing method, apparatus, computer equipment and computer-readable storage medium that can reduce the consumption of system resources in order to address the above technical problems.

[0006] In a first aspect, the present application provides a system performance testing method, the method comprising:

[0007] Obtaining a performance category to be tested of the system under test, and determining a system function corresponding to the performance category to be tested;

[0008] Inserting a first target code into a target detection position of a top-level function in the system function to obtain a first function;

[0009] When a first test result obtained by testing the first function does not meet a first target condition, inserting a second target code into a target detection position of a lower function of the top function to obtain a second function;

[0010] When a second test result obtained by testing the second function meets a second target condition, a performance test result of the performance category to be tested is obtained based on the first test result and the second test result.

[0011] In one embodiment, the method further comprises:

[0012] Obtaining a performance test result and a weight of each performance category to be tested;

[0013] Converting the time data in each of the performance test results into performance score data;

[0014] Based on each of the weights and each of the performance score data, a test result of the system under test is obtained.

[0015] In one embodiment, the target detection position includes the head position and the tail position of the function;

[0016] Inserting a first target code into a target detection position of a top-level function in the system function to obtain a first function includes:

[0017] Generate an abstract syntax tree of the performance category to be tested using a syntax analysis tool, and determine a function hierarchical result of the system function of the performance category to be tested based on the abstract syntax tree;

[0018] A top-level function in the function hierarchical result is obtained, and a first target code is inserted into the head position and the tail position of the top-level function to obtain a first function.

[0019] In one embodiment, when a first test result obtained by testing the first function does not meet a first target condition, inserting a second target code at a target detection position of a lower function of the top-level function to obtain a second function includes:

[0020] Obtaining function hierarchical results of system functions of the performance category to be tested;

[0021] When the first test result does not meet the target condition, determining a lower layer function of the top layer function based on the function layering result;

[0022] Inserting a second target code into a target detection position of a lower function of the top-level function to obtain a second function;

[0023] The method further comprises:

[0024] The second function is tested using the test code corresponding to the performance category to be tested to obtain a second test result.

[0025] In one embodiment, the number of the first function and the number of the second function are at least two;

[0026] Inserting a first target code into a target detection position of a top-level function in the system function to obtain a first function includes:

[0027] Inserting a first target code at a target detection position of each top-level function in the system function to obtain a plurality of first functions;

[0028] Testing each of the first functions separately to obtain first test results of each of the plurality of first functions;

[0029] When a first test result obtained by testing the first function does not meet a first target condition, inserting a second target code into a target detection position of a lower function of the top-level function to obtain a second function includes:

[0030] Obtaining, from the plurality of first functions, a target first function for which the first test result does not satisfy a target condition;

[0031] According to the function hierarchical result of the system function of the performance category to be tested, a second target code is inserted into the target detection position of each lower-layer function of the target first function to obtain a plurality of second functions.

[0032] In one embodiment, the method further comprises:

[0033] When the second test result does not meet the target condition, the lower-level functions of the function that does not meet the target condition are tested in sequence according to the function layering results of the system function of the performance category to be tested until there is no lower-level function of the target function.

[0034] In one embodiment, the method further comprises:

[0035] When the target code at the target detection position corresponding to the function is executed, obtaining a level change of an oscilloscope connected to the system under test; the function includes each function in the system function corresponding to the performance category to be tested;

[0036] Based on the level change, a test result of the function is determined.

[0037] In a second aspect, the present application provides a system performance testing device, the device comprising:

[0038] A function determination module is used to obtain the performance category to be tested of the system under test and determine the system function corresponding to the performance category to be tested;

[0039] A target code insertion module, configured to insert a first target code into a target detection position of a top-level function in the system function to obtain a first function;

[0040] a first function testing module configured to, when a first test result obtained by testing the first function does not satisfy a first target condition, insert a second target code into a target detection position of a lower function of the top-level function to obtain a second function;

[0041] The second function testing module is used to obtain a performance test result of the performance category to be tested based on the first test result and the second test result when a second test result obtained by testing the second function meets a second target condition.

[0042] In a third aspect, the present application provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.

[0043] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of the above method when executed by a processor.

[0044] In a fifth aspect, the present application provides a computer program product, comprising a computer program, which implements the steps of the above method when executed by a processor.

[0045] The above-mentioned system performance testing method, apparatus, computer equipment and storage medium can reduce the amount of target code inserted during system performance testing, thereby reducing the consumption of system resources, by inserting a first target code into the target detection position of the top-level function in the system function corresponding to the performance category to be tested, and then testing the obtained first function, and when the first test result does not meet the first target condition, testing the lower-level function of the top-level function, and when the second test result meets the second target condition, stopping the insertion and testing of the target code of the lower-level function. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] FIG1 is an application environment diagram of a system performance testing method according to an embodiment;

[0047] FIG2 is a schematic diagram of a flow chart of a system performance testing method according to an embodiment;

[0048] FIG3 is a schematic diagram of a function layering result in one embodiment;

[0049] FIG4 is a schematic diagram of a fine-grained testing algorithm flow in one embodiment;

[0050] FIG5 is a schematic flow chart of a system performance testing method according to another embodiment;

[0051] FIG6 is a schematic diagram of the connection of a test device in one embodiment;

[0052] FIG7 is a block diagram of a system performance testing device according to an embodiment;

[0053] FIG8 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0054] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.

[0055] The system performance testing method provided in the embodiment of the present application can be applied to the application environment shown in Figure 1. In which, the terminal 102 communicates with the server 104 via the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The server 104 obtains the performance category to be tested of the system under test that needs to be performance tested, and then determines the system functions corresponding to each performance category to be tested of the system under test. After the server 104 obtains the top-level function in the system function of the performance category to be tested, it inserts the first target code at the target detection position of the top-level function to obtain the first function. When the server 104 detects that the first test result of the first function does not meet the first target condition, it searches the lower-level function of the top-level function and inserts the second target code at the target detection position of the lower-level function to obtain the second function. When the server 104 detects that the second test result of the second function meets the second target condition, the server 104 determines the performance test result of the performance category to be tested based on the first test result and the second test result. Terminal 102 may include, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices may include smart speakers, smart TVs, smart air conditioners, and smart car devices. Portable wearable devices may include smart watches, smart bracelets, and head-mounted devices. Server 104 may be implemented as a standalone server or a server cluster consisting of multiple servers.

[0056] In one embodiment, as shown in FIG2 , a system performance testing method is provided. The method is described by taking the server 104 in FIG1 as an example, and includes the following steps:

[0057] Step 202: Obtain the performance category to be tested of the system under test, and determine the system function corresponding to the performance category to be tested.

[0058] The system under test (SUT) refers to the operating system development board to be tested. The SUT, oscilloscope, and host under test are connected in pairs. The oscilloscope's level changes are used to describe the function's runtime and status. For example, if the oscilloscope's level jumps from low to high, it indicates that the function is executing. When the function drops from high to low, it indicates that the function has completed execution. The duration of the level rising from low to high is the function's runtime. For example, if the level jumps from low to high at time 0 and then drops back to low 30 nanoseconds later, it indicates that the function's execution time is 30 nanoseconds. The oscilloscope's potential signal and time variation range are synchronously transmitted to the test host. The test host also receives the function names stored in a stack in the SUT. Each time the oscilloscope's potential signal drops, a function name is retrieved from the stack. The duration of the oscilloscope's level at that level and the retrieved function name are used as the test result for the performance category being tested.

[0059] The test host allows users to select the performance category to be tested. For example, if a user wishes to test the system under test under performance category A, they must select this option on the test host. For each performance category, the test host will program the corresponding pre-designed test code into the system under test. The test host also includes a target code insertion tool and a syntax analysis tool. The target code insertion tool inserts target code at specific locations in a function, while the syntax analysis tool generates an abstract syntax tree.

[0060] The performance categories tested primarily include the time parameters of six key operations: task switching time, interrupt response time, preemption time, semaphore shuffling time, deadlock resolution time, and message delivery latency. These times are incurred when a user program calls system functions. Two tasks, A and B, are created within the main task M. Tasks A and B have the same priority but are lower than M's. M's priority is then set lower than A and B, and M is suspended. Since A and B have the same priority, they are executed sequentially in the ready queue. When one task completes, a system call is generated, switching to the next task. The duration of this system call is the task switching time. Task A is created within the main task M and loaded with an interrupt service routine. Task A continuously triggers interrupts during the test. When an interrupt occurs, Task A is suspended, and the system begins saving Task A's system environment and setting up the interrupt service routine. The interrupt service routine then begins running. The time from the interrupt triggering to the start of the interrupt service routine is the interrupt response time. Two tasks, A and B, are created within the main task M. Task A has a higher priority than B but lower than M's. Then, M's priority is set lower than both A and B, and M is suspended. Because A has a higher priority, it runs first. However, the test code delays task A by one clock cycle, allowing task B to gain control of the system. After the delay expires, task A wakes up and, because it has a higher priority than B, begins preempting task B's system resources. Ultimately, B is suspended, and A begins running. The time from A's wakeup to its start is the task preemption time. Semaphore shuffling time refers to the delay between a task releasing a semaphore and the activation of another task waiting for the semaphore. During the test, a task M is designed that repeatedly acquires and releases a semaphore to simulate the task synchronization function of a semaphore. The time from releasing a semaphore to regaining it is the semaphore shuffling time. Within the main task M, a mutex semaphore and tasks A, B, and C are created, with priorities A > B > C. Task C is scheduled to run first, and after task C acquires the critical mutex semaphore, it wakes up task A. Since the critical resource has already been acquired by C, A is suspended, waiting for the critical resource to be released. At this point, task B is activated and begins executing in an infinite loop. At this point, C has resources but no priority, while A has priority but no resources. The system enters a deadlock, and the operating system will find a way to resolve the deadlock. The time from the deadlock's generation to its resolution (when A obtains the resource) is the deadlock resolution time. Two tasks, A and B, are created within the main task M. A sends a message, and the operating system's message buffer or channel data structure stores and forwards the message. B receives the forwarded message. The time from A sending a message to B receiving a message is the message delivery time.

[0061] A system function refers to the code segments involved in each performance category being tested. For example, if you want to test the performance of the task switching module of the system under test, this system function should at least have the following capabilities: generating tasks A and B, with task A calling task B and task B calling task A, thereby continuously running the task switching module and allowing the oscilloscope to collect operational data.

[0062] Optionally, the server controls the connections between the operating system development board under test, the test host, and the oscilloscope to be tested, and burns the pre-designed test code into the operating system development board under test. The server then selects the performance category to be tested of the operating system development board under test from the test host, and obtains the system function of the performance category to be tested.

[0063] Alternatively, the server connects the test host to the development board of the operating system under test via a USB (Universal Serial Bus) to serial cable. A serial debugging assistant is used to open the serial port, enabling communication between the test host and the operating system under test. A pin on the development board of the operating system under test is connected to an analog input channel of the oscilloscope. During the test, the target code inserts statements that operate on this selected pin. The oscilloscope and test host can be connected directly using an RS232 cable or via an Ethernet network.

[0064] Step 204: insert a first target code into the target detection position of the top-level function in the system function to obtain a first function.

[0065] The top-level function of a system function refers to the function at the first level of nodes, and the number is at least 1. For example, the function hierarchy of a system function is shown in Figure 3, where A represents the top-level function in the system function, B and C represent the second-level functions, D and E represent the lower-level functions of function B, and F, G, and H represent the lower-level functions of function E. There is no clear data on the number of function levels for each system function, but it can range from four or five levels to dozens or even hundreds of levels. The function hierarchy of each function in the system function is determined by the abstract syntax tree generated by the syntax analysis tool in the test host.

[0066] The target detection location refers to the location where the target code is inserted into each system function, including the function's header and tail. For example, when testing a function, inserting the target code at the function's header can detect whether the function has been executed. Another example is inserting the target code at both the function's header and tail to detect the function's runtime or whether the function has completed execution.

[0067] The first target code and the second target code are both target codes, and are both code segments that have the function of causing the level of the oscilloscope to jump. For example, when the first target code at the beginning of the function is executed, the level on the oscilloscope jumps from a low level to a high level, and when the first target code at the end of the function is executed, the level on the oscilloscope jumps from a high level to a low level. The specific code forms of the first target code and the second target code may be the same or different. The first function and the second function are both functions into which the target code is inserted.

[0068] Optionally, the server determines the top-level function of the system function based on the abstract syntax tree generated by the syntax analysis tool loaded in the test host, and inserts the first target code that can cause the level of the oscilloscope to jump at the head and tail positions of the top-level function to obtain the first function.

[0069] Optionally, the server determines the top-level function of the system function based on the abstract syntax tree generated by the syntax analysis tool loaded in the test host, and inserts the first target code that can cause the level of the oscilloscope to jump at the head or tail position of the top-level function to obtain the first function to detect whether the function is executed.

[0070] Optionally, the server determines each function at the top level of the system function based on the abstract syntax tree generated by the syntax analysis tool loaded in the test host, and inserts the first target code that can cause the level of the oscilloscope to jump at the head or tail position of each function to obtain multiple first functions to detect the running time of each function at the top level.

[0071] Step 206: When the first test result obtained by testing the first function does not meet the first target condition, insert the second target code into the target detection position of the lower function of the top-level function to obtain the second function.

[0072] Among them, the first target condition and the second target condition are both the execution time corresponding to the function, that is, the function's running time must be less than or equal to the execution time to meet the target condition. For example, function A is considered to be executed normally only when it is completed within 30 nanoseconds, but when function A is tested, function A actually runs for 40 nanoseconds before running to completion, which means that the test result of function A does not meet the corresponding target condition. For another example, function B is considered to be executed normally only when it is completed within 30 nanoseconds, but when function B is tested, function B actually runs for 25 nanoseconds, which means that the test result of function B meets the corresponding target condition. Since the execution time corresponding to each function may be the same or different, the first target condition and the second target condition can be the same or different.

[0073] Optionally, after the server runs the first function, it detects that the running time of the first function exceeds the corresponding execution time, that is, the first target condition is not met. The server then determines the lower-level function of the top-level function based on the abstract syntax tree, and inserts the second target code at the target detection position of the lower-level function to obtain the second function, and tests the second function.

[0074] In a specific application, the server detects that the run time of the first function is 30 nanoseconds, while the corresponding execution time of the first function is 25 nanoseconds. Therefore, the first test result of the first function does not meet the target condition. The server then determines the lower-level function of the top-level function based on the abstract syntax tree and inserts the second target code at the target detection position of the lower-level function to obtain the second function, and then tests the second function.

[0075] Step 208 : When a second test result obtained by testing the second function satisfies the second target condition, a performance test result of the performance category to be tested is obtained based on the first test result and the second test result.

[0076] Among them, when the first test result does not meet the first target condition, the lower-level function called by the top-level function is searched. If the second test result obtained after the lower-level function is inserted into the target code meets the second target condition, the search is no longer downward. The low performance is caused by other code defects in the top-level function. If the second test result of the lower-level function also does not meet the second test result, it is necessary to test the lower-level function called by the lower-level function, which is equivalent to testing the third-level function until the minimum function affecting the system performance is found. For example, as shown in Figure 3, A is the main program. The test finds that A does not meet the target condition, so the two functions B and C called by A are found. If B and C both meet the target condition, there is no need to locate downward. The low performance is caused by other code defects in program A. If any one of B and C does not meet the target condition, only the unsatisfied function node needs to be located downward. In addition, as the number of layers increases, the requirements for real-time performance will become more and more stringent.

[0077] Optionally, after the server tests the second function, it detects that the running time of the second function does not exceed the corresponding execution time, that is, the second target condition is met. Then, the performance test result of the performance category to be tested obtained by the server based on the first test result and the second test result is the low performance caused by other code defects in the top-level function.

[0078] In a specific application, when the server detects that the first test result does not meet the first target condition and the second test result meets the second target condition, it indicates that the low performance is caused by defects in other codes in the top-level function or the system itself. There is no need to locate downward, and the performance test result of the performance category to be tested can be directly output as the low performance caused by defects in other codes in the top-level function or the system itself.

[0079] In the above-mentioned system performance testing method, by inserting the first target code at the target detection position of the top-level function in the system function corresponding to the performance category to be tested, and then testing the obtained first function, and when the first test result does not meet the first target condition, testing the lower-level function of the top-level function, and when the second test result meets the second target condition, stopping the insertion and testing of the target code of the lower-level function, the number of target codes inserted during the system performance test can be reduced, thereby reducing the consumption of system resources.

[0080] In one embodiment, the system performance testing method further includes:

[0081] Obtain the performance test results and weights of each performance category to be tested.

[0082] Convert the time data in each performance test result into performance score data.

[0083] Based on each weight and each performance score data, the test result of the tested system is obtained.

[0084] The weight of each performance category to be tested is determined by the module call frequency and the module running time of each performance category to be tested. For example, the time when the task switching module, interrupt response module, preemption module, semaphore shuffling module, deadlock release module and message passing delay module are measured and normalized to (t1, t2, t3, t4, t5, t6) respectively. The calling frequency of the six modules during the use of the operating system is recorded as (f1, f2, f3, f4, f5, f6). Since the module with shorter time has higher importance, the final weight α of each module is calculated as follows: Among them, α i The frequency of module calls is the quotient of the number of times the module is called and the total number of times the six modules are called.

[0085] Time data represents the runtime of the module belonging to the performance category to be tested, that is, the time from the start to the end of the execution of the function in the system function corresponding to the performance category to be tested. The shorter the module runtime, the more important it is. Performance score data is obtained by normalizing the series of time data obtained from the test results, unifying the data range to the [0,1] interval. At the same time, since the smaller the time data, the better the real-time performance of the system, the formula for converting test time data into performance score data is: Where new represents the new normalized data; old represents the unnormalized data; min represents the minimum value in the data; and max represents the maximum value in the data. For example, if the unnormalized test time data is: old = [400ns, 600ns, 1.2us, 2.5us, 800ns, 50us], min = 400ns, max = 50us, the normalized performance score data is new = [1, 0.996, 0.984, 0.958, 0.992, 0].

[0086] The test result of the system under test is determined by the sum of the product of the weight of each performance category under test and the corresponding performance score data. For example, if performance category A has a weight of a and a performance score of X, and performance category B has a weight of b and a performance score of Y, the total test score of the system under test is aX + bY. A higher total score indicates better real-time performance of the system under test.

[0087] Optionally, the server obtains the runtime of the modules belonging to each performance category to be tested, obtains the performance test results for each performance category to be tested, and determines the weight of each performance category to be tested based on the module call frequency and the runtime of each module to be tested. The server then determines the test result of the system under test based on the sum of the product of the weight of each performance category to be tested and the corresponding performance score data.

[0088] In this embodiment, the total test score of the system under test is calculated by weighted summation, which can comprehensively consider the performance of each performance category to be tested of the system under test, avoid incomplete evaluation, and thus reduce the error of the performance test of the system under test.

[0089] In one embodiment, the target detection position includes a head position and a tail position of the function.

[0090] Inserting a first target code into a target detection position of a top-level function in a system function to obtain a first function includes:

[0091] An abstract syntax tree of the performance category to be tested is generated using a syntax analysis tool, and a function hierarchical result of the system function of the performance category to be tested is determined based on the abstract syntax tree.

[0092] A top-level function in the function hierarchical result is obtained, and a first target code is inserted into the head position and the tail position of the top-level function to obtain a first function.

[0093] The syntax analysis tool is installed on the test host and is used to generate an abstract syntax tree corresponding to the performance category being tested. The abstract syntax tree is a tree-like representation of the abstract syntax structure of the source code. Each node in the tree represents a structure in the source code. It is abstract because the abstract syntax tree does not represent every detail of the actual syntax. For example, nested brackets are implicit in the tree structure and are not represented as nodes.

[0094] The function hierarchical result is used to search and extract the called functions by hierarchical traversal. For example, in the function hierarchical result obtained based on the abstract syntax tree, function A is the first layer, B and C are the second layer, and D, E, and F are the third layer. Then A is called first, then B and C, and finally D, E, and F. Function A also represents the top-level function. In the function calling process, the last called function returns first, which is consistent with the last-in-first-out feature of the stack in the data structure. In order to make the function and its test time correspond one to one, a stack is used to store the function name. For example, when a function is executed, the function name of the function is stored in the stack in real time.

[0095] Optionally, the server uses the syntax analysis tool in the test host to obtain the abstract syntax tree of the performance category to be tested, and then determines the top-level function of the system function based on the function hierarchical result obtained from the abstract syntax tree. After determining the top-level function, the server inserts the first target code that causes the oscilloscope level to jump at the head and tail positions of the top-level function to obtain the first function. The server then decides whether to continue searching downward based on the test result of the first function. If the test result of the first function does not meet the target condition, the server continues to search downward and puts the function name of the function into the stack.

[0096] In a specific application, as shown in Figure 4, the hierarchical traversal search algorithm begins with the archTaskCtxSwitch function. This function is then tested by inserting target code. If the function's test time falls within the normal range, the test ends. If the test finds a time lag, the next level of function information is searched for. A queue data structure is used to store the function names, allowing for sequential test times.

[0097] In this embodiment, the system functions of the predicted performance category are tested in layers according to the function layering results, and whether to insert and test the target code of the lower-level function is decided based on the test results of the upper-level function, thereby avoiding the operation of inserting the target code at the target detection position of each function, reducing the code expansion rate and improving the target code insertion efficiency.

[0098] In one embodiment, when a first test result obtained by testing the first function does not meet the first target condition, inserting a second target code at a target detection position of a lower function of the top-level function to obtain a second function includes:

[0099] Get the function hierarchical results of the system functions of the performance category to be tested.

[0100] When the first test result does not meet the target condition, a lower layer function of the top layer function is determined based on the function hierarchical result.

[0101] A second target code is inserted into a target detection position of a lower function of the top-level function to obtain a second function.

[0102] The second function is tested using the test code corresponding to the performance category to be tested to obtain a second test result.

[0103] The target detection position refers to the position where the target code of each function in the system function is inserted, which can be the head position of the function or the tail position of the function.

[0104] Optionally, the server searches for the lower functions of the top-level function based on the function hierarchical results obtained from the abstract syntax tree when the test result of the first function does not meet the target condition. The server inserts a second target code that causes the oscilloscope level to jump at both the head and tail positions of the lower function of the top-level function to obtain a second function. The server then tests the second function to obtain a second test result. The server then decides whether to continue searching downward based on the second test result. If the second test result does not meet the target condition, the server continues to search downward and insert the target code and test. If the second test result meets the target condition, the server stops searching. At the same time, the function name of the function is placed in the stack, that is, in the queue data structure.

[0105] In this embodiment, the system functions of the predicted performance category are tested in layers according to the function layering results, and whether to insert and test the target code of the lower-level function is decided based on the test results of the upper-level function. This avoids the operation of inserting the target code at the target detection position of each function, thereby reducing the waste of computer resources.

[0106] In one embodiment, as shown in FIG5 , the number of the first functions and the number of the second functions are both at least two.

[0107] Inserting a first target code into a target detection position of a top-level function in a system function to obtain a first function includes:

[0108] Step 502: insert the first target code into the target detection position of each top-level function in the system function to obtain a plurality of first functions.

[0109] Each layer of the system function contains at least two functions. For example, the first layer contains functions A and B, the lower layer functions of function A contain functions C and D, and the lower layer functions of function B contain functions E, F, and G. When the first target code is inserted into the target detection positions of both function A and function B, then both function A and function B become the first function after the target code is inserted.

[0110] Step 504 : Obtain, from the plurality of first functions, a target first function corresponding to the test results that do not meet the target condition in the first test results.

[0111] The target first function refers to the function among the multiple first functions whose runtime does not meet the first target condition, that is, the function whose runtime exceeds the execution time. For example, if Function A and Function B in the first layer are each tested after inserting the first target code, and the test results show that Function A's runtime does not meet the first target condition, while Function B's runtime does meet the first target condition, then the function after Function A is inserted into the first target code will be the target first function corresponding to the test result that does not meet the target condition.

[0112] Optionally, the server tests the plurality of first functions using the test code generated by the test host to obtain first test results corresponding to the first functions, and determines, based on the first test results, the target first function whose running time exceeds the execution time.

[0113] Step 506 : According to the function hierarchical result of the system function of the performance category to be tested, insert the second target code into the target detection position of each lower-layer function of the target first function to obtain multiple second functions.

[0114] The target detection position includes the function header position and the function tail position. When performing the second target code insertion operation, the second target code can be inserted at the function header position or the function tail position to detect whether the function is executed, or the second target code can be inserted at both the function header position and the function tail position to detect the function's running time.

[0115] In this embodiment, functions are tested in layers according to the function layering results, and a step-by-step approach is adopted. Only when the test result of the upper-level function node is abnormal, the lower-level function will be searched downward and the target code will be inserted and tested. This can reduce the number of target code insertions and reduce the consumption of system resources.

[0116] In one embodiment, the system performance testing method further includes:

[0117] When the second test result does not meet the target condition, the lower layer functions of the function that does not meet the target condition are tested in sequence according to the function layering results of the system function of the performance category to be tested until there is no lower layer function of the target function.

[0118] The target function is the lowest-level function in the system, meaning it has no underlying functions. For example, if the test result of function A does not meet the target condition, meaning its execution time exceeds the specified execution time, but there is no callable function in the underlying layer of function A, then function A is the target function.

[0119] Optionally, when the server detects that the second test result still does not meet the target condition, it inserts and tests the target code of the lower-level function corresponding to the function of the second test result according to the function hierarchical result, until the lowest-level function corresponding to the test result in the system function that does not meet the target condition is searched, and the test is terminated.

[0120] In this embodiment, after obtaining the second test result that does not meet the target condition, the target code of the lower-level function of the function that does not meet the target condition is inserted and tested according to the function layering result. The target code of the lower-level function can be inserted and tested in a targeted manner, reducing the insertion of the target code and thus avoiding code expansion.

[0121] In one embodiment, the system performance testing method further includes:

[0122] When the target code at the target detection position corresponding to the function is executed, a level change of an oscilloscope connected to the system under test is obtained. The function includes each function in the system function corresponding to the performance category to be tested.

[0123] Based on the level change, the test result of the function is determined.

[0124] The target code may be the first target code, the second target code, or other code segments inserted into the function that can cause the oscilloscope level to jump.

[0125] Optionally, when the server executes the target code inserted at the head and tail of each function in the system function, the level of the oscilloscope jumps. The server then determines the test result of the function based on the result of the level change in the oscilloscope.

[0126] In a specific application, target codes are inserted at both the head and tail positions of function A. When the target code at the head position of function A is executed, the oscilloscope level jumps from a low level to a high level and maintains a high-level signal. When the target code at the tail position of function A is executed, the oscilloscope level jumps from a high level to a low level. The duration of the high level is the running time of function A, which is also the test result of function A.

[0127] In this embodiment, the function call process and running time can be intuitively seen through the potential signal changes of the oscilloscope, avoiding the acquisition of timestamps and application of system resources, thereby reducing the error of real-time performance results.

[0128] The present application also provides an application scenario, which applies the above-mentioned system performance test method. Specifically, the application of the system performance test method in this application scenario is as follows: the conversion between the USB interface of the test host and the universal serial port is realized by a USB-to-serial port cable, providing a fast channel for a computer without a serial port so that it can communicate with the development board. The GPJ3 (7) GPIO (General Purpose Input Output) pin of the S5PV210 (Hummingbird, processor) on the development board of the system under test of the mini210s model is configured as an output mode, and the GPJ3 (7) GPIO pin is connected to the analog input channel CH1 of the DS1104Z digital oscilloscope. The USB cable is correctly connected between the oscilloscope and the test host, and the Tektronix Toolbar Start Preferences icon on the desktop of the test host is clicked, and Microsoft Excel is opened to connect TekW and the oscilloscope is identified by the TekW toolbar so that the test host can obtain the data of the oscilloscope. The connection diagram is shown in Figure 6. Test code for task switching time metrics is pre-designed on the test host. Since the thread context switch function of the Sylix operating system is the archTaskCtxSwitch function, the pre-designed test code capable of calling the archTaskCtxSwitch function must also be burned into the mini210s system-under-test development board. Simultaneously, a syntax analysis tool is used to obtain the abstract syntax tree of this function's execution process, specifically the order of the various functions called during execution, or the function hierarchy. Starting with the archTaskCtxSwitch function, target code is inserted and tested at both the head and tail of this function. If the runtime of the archTaskCtxSwitch function falls within the normal range, the test ends. If the runtime lags behind, the function node's next-level function information is searched, target code is inserted and tested for each of these next-level functions, and a queue data structure is used to store the function names so that the runtime of the functions can be obtained in sequence. During program execution, the voltage at the GPIO pin GPJ3(7) changes continuously as tasks are switched. The oscilloscope receives these voltage signal changes and records the corresponding running time, which is then transmitted to the test host. The test host then organizes these data to generate the final test report.

[0129] It should be understood that, although the steps in the flowcharts of the above embodiments are shown in sequence as indicated by the arrows, these steps are not necessarily performed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be performed in other orders. Moreover, at least a portion of the steps in the flowcharts of the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily to be performed in sequence, but can be performed in turn or alternately with other steps or at least a portion of steps or stages in other steps.

[0130] Based on the same inventive concept, the present application also provides a system performance testing device for implementing the aforementioned system performance testing method. The solution provided by this device is similar to the solution described in the aforementioned method. Therefore, the specific limitations in one or more system performance testing device embodiments provided below can be found in the above-mentioned limitations on the system performance testing method and will not be further elaborated here.

[0131] In one embodiment, as shown in FIG7 , a system performance testing device is provided, including:

[0132] The function determination module 702 is used to obtain the performance category to be tested of the system under test and determine the system function corresponding to the performance category to be tested.

[0133] The target code inserting module 704 is configured to insert a first target code into a target detection position of a top-level function in a system function to obtain a first function.

[0134] The first function testing module 706 is configured to insert a second target code into a target detection position of a lower function of the top-level function to obtain a second function when a first test result obtained by testing the first function does not satisfy a first target condition.

[0135] The second function testing module 708 is configured to obtain a performance test result of the performance category to be tested based on the first test result and the second test result when a second test result obtained by testing the second function meets a second target condition.

[0136] In one embodiment, the system performance testing device further includes:

[0137] The weight acquisition unit is used to acquire the performance test results of each performance category to be tested and the weight of each performance category to be tested.

[0138] The score acquisition unit is used to convert the time data in each performance test result into performance score data.

[0139] The test result obtaining unit is used to obtain the test result of the system under test based on each weight and each performance score data.

[0140] In one embodiment, the object code insertion module includes:

[0141] The first function hierarchical result obtaining unit is configured to generate an abstract syntax tree of the performance category to be tested using a syntax analysis tool, and determine a function hierarchical result of the system function of the performance category to be tested based on the abstract syntax tree.

[0142] The first function acquisition unit is used to acquire the top-level function in the function hierarchical result, and insert the first target code into the head position and the tail position of the top-level function to obtain the first function.

[0143] In one embodiment, the first function test module includes:

[0144] The second function hierarchical result obtaining unit is configured to obtain the function hierarchical result of the system function of the performance category to be tested.

[0145] The lower-layer function determination unit is used to determine the lower-layer function of the top-layer function based on the function hierarchical result when the first test result does not meet the target condition.

[0146] A second target code is inserted into a target detection position of a lower function of the top-level function to obtain a second function.

[0147] The second function test module includes:

[0148] The second test result obtaining unit is configured to test the second function using the test code corresponding to the performance category to be tested to obtain a second test result.

[0149] In one embodiment, the object code insertion module includes:

[0150] The first target code inserting unit is used to insert the first target code at the target detection position of each top-level function in the system function to obtain multiple first functions.

[0151] The first function testing unit is used to test each first function respectively to obtain first test results of each of the multiple first functions.

[0152] The first function test module includes:

[0153] The first test result determining unit is configured to obtain, from the plurality of first functions, a target first function corresponding to a test result that does not meet a target condition in the first test results.

[0154] The second target code inserting unit is used to insert the second target code into the target detection position of each lower layer function of the target first function according to the function layering result of the system function of the performance category to be tested, so as to obtain multiple second functions.

[0155] In one embodiment, the system performance testing device further includes:

[0156] The hierarchical search unit is used to test the lower-level functions of the function that does not meet the target condition in turn according to the function hierarchical results of the system function of the performance category to be tested when the second test result does not meet the target condition, until there is no lower-level function of the target function.

[0157] In one embodiment, the system performance testing device further includes:

[0158] The level change acquisition unit is used to acquire the level change of the oscilloscope connected to the system under test when the target code at the target detection position corresponding to the function is executed; the function includes each function in the system function corresponding to the performance category to be tested.

[0159] The function test result determination unit is used to determine the function test result based on the level change.

[0160] In one embodiment,

[0161] Each module in the above-mentioned system performance testing device can be implemented in whole or in part through software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in the computer device in the form of software, so that the processor can call and execute the corresponding operations of each module.

[0162] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in Figure 8. The computer device includes a processor, a memory, an input / output interface (I / O) and a communication interface. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The computer device's database is used to store the performance category to be tested of the system under test, the system function corresponding to the performance category to be tested, the top-level function in the system function, the first target code, the first function, the first test result, the first target condition, the lower-level function of the top-level function, the target detection position, the second target code, the second function, the second test result, the second target condition, the performance test results of the performance category to be tested, the weights of each performance category to be tested, performance score data, the test results of the system under test, the abstract syntax tree, the function hierarchical results, and the level change data of the oscilloscope. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a system performance testing method is implemented.

[0163] Those skilled in the art will understand that the structure shown in FIG8 is merely a block diagram of a portion of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.

[0164] In one embodiment, a computer device is further provided, including a memory and a processor. The memory stores a computer program, and the processor implements the steps in the above method embodiments when executing the computer program.

[0165] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0166] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0167] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions.

[0168] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processor involved in the various embodiments provided herein may be, but are not limited to, a general-purpose processor, a central processing unit (CPU), a graphics processing unit (GPU), a digital signal processor (DSP), a programmable logic unit (PLC), a data processing logic unit based on quantum computing, and the like.

[0169] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0170] The above embodiments merely illustrate several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art may make various modifications and improvements without departing from the spirit of the present invention, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.

Claims

1. A system performance testing method, It is characterized in that The method comprises: Obtaining a performance category to be tested of the system under test, and determining a system function corresponding to the performance category to be tested; Inserting a first target code into a target detection position of a top-level function in the system function to obtain a first function; When a first test result obtained by testing the first function does not satisfy a first target condition, inserting a second target code at a target detection position of a lower function of the top function to obtain a second function; When a second test result obtained by testing the second function meets a second target condition, a performance test result of the performance category to be tested is obtained based on the first test result and the second test result.

2. The method according to claim 1, It is characterized in that The method further comprises: Obtaining the performance test results of each of the performance categories to be tested and the weights of each of the performance categories to be tested; Converting the time data in each of the performance test results into performance score data; Based on each of the weights and each of the performance score data, a test result of the system under test is obtained.

3. The method according to claim 1, It is characterized in that The target detection position includes the head position and the tail position of the function; Inserting a first target code into a target detection position of a top-level function in the system function to obtain a first function comprises: Generate an abstract syntax tree of the performance category to be tested using a syntax analysis tool, and determine a function hierarchical result of a system function of the performance category to be tested based on the abstract syntax tree; A top-level function in the function hierarchical result is obtained, and a first target code is inserted into the head position and the tail position of the top-level function to obtain a first function.

4. The method according to claim 1, It is characterized in that When a first test result obtained by testing the first function does not meet a first target condition, inserting a second target code at a target detection position of a lower function of the top function to obtain a second function comprises: Obtaining function hierarchical results of system functions of the performance category to be tested; When the first test result does not meet the target condition, determining a lower layer function of the top layer function based on the function layering result; Insert a second target code into a target detection position of a lower function of the top function to obtain a second function; The method further comprises: The second function is tested using the test code corresponding to the performance category to be tested to obtain a second test result.

5. The method according to claim 1, It is characterized in that The number of the first function and the number of the second function are at least two; Inserting a first target code into a target detection position of a top-level function in the system function to obtain a first function comprises: Inserting a first target code at a target detection position of each top-level function in the system function to obtain a plurality of first functions; Testing each of the first functions respectively to obtain first test results of each of the plurality of first functions; When a first test result obtained by testing the first function does not meet a first target condition, inserting a second target code at a target detection position of a lower function of the top function to obtain a second function comprises: From the plurality of first functions, obtain a target first function in which the first test result does not satisfy a target condition; According to the function hierarchical result of the system function of the performance category to be tested, a second target code is inserted into the target detection position of each lower function of the target first function to obtain a plurality of second functions.

6. The method according to claim 1, It is characterized in that The method further comprises: When the second test result does not meet the target condition, the lower layer functions of the function that does not meet the target condition are tested in turn according to the function layering results of the system function of the performance category to be tested until there is no lower layer function of the target function.

7. The method according to any one of claims 1 to 6, It is characterized in that The method further comprises: When the target code at the target detection position corresponding to the function is executed, obtaining the level change of the oscilloscope connected to the system under test; the function includes each function in the system function corresponding to the performance category to be tested; Based on the level change, a test result of the function is determined.

8. A system performance testing device, It is characterized in that The device comprises: A function determination module is used to obtain the performance category to be tested of the system under test and determine the system function corresponding to the performance category to be tested; A target code insertion module, used for inserting a first target code into a target detection position of a top-level function in the system function to obtain a first function; A first function testing module is used for inserting a second target code into a target detection position of a lower function of the top-level function to obtain a second function when a first test result obtained by testing the first function does not meet a first target condition; The second function testing module is used to obtain the performance test result of the performance category to be tested based on the first test result and the second test result when a second test result obtained by testing the second function meets a second target condition.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program. It is characterized in that When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Code testing method and device, equipment and storage medium

    CN113778849A

  • Software interface performance test method and device, equipment and medium

    CN115757186A

  • System performance test method and device, computer equipment and storage medium

    CN116450496A

  • Apparatus and Method to Execute Prerequisite Code Before Delivering UEFI Firmware Capsule

    US20190391799A1

Cited By

  • Method and device for testing performance of single-photon detector

    CN120043631A

  • Cooperative control system for intelligent test equipment of vehicle-mounted domain control

    CN121411409A