A load rate test method, device, apparatus and storage medium
By calling the debug interface to collect the address under test during MCU load rate testing, the target address corresponding to the idle thread is determined, which solves the complexity problem caused by the reliance on the operating system in the existing technology and realizes efficient and universal load rate calculation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-07
- Publication Date
- 2026-04-07
AI Technical Summary
Existing technologies for MCU load rate testing rely on operating systems and programs, making the testing process complex and uncommon, and unable to efficiently calculate the load rate.
By calling the debugging interface of the target object to collect the address to be tested, the target address to be tested corresponding to the idle thread is determined, the load rate is calculated, avoiding dependence on the operating system and program, and the sampling time is determined by using preset sampling configuration information or sampling interval generation model.
It simplifies the testing process, improves the universality and efficiency of testing, shortens testing time, and reduces the adaptation requirements for operating systems and programs.
Smart Images

Figure CN116225793B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of load rate testing, and particularly relates to a load rate testing method, device, equipment and storage medium. BACKGROUND
[0002] In the design and development process of various devices, the load rate of the device needs to be calculated in real time; for example, in the design and development process of a microcontroller unit (MCU), in order to improve the reliable operation of the program, the load rate of the MCU needs to be calculated in real time. At present, the test of the load rate of the MCU usually needs to be combined with an operating system, and the operating system is used to calculate the running time of each thread in a certain measurement period by using the change of the key information of the operating system at the key point (such as thread switching) of the system running, so as to calculate the load rate of the MCU. This method depends on the operating system, and in the test process, different operating systems and different running programs need to be adapted. SUMMARY
[0003] In order to solve the above technical problems, the present application discloses a load rate testing method, which calls a debugging interface of a target object to collect a to-be-tested address. This method does not need to depend on the operating system and the program running the target object, avoids the need to make adaptive changes to the operating system and the program when collecting the to-be-tested address, and has a simple testing method and high universality. Moreover, the present application calculates the load rate by comparing the number of target to-be-tested addresses matched with first address information with the number of to-be-tested addresses, which greatly shortens the test time and improves the test efficiency compared with the traditional method of calculating the load rate by counting the running time of the target object.
[0004] In order to achieve the above-mentioned purposes, the present application provides a load rate testing method, which comprises:
[0005] calling a debugging interface of a target object to sample associated address information of the target object, to obtain a plurality of to-be-tested addresses;
[0006] determining target to-be-tested addresses matched with first address information from the plurality of to-be-tested addresses; the first address information is address information corresponding to an idle thread in the associated address information;
[0007] determining the load rate of the target object based on the number of target to-be-tested addresses and the number of to-be-tested addresses.
[0008] In some embodiments, the calling of the debugging interface of the target object to sample the associated address information of the target object to obtain a plurality of to-be-tested addresses comprises:
[0009] detecting a load test event, obtaining preset sampling configuration information and a target time of detecting the load test event, the preset sampling configuration information representing a preset sampling interval sequence or a sampling interval generation model, the sampling interval generation model being used to generate time intervals between adjacent sampling operations;
[0010] determining a plurality of sampling times according to the target time and the preset sampling configuration information;
[0011] sampling, according to the plurality of sampling times, associated address information of the target object through a debugging interface of the target object, to obtain the address to be tested corresponding to each of the plurality of sampling times.
[0012] In some embodiments, the method further comprises:
[0013] obtaining a first preset time threshold and a second preset time threshold;
[0014] obtaining a plurality of preset sampling intervals based on the first preset time threshold and the second preset time threshold, the plurality of preset sampling intervals being greater than or equal to the first preset time threshold and less than or equal to the second preset time threshold;
[0015] sorting the plurality of preset sampling intervals to obtain a preset sampling interval sequence;
[0016] generating the preset sampling configuration information based on the preset sampling interval sequence.
[0017] In some embodiments, the preset sampling configuration information is a preset sampling interval sequence, and the preset sampling interval sequence includes a plurality of preset sampling intervals arranged in sequence; and determining a plurality of sampling times according to the target time and the preset sampling configuration information comprises:
[0018] performing addition processing based on the target time and a preset initial sampling interval to obtain a first sampling time;
[0019] obtaining a target sampling number and a first sampling interval; the first sampling interval being any one of the plurality of preset sampling intervals;
[0020] performing addition processing based on the first sampling time and the first sampling interval to obtain a second sampling time;
[0021] determining a third sampling time according to the second sampling time, a second sampling interval and the target sampling number; the second sampling interval being a preset sampling interval other than the first sampling interval among the plurality of preset sampling intervals, and the sum of the number of the first sampling time, the number of the second sampling time and the number of the third sampling interval being the target sampling number.
[0022] According to the first sampling time, the second sampling time and the third sampling time, the plurality of sampling times are obtained.
[0023] In some embodiments, the third sampling time is determined according to the second sampling time, the second sampling interval and the target sampling number, including:
[0024] The second sampling interval is determined from the preset sampling interval sequence based on the first sampling interval and the target sampling number;
[0025] The third sampling time is obtained by adding the second sampling interval and the second sampling time.
[0026] In some embodiments, the preset sampling configuration information is a sampling interval generation model, and the plurality of sampling times are determined according to the target time and the preset sampling configuration information, including:
[0027] The first sampling time is obtained by adding the target time and a preset initial sampling interval;
[0028] In response to a trigger operation of the first sampling, target to-be-processed data is obtained; the first sampling is a sampling operation corresponding to the first sampling time;
[0029] The target sampling interval is obtained according to the target to-be-processed data and the sampling interval generation model;
[0030] The target sampling time is obtained by adding the first sampling time and the target sampling interval;
[0031] The plurality of sampling times are obtained according to the first sampling time and the target sampling time.
[0032] In some embodiments, the target to-be-tested address matched with the first address information is determined from the plurality of to-be-tested addresses, including:
[0033] The first address information corresponding to the idle thread is determined from the associated address information;
[0034] The start address and the end address of the first address information are obtained;
[0035] The to-be-tested address between the start address and the end address in the plurality of to-be-tested addresses is determined as the target to-be-tested address.
[0036] The application also provides a load rate testing device, which comprises:
[0037] The sampling module is configured to invoke a debugging interface of the target object to sample associated address information of the target object, and obtain a plurality of to-be-tested addresses;
[0038] The first determining module is configured to determine a target to-be-tested address matched with first address information from the plurality of to-be-tested addresses; the first address information is address information corresponding to an idle thread in the associated address information;
[0039] The second determining module is configured to determine a load rate of the target object based on a quantity of the target to-be-tested addresses and a quantity of the plurality of to-be-tested addresses.
[0040] The present application also provides a load rate testing device, which comprises a processor and a memory, and the memory stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by the processor to implement the load rate testing method as described above.
[0041] The present application also provides a computer readable storage medium, which stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by a processor to implement the load rate testing method as described above.
[0042] The present application has the following beneficial effects:
[0043] The load rate testing method of the present application collects to-be-tested addresses by invoking a debugging interface of a target object, and the method does not need to rely on an operating system and a program running the target object, avoids the need to make adaptive changes to the operating system and the program when collecting to-be-tested addresses, and is simple and highly universal. Moreover, the present application calculates a load rate by comparing a quantity of target to-be-tested addresses matched with first address information from a plurality of to-be-tested addresses with a quantity of the plurality of to-be-tested addresses, which greatly shortens the testing time and improves the testing efficiency compared with a conventional method of calculating a load rate by counting a running time of a target object. BRIEF DESCRIPTION OF DRAWINGS
[0044] In order to more clearly illustrate the load rate testing method, device, equipment and storage medium of the present application, the drawings required by the embodiments will be briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0045] Figure 1 An implementation environment schematic diagram of a load rate testing method provided by the present application;
[0046] Figure 2A schematic diagram of a method for generating prediction sampling configuration information is provided in an embodiment of the present application.
[0047] Figure 3 A flowchart of a method for load rate testing is provided in an embodiment of the present application.
[0048] Figure 4 A flowchart of a method for obtaining multiple addresses to be tested is provided in an embodiment of the present application.
[0049] Figure 5 A flowchart of a method for determining sampling time is provided in an embodiment of the present application Figure 1 .
[0050] Figure 6 A flowchart of a method for determining sampling time is provided in an embodiment of the present application Figure 2 .
[0051] Figure 7 A flowchart of a method for determining sampling time is provided in an embodiment of the present application Figure 3 .
[0052] Figure 8 A structural diagram of a load rate testing device is provided in an embodiment of the present application.
[0053] Figure 9 A structural diagram of an electronic device is provided in an embodiment of the present application. DETAILED DESCRIPTION
[0054] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of the present application.
[0055] It should be noted that the terms “first”, “second”, and the like in the specification and claims of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms “include” and “have” and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product, or server including a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to the process, method, product, or device.
[0056] Please see Figure 1 It illustrates a schematic diagram of the implementation environment provided in the embodiments of this application, which may include:
[0057] At least one terminal 01 and at least one server 02. The at least one terminal 01 and the at least one server 02 can communicate data via a network.
[0058] In an optional embodiment, terminal 01 can be the executor of the load rate testing method. Terminal 01 can be, but is not limited to, electronic devices such as in-vehicle terminals, smartphones, desktop computers, tablets, laptops, smart speakers, digital assistants, augmented reality (AR) / virtual reality (VR) devices, and smart wearable devices. The operating system running on terminal 01 can be, but is not limited to, Android, iOS, Linux, Windows, and Unix.
[0059] Server 02 can provide terminal 01 with the associated address information and primary address information of the target object. Optionally, server 02 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.
[0060] In this embodiment, the prediction sampling configuration information may include various configuration methods. In one exemplary embodiment, please refer to... Figure 2 The diagram illustrates a flowchart of a method for configuring preset sampling configuration information according to an embodiment of this application. This specification provides the operational steps described in the embodiments or flowcharts, but based on conventional or non-inventive methods, more or fewer operational steps may be included. The order of steps listed in the embodiments is merely one possible execution order among many steps and does not represent the only execution order. The method for configuring preset sampling configuration information can be executed according to the order shown in the embodiments or drawings. Specifically, as shown... Figure 2 As shown, the method includes:
[0061] S201, Obtain the first preset duration threshold and the second preset duration threshold;
[0062] In this embodiment, the first preset duration threshold and the second preset duration threshold can refer to pre-set thresholds used to indicate the sampling interval, where the sampling interval can be the duration between adjacent sampling operations. The first preset duration threshold can be less than the second preset duration threshold.
[0063] In one example, the first preset duration threshold can be any value between 15 and 25 microseconds, for example, 20 microseconds. The second preset duration threshold can be any value between 95 and 105 microseconds, for example, 100 microseconds.
[0064] In one possible exemplary embodiment, when sampling the target object, pre-configured preset sampling configuration information can be used for intermittent sampling; based on this, data such as a first preset duration threshold and a second preset duration threshold can be pre-configured and stored to generate preset sampling configuration information according to the pre-configured data information.
[0065] In one example, a first preset duration threshold and a second preset duration threshold can be obtained from pre-stored data.
[0066] S203, based on the first preset duration threshold and the second preset duration threshold, obtain multiple preset sampling intervals, wherein the multiple preset sampling intervals are greater than or equal to the first preset duration threshold and less than or equal to the second preset duration threshold.
[0067] In this application embodiment, the multiple preset sampling intervals may include the sampling interval corresponding to a first preset duration threshold, the sampling interval corresponding to a second preset duration threshold, and the sampling interval corresponding to at least one duration between the first preset duration threshold and the second preset duration threshold.
[0068] Optionally, a time period between a first preset duration threshold and a second preset duration threshold can be obtained; a first sampling interval point number between the time periods can be obtained; and the time period can be numerically divided based on the first sampling interval point number to obtain multiple preset sampling intervals. Here, the sampling interval point number can refer to the number of sampling intervals; for example, it can be 80.
[0069] In one example, the duration value between the first preset duration threshold and the second preset duration threshold can be divided according to the number of first sampling interval points to obtain a preset sampling interval for the first target number, wherein the number of the first target number is the same as the number of first sampling interval points. The division process can be an average division or a random division; in one example, an average division can be used.
[0070] Optionally, a first preset model and a second sampling interval number located between a first preset duration threshold and a second preset duration threshold can be obtained; based on the first preset duration threshold, the second preset duration threshold, the second sampling interval number, and the first preset model, at least one target sampling interval is determined. The first preset model can be used to generate sampling intervals systematically; the first preset model can be a sine or cosine curve model. The second sampling interval number can refer to the number of sampling intervals; for example, it can be 80.
[0071] In one example, the first preset duration threshold, the second preset duration threshold, and the second sampling interval points can be input into the first preset model to obtain the preset sampling interval for the second target number; the second target number is the same as the second sampling interval points.
[0072] The first preset model can be the following model:
[0073] Model 1: Δt = Asin(x + Φ) + b
[0074] Where, A = (T) max -T min ) / 2,
[0075] b = (T) max +T min ) / 2,
[0076] x i+1 =(x i +2π / Num)).
[0077] T max T represents the second preset duration threshold. min This represents the first preset duration threshold; Φ represents the initial phase, which can be any value, for example, 0. x represents the target variable, whose initial value can be any value, for example, 0. i Let x be the target scalar corresponding to the i-th sampling. i+1 Let Num be the target scalar corresponding to the (i+1)th sample. Num represents the number of sampling interval points; Δt represents the time interval.
[0078] For example, in T min For 20 μs, T max Given a s = 100 μs, Num = 80, Φ = 0, and x = 0, the multiple preset sampling intervals it includes are as follows:
[0079] i=1, x1=0, Δt=40sin(0)+60=60μs;
[0080] i=2, x1=0, x2=(x1+π / 40), Δt=40sin(1*(π / 40))+60=63μs;
[0081] i=3, x2=π / 40, x3=(x2+π / 40), Δt=40sin(2*(π / 40))+60=66μs;
[0082] The calculations are performed sequentially according to the above method until i = 79.
[0083] S205, sort the multiple preset sampling intervals to obtain the preset sampling interval sequence.
[0084] Optionally, taking the preset sampling interval of the first target data quantity as an example, the preset sampling intervals of the first target quantity can be arranged in order of size to obtain a linearly growing preset sampling interval sequence.
[0085] Optionally, the preset sampling intervals for the second target number are arranged in the order obtained from the calculation timing of the first preset model to obtain a preset sampling interval sequence.
[0086] S207, Generate preset sampling configuration information based on preset sampling interval sequence.
[0087] In this embodiment, the preset sampling configuration information of this application can perform sampling relatively quickly, reduce the amount of data calculation during the sampling process, and improve sampling efficiency.
[0088] In another exemplary embodiment, a sampling interval generation model can be obtained and determined as preset sampling configuration information. The sampling interval generation model is used to generate the time interval between adjacent sampling operations; this model can dynamically generate sampling intervals; the sampling interval generation model can include a random sampling interval generation model, a sine / cosine curve model, and a linear growth model.
[0089] In one example, the sampling interval generation model may include a target value for a target variable that is dynamically generated based on the sampling operation; this target value may be randomly generated or generated based on the first value of the target variable that already exists in the sampling interval generation model. The target value and the first value may refer to the values of the target variable at different sampling numbers. The target variable may be a parameter in the sampling interval model that can change dynamically.
[0090] Specifically, in the random sampling interval generation model, the target value of the target variable can be randomly generated based on each sampling operation.
[0091] For example, the random sampling interval generation model can be the following model:
[0092] Model 2: C / (T) max -T min )=e...d
[0093] Model 3: Δt = d + T min
[0094] Among them, T max T represents the second preset duration threshold. min represents the first preset duration threshold; C represents the target variable, which can be any value; e represents the quotient, d represents the remainder, and Δt represents the time interval.
[0095] Specifically, in the sine and cosine curve model, the target value of the target variable can be calculated based on the first value of the target variable in the sine and cosine curve model when the most recent sampling operation was performed before the target sampling number.
[0096] The calculation method for the sampling interval in this model can follow the calculation method of the first preset model mentioned above; here, it is dynamically generated.
[0097] This approach avoids data storage and reduces memory requirements; and for models generated by random sampling intervals, when the number of samples is large enough, relatively accurate calculation results can be obtained using the collected samples.
[0098] In the embodiments of this application, such as Figure 3 The diagram shown is a flowchart of a load rate testing method provided in an embodiment of this application, as detailed below:
[0099] S301, Call the debugging interface of the target object to sample the associated address information of the target object and obtain multiple addresses to be tested;
[0100] In this embodiment, the target object can be a device used for load rate calculation, such as an MCU (Microcontroller Unit) or a CPU (Central Processing Unit). The associated address of the target object can include first address information corresponding to idle threads and second address information corresponding to non-idle threads. The debugging interface can be an interface used to obtain data information of the target object; for example, it can be a JTAG (Joint Test Action Group) interface.
[0101] Optionally, the debugging interface of the target object can be called to sample the associated address information of the target object at irregular intervals to obtain multiple addresses to be tested; wherein, sampling the associated address information of the target object at irregular intervals can mean that the time interval between each sampling operation is not fixed.
[0102] In an exemplary embodiment, upon detecting a load test event, the debugging interface of the target object can be invoked to sample the associated address information of the target object to obtain a first address to be tested; historical addresses to be tested can be obtained, and multiple addresses to be tested can be obtained based on the first address to be tested and the historical addresses to be tested; wherein, the historical addresses to be tested can be addresses to be tested obtained through the debugging interface of the target object.
[0103] In one example, the address to be tested corresponding to a historical time period can be obtained from the sampling device to obtain the historical address to be tested; the end time of the historical time period is the same as the sampling time of the first address to be tested. The address to be tested corresponding to the historical time period in the sampling device can be the address to be tested obtained by the sampling device calling the debugging interface of the target object to sample the associated address information of the target object.
[0104] S303, determine the target address to be tested that matches the first address information from multiple addresses to be tested; the first address information is the address information corresponding to the idle thread in the associated address information.
[0105] In this embodiment of the application, the first address information represents the address segment corresponding to the idle thread; the first address information may contain multiple addresses; for example, it may include a start address and an end address.
[0106] Optionally, the first address information corresponding to the idle thread can be determined from the associated address information; the start address and end address of the first address information can be obtained; and the address to be tested that is between the start address and the end address among multiple addresses to be tested can be determined as the target address to be tested.
[0107] Optionally, the first address information corresponding to the idle thread and the multiple target addresses contained in the first address information can be determined from the associated address information; the multiple test addresses are compared one by one with the multiple target addresses to determine the address that overlaps with any target address among the multiple test addresses; the address that overlaps with the target address among the multiple test addresses is determined as the target test address.
[0108] S305, determine the load rate of the target object based on the number of target addresses to be tested and the number of multiple addresses to be tested.
[0109] In the embodiments of this application, the load factor can refer to the ratio of the actual load borne by the target object to its capacity; it is used to reflect the carrying capacity of the target object.
[0110] Optionally, the load rate of the target object can be determined based on the percentage information of the number of target addresses to be tested relative to the number of multiple address information.
[0111] In one example, the load rate of the target object can be obtained by subtracting the percentage of the number of target test addresses and the number of multiple test address information from 100%.
[0112] For example, if the number of multiple address information to be tested is 1000 and the number of target address to be tested is 90, the load rate of the target object = 100% - (90 / 1000) * 100% = 100% - 9% = 91%.
[0113] In this embodiment, the present application collects the address to be tested by calling the debugging interface of the target object. This method does not depend on the operating system and program running the target object, avoiding the need to make adaptation modifications to the operating system and program when collecting the address to be tested. The testing method is simple and highly universal. Furthermore, the present application calculates the load rate by combining the number of target addresses that match the first address information among multiple addresses to be tested with the number of multiple addresses to be tested. Compared with the traditional method of calculating the load rate by counting the runtime of the target object, this greatly shortens the testing time and improves the testing efficiency.
[0114] In another exemplary embodiment, such as Figure 4 The diagram illustrates a flowchart of a method for obtaining multiple addresses to be tested, as provided in an embodiment of this application. Step S301 may include:
[0115] S401, a load test event is detected, and preset sampling configuration information and the target time of the detected load test event are obtained. The preset sampling configuration information represents a preset sampling interval sequence or a sampling interval generation model. The sampling interval generation model is used to generate the time interval between adjacent sampling operations.
[0116] In this embodiment of the application, a load test event may refer to a triggering operation for performing a load rate test.
[0117] S403 determines multiple sampling times based on the target time and preset sampling configuration information.
[0118] In the embodiments of this application, the method for determining the sampling time is also different when the preset sampling configuration information is different.
[0119] In an exemplary embodiment, the preset sampling configuration information is a preset sampling interval sequence, which includes multiple preset sampling intervals arranged in sequence. In this case, the method for determining the sampling time is as follows: Figure 5 As shown;
[0120] S501, summation is performed based on the target time and the preset initial sampling interval to obtain the first sampling time.
[0121] In this embodiment, the preset initial sampling interval can be a pre-set time interval between the target time and the first sampling time. The preset initial sampling interval can be 0 microseconds or any natural number greater than 0. When the preset initial sampling interval is 0, the target time is the first sampling time. That is, when a load test event is detected, the debugging interface of the target object can be called to sample the associated address information of the target object to obtain multiple addresses to be tested.
[0122] S503, Obtain the target number of samples and the first sampling interval; the first sampling interval is any one of a plurality of preset sampling intervals;
[0123] In this embodiment, the target sampling count can be the number of times the sampling operation is performed, and the target sampling count is less than or equal to a preset sampling threshold. The preset sampling threshold can be a pre-set total number of samples required to complete one load rate calculation.
[0124] Optionally, the first sampling interval can be randomly selected from multiple preset sampling intervals.
[0125] S505, sum the first sampling time and the first sampling interval to obtain the second sampling time.
[0126] In this embodiment of the application, the second sampling time can be obtained by adding the first sampling time to the first sampling interval.
[0127] S507, the third sampling time is determined based on the second sampling time, the second sampling interval, and the target number of samplings; the second sampling interval is a preset sampling interval other than the first sampling interval among multiple preset sampling intervals, and the sum of the number of first sampling times, the number of second sampling times, and the number of third sampling intervals is the target number of samplings.
[0128] In this embodiment of the application, a second sampling interval can be determined from a preset sampling interval sequence based on a first sampling interval and a target number of samplings; a third sampling time is obtained by summing the second sampling interval and the second sampling time.
[0129] In one possible embodiment, determining the second sampling interval from a preset sampling interval sequence based on the first sampling interval and the target number of samples may include the following method:
[0130] The system can obtain the first position corresponding to the first sampling interval in the preset sampling interval sequence; based on the first position and the target sampling number, it obtains the preset sampling interval corresponding to the target position from the preset sampling interval sequence to obtain the second sampling interval; the target position is the position corresponding to the target sampling number among multiple positions arranged sequentially after the first position in the target preset sampling interval sequence; the target preset sampling interval sequence can be an interval sequence of multiple preset sampling interval sequences arranged consecutively. This can be understood as the target position being either the position after the first position in the preset sampling interval sequence containing the first position, or the position after the first position in a preset sampling interval sequence following the first position.
[0131] Specifically, the second sampling interval and the second sampling time can be added together to obtain the third sampling time.
[0132] S509, based on the first sampling time, the second sampling time, and the third sampling time, multiple sampling times are obtained.
[0133] In this embodiment of the application, the number of first sampling times and the number of second sampling times are both one, and the number of third sampling times includes at least one.
[0134] The number of sampling times is the same as the number of addresses to be tested.
[0135] In this embodiment, the present application pre-calculates and stores a preset sampling interval sequence formed by multiple preset sampling intervals, so that during the sampling process, the corresponding sampling interval is directly selected from the preset sampling interval sequence according to the target sampling number, which reduces the amount of data calculation during the sampling process. This not only improves the sampling efficiency, but also further improves the detection efficiency of the load rate.
[0136] In another exemplary embodiment, the preset sampling configuration information is a sampling interval generation model, and the method for determining the sampling time may include at least the following methods: when the sampling interval generation model is a random sampling interval generation model, the method for determining the sampling time is as follows: Figure 6 As shown;
[0137] S601, summation is performed based on the target time and the preset initial sampling interval to obtain the first sampling time.
[0138] S603, in response to the trigger operation of the first sampling, acquires the target data to be processed; the first sampling is the sampling operation corresponding to the first sampling time.
[0139] In this embodiment of the application, the target data to be processed can be the numerical value corresponding to the target variable in the sampling interval generation model.
[0140] Optionally, the target data to be processed can be randomly generated.
[0141] S605, generate a model based on the target data to be processed and the sampling interval to obtain the target sampling interval.
[0142] By inputting the target data to be processed into the sampling interval generation model, the target sampling interval can be generated.
[0143] S607, summation is performed based on the first sampling time and the target sampling interval to obtain the target sampling time.
[0144] The target sampling time is obtained by adding the first sampling time and the target sampling interval.
[0145] S609, based on the first sampling time and the target sampling time, multiple sampling times are obtained.
[0146] In this embodiment, by dynamically and randomly generating sampling intervals, not only can the data storage space of the sampling interval generation model be reduced, but also more accurate test results can be obtained when the number of samplings is large, thereby improving the accuracy of the load rate.
[0147] In another exemplary embodiment, when the sampling interval generation model is a sine / cosine curve model, the method for determining the sampling time is as follows: Figure 7 As shown;
[0148] S701, summation is performed based on the target time and the preset initial sampling interval to obtain the first sampling time;
[0149] S703, in response to the trigger operation of the first sampling, obtains the first target value to be processed; the first sampling is the sampling operation corresponding to the first sampling time;
[0150] In this embodiment of the application, the first target value to be processed may be the first numerical value corresponding to the target variable in the sampling interval generation model.
[0151] Optionally, the first target value to be processed can be randomly generated.
[0152] S705, Generate a model based on the first target value to be processed and the sampling interval to obtain the first sampling interval;
[0153] S707, the first sampling time and the first sampling interval are summed to obtain the second sampling time;
[0154] S709, the third sampling time is determined based on the second sampling time, the second sampling interval, and the target number of samplings. The second sampling interval is the sampling interval corresponding to the target number of samplings. The sum of the number of first sampling times, the number of second sampling times, and the number of third sampling intervals is the target number of samplings.
[0155] Optionally, a second target value can be determined based on the first target value to be processed and the target sampling number; a second sampling interval can be obtained by generating a model based on the second target value to be processed and the sampling interval; and the second sampling time and the second sampling interval can be summed to obtain the third sampling time.
[0156] S711 obtains multiple sampling times based on the first sampling time, the second sampling time, and the third sampling time.
[0157] In this embodiment, by dynamically determining a more regular sampling interval, this application can not only reduce the data storage space of the sampling interval generation model, but also obtain more accurate test results when the number of samplings is small, thereby improving the detection efficiency of the load rate.
[0158] S405, based on multiple sampling times, calls the debugging interface of the target object to sample the associated address information of the target object, and obtains the address to be tested corresponding to each of the multiple sampling times.
[0159] In this embodiment of the application, the debugging interface of the target object is called to sample the associated address information of the target object at each sampling time, so that multiple addresses to be tested can be obtained.
[0160] In this embodiment, by setting a non-periodic sampling time and sampling the associated address information of the target object at the set sampling time, this application can not only avoid the problem of low reliability of sampling data caused by fixed sampling frequency, but also greatly reduce the amount of data storage compared with traditional data acquisition methods, thereby improving the efficiency and reliability of subsequent load rate detection.
[0161] This application also provides a load rate testing device, such as... Figure 8 As shown, this is a schematic diagram of a load rate testing device provided in an embodiment of this application; specifically, the device includes:
[0162] The sampling module 801 is used to call the debugging interface of the target object to sample the associated address information of the target object and obtain multiple addresses to be tested;
[0163] The first determining module 803 is used to determine a target address that matches the first address information from the plurality of addresses to be tested; the first address information is the address information corresponding to the idle thread in the associated address information;
[0164] The second determining module 805 is used to determine the load rate of the target object based on the number of target addresses to be tested and the number of multiple addresses to be tested.
[0165] In this embodiment of the application, the sampling module 801 includes:
[0166] The first acquisition unit is used to detect a load test event, acquire preset sampling configuration information and the target time of detecting the load test event, wherein the preset sampling configuration information represents a preset sampling interval sequence or a sampling interval generation model, and the sampling interval generation model is used to generate the time interval between adjacent sampling operations.
[0167] The first determining unit is used to determine multiple sampling times based on the target time and the preset sampling configuration information;
[0168] The sampling unit is used to call the debugging interface of the target object to sample the associated address information of the target object according to the multiple sampling times, so as to obtain the address to be tested corresponding to each of the multiple sampling times.
[0169] In this embodiment of the application, it also includes:
[0170] The first acquisition module is used to acquire a first preset duration threshold and a second preset duration threshold;
[0171] The second acquisition module is used to acquire multiple preset sampling intervals based on the first preset duration threshold and the second preset duration threshold, wherein the multiple preset sampling intervals are greater than or equal to the first preset duration threshold and less than or equal to the second preset duration threshold.
[0172] The processing module is used to sort the multiple preset sampling intervals to obtain a preset sampling interval sequence;
[0173] The generation module is used to generate the preset sampling configuration information based on the preset sampling interval sequence.
[0174] In this embodiment of the application, the first determining unit includes:
[0175] The first processing subunit is used to perform summation processing based on the target time and a preset initial sampling interval to obtain the first sampling time;
[0176] The first acquisition subunit is used to acquire the target number of samplings and the first sampling interval; the first sampling interval is any one of the plurality of preset sampling intervals.
[0177] The second processing subunit is used to perform summation processing based on the first sampling time and the first sampling interval to obtain the second sampling time;
[0178] The first determining subunit is used to determine the third sampling time based on the second sampling time, the second sampling interval, and the target sampling number; the second sampling interval is a preset sampling interval other than the first sampling interval among the plurality of preset sampling intervals, and the sum of the number of the first sampling time, the number of the second sampling time, and the number of the third sampling interval is the target sampling number;
[0179] The second determining subunit is used to obtain the plurality of sampling times based on the first sampling time, the second sampling time, and the third sampling time.
[0180] In this embodiment of the application, the first determining subunit includes:
[0181] The first determining submodule is used to determine a second sampling interval from the preset sampling interval sequence based on the first sampling interval and the target sampling number;
[0182] The first processing submodule is used to perform summation processing based on the second sampling interval and the second sampling time to obtain the third sampling time.
[0183] In this embodiment of the application, the first determining unit further includes:
[0184] The third processing subunit is used to perform summation processing based on the target time and the preset initial sampling interval to obtain the first sampling time;
[0185] The second acquisition subunit is used to acquire the target data to be processed in response to the trigger operation of the first sampling; the first sampling is the sampling operation corresponding to the first sampling time.
[0186] The third determining subunit is used to generate a model based on the target data to be processed and the sampling interval to obtain the target sampling interval;
[0187] The fourth determining subunit is used to perform summation processing based on the first sampling time and the target sampling interval to obtain the target sampling time;
[0188] The fifth determining subunit is used to obtain the plurality of sampling times based on the first sampling time and the target sampling time.
[0189] In this embodiment of the application, the first determining module 803 includes:
[0190] The second determining unit is used to determine the first address information corresponding to the idle thread from the associated address information;
[0191] The second acquisition unit is used to acquire the start address and end address of the first address information;
[0192] The third determining unit is used to determine the address to be tested that is located between the start address and the end address among the plurality of addresses to be tested as the target address to be tested.
[0193] It should be noted that the apparatus and method embodiments described in the device embodiments are based on the same inventive concept.
[0194] This application provides a load rate testing device, which includes a processor and a memory. The memory stores at least one instruction or at least one program. The processor loads and executes the at least one instruction or at least one program to implement the load rate testing method as described in the above method embodiments.
[0195] Furthermore, Figure 9 A schematic diagram of the hardware structure of an electronic device for implementing the load rate testing method provided in the embodiments of this application is shown. The electronic device may participate in or include the load rate testing apparatus provided in the embodiments of this application. Figure 9 As shown, the electronic device 90 may include one or more processors 902 (shown as 902a, 902b, ..., 902n in the figure) 902 (processor 902 may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 904 for storing data, and a transmission device 906 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 9 The structure shown is for illustrative purposes only and does not limit the structure of the electronic device described above. For example, the electronic device 90 may also include... Figure 9 The more or fewer components shown, or having the same Figure 9 The different configurations shown.
[0196] It should be noted that the aforementioned one or more processors 902 and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be wholly or partially integrated into any other element within the electronic device 90 (or mobile device). As involved in the embodiments of this application, the data processing circuit serves as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).
[0197] The memory 904 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the load rate testing method described in the embodiments of this application. The processor 902 executes various functional applications and data processing by running the software programs and modules stored in the memory 904, thereby realizing the aforementioned load rate testing method. The memory 904 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 904 may further include memory remotely located relative to the processor 902, and these remote memories can be connected to the electronic device 90 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0198] The transmission device 906 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the electronic device 90. In one example, the transmission device 906 includes a network interface controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In one embodiment, the transmission device 906 may be a radio frequency (RF) module for wireless communication with the Internet.
[0199] The display can be, for example, a touchscreen liquid crystal display (LCD), which allows users to interact with the user interface of an electronic device (or mobile device).
[0200] Embodiments of this application also provide a computer-readable storage medium, which can be disposed in an electronic device to store at least one instruction or at least one program related to implementing a load rate testing method in the method embodiment. The at least one instruction or the at least one program is loaded and executed by the processor to implement the load rate testing method provided in the above method embodiment.
[0201] Optionally, in this embodiment, the storage medium may be located at at least one of the multiple network servers in a computer network. Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0202] It should be noted that the order of the embodiments described above is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. Furthermore, the above description focuses on specific embodiments of this application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps described in the claims can be performed in a different order than that shown in the embodiments and still achieve the desired results. Additionally, the processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired results. In some implementations, multitasking and parallel processing are also possible or may be advantageous.
[0203] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the various alternative implementations described above.
[0204] The various embodiments in this application are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the device and electronic device embodiments are basically similar to the method embodiments, so the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0205] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0206] The above description is only a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A load rate testing method, characterized in that, The method includes: The debugging interface of the target object is called to sample the associated address information of the target object, and multiple addresses to be tested are obtained; From the plurality of addresses to be tested, a target address to be tested that matches the first address information is determined; the first address information is the address information corresponding to the idle thread in the associated address information; The load rate of the target object is determined based on the number of target addresses to be tested and the number of multiple addresses to be tested. The step of determining the target address that matches the first address information from the plurality of addresses to be tested includes: Determine the first address information corresponding to the idle thread from the associated address information; Obtain the start and end addresses of the first address information; The address to be tested that lies between the start address and the end address among the plurality of addresses to be tested is determined as the target address to be tested.
2. The load rate testing method according to claim 1, characterized in that, The process involves calling the debugging interface of the target object to sample the associated address information of the target object, obtaining multiple addresses to be tested, including: Upon detecting a load test event, the system obtains preset sampling configuration information and the target time of the detected load test event. The preset sampling configuration information represents a preset sampling interval sequence or a sampling interval generation model. The sampling interval generation model is used to generate the time interval between adjacent sampling operations. Based on the target time and the preset sampling configuration information, multiple sampling times are determined; Based on the multiple sampling times, the debugging interface of the target object is called to sample the associated address information of the target object, thereby obtaining the address to be tested corresponding to each of the multiple sampling times.
3. The load rate testing method according to claim 2, characterized in that, The method further includes: Obtain the first preset duration threshold and the second preset duration threshold; Based on the first preset duration threshold and the second preset duration threshold, multiple preset sampling intervals are obtained, wherein the multiple preset sampling intervals are greater than or equal to the first preset duration threshold and less than or equal to the second preset duration threshold; The multiple preset sampling intervals are sorted to obtain a preset sampling interval sequence; Based on the preset sampling interval sequence, the preset sampling configuration information is generated.
4. The load rate testing method according to claim 2 or 3, characterized in that, The preset sampling configuration information is a preset sampling interval sequence, which includes multiple preset sampling intervals arranged in sequence. The step of determining multiple sampling times based on the target time and the preset sampling configuration information includes: The first sampling time is obtained by summing the target time and the preset initial sampling interval. Obtain the target number of samples and the first sampling interval; the first sampling interval is any one of the plurality of preset sampling intervals; The second sampling time is obtained by summing the first sampling time and the first sampling interval. The third sampling time is determined based on the second sampling time, the second sampling interval, and the target number of samplings; the second sampling interval is a preset sampling interval other than the first sampling interval among the plurality of preset sampling intervals; the sum of the number of the first sampling time, the number of the second sampling time, and the number of the third sampling time is the target number of samplings. The plurality of sampling times are obtained based on the first sampling time, the second sampling time, and the third sampling time.
5. The load rate testing method according to claim 4, characterized in that, The step of determining the third sampling time based on the second sampling time, the second sampling interval, and the target number of samplings includes: Based on the first sampling interval and the target number of samplings, a second sampling interval is determined from the preset sampling interval sequence; based on the second sampling interval and the second sampling time, a summation process is performed to obtain a third sampling time.
6. The load rate testing method according to claim 2, characterized in that, The preset sampling configuration information is a sampling interval generation model. The step of determining multiple sampling times based on the target time and the preset sampling configuration information includes: The first sampling time is obtained by summing the target time and the preset initial sampling interval. In response to the triggering operation of the first sampling, the target data to be processed is acquired; the first sampling is the sampling operation corresponding to the first sampling time. The target sampling interval is obtained by generating a model based on the target data to be processed and the sampling interval; The target sampling time is obtained by summing the first sampling time and the target sampling interval. The plurality of sampling times are obtained based on the first sampling time and the target sampling time.
7. A load rate testing device, characterized in that, The device includes: The sampling module is used to call the debugging interface of the target object to sample the associated address information of the target object and obtain multiple addresses to be tested; The first determining module is used to determine a target address that matches the first address information from the plurality of addresses to be tested; the first address information is the address information corresponding to the idle thread in the associated address information; The second determining module is used to determine the load rate of the target object based on the number of target addresses to be tested and the number of multiple addresses to be tested; The step of determining the target address that matches the first address information from the plurality of addresses to be tested includes: Determine the first address information corresponding to the idle thread from the associated address information; Obtain the start and end addresses of the first address information; The address to be tested that lies between the start address and the end address among the plurality of addresses to be tested is determined as the target address to be tested.
8. A load rate testing device, characterized in that, The device includes a processor and a memory, the memory storing at least one instruction or at least one program, the at least one instruction or the at least one program being loaded and executed by the processor to implement the load rate testing method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The storage medium stores at least one instruction or at least one program segment, which is loaded and executed by a processor according to any one of claims 1 to 6.
Citation Information
Patent Citations
Enhanced Auxiliary Interface Systems and Methods
CN113468087A
Debugger operating system for embedded systems
US20030074650A1