A method and system for testing application programming interfaces (APIs)

By working together with the test machine, oscilloscope, and host computer, the operation and sampling of the API are automatically controlled, solving the problem of inaccurate API test results in the existing technology, realizing automatic API testing, and improving the accuracy and consistency of test results.

CN115495293BActive Publication Date: 2026-11-17BEIJING SMARTCHIP MICROELECTRONICS TECHNOLOGY CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211045263.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-30
Publication Date
2026-11-17
Estimated Expiration
2042-08-30

AI Technical Summary

Technical Problem

In API testing of chips or circuits, existing technologies cannot achieve automated API testing, nor can they accurately control the number of loop runs and the sample size, resulting in insufficient accuracy and consistency of test results.

Method used

By working together with the test machine, oscilloscope, and host computer, the operation of the API is automatically controlled and sampling is performed. The sampling parameters and trigger delay of the oscilloscope are determined, thus realizing automatic testing of the API.

Benefits of technology

It enables precise control over the number of loop runs and sample size of the API, improving the accuracy and consistency of test results and ensuring the integrity and consistency of the test environment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115495293B_ABST
    Figure CN115495293B_ABST
Patent Text Reader

Abstract

This invention provides a method and system for testing an Application Programming Interface (API), belonging to the field of chip or circuit evaluation technology. The API is located on a testing machine. The method includes: the testing machine receiving a test command, the test command including at least one of enabling the API, disabling the API, and enabling and disabling oscilloscope sampling; controlling the API to run according to the test command, and controlling the oscilloscope to sample the API's running signals; and determining the API's operating parameters based on the oscilloscope's sampling results. This method achieves automated API testing, accurately controlling the number of API loops and the amount of sample data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of chip or circuit evaluation technology, and more specifically to a method and system for testing application programming interfaces (APIs). Background Technology

[0002] In the evaluation and testing of chips or circuits, accurately acquiring the timing characteristics of the application programming interfaces (APIs) of their functional modules, and simultaneously analyzing the corresponding electrical characteristics such as current and voltage, has become a crucial aspect of chip or circuit evaluation and testing. Therefore, external test conditions such as acquisition mode, sampling accuracy, sampling rate, and the sample size of the API under test play a vital role in ensuring the accuracy, consistency, and reproducibility of the data.

[0003] In common API testing, after the device under test (DUT) receives a start command from the host computer via a communication channel, it initiates the API to run repeatedly within the chip under test. Testers need to manually select specific intervals. This method cannot promptly determine whether the sampling rate and sampling mode meet the requirements, cannot adjust the sampling rate and sampling mode in a timely manner at different operating frequencies of the DUT, and cannot determine the number of times the API runs within the selected interval, nor can it accurately control the number of API samples. Therefore, the accuracy of the test results cannot be guaranteed. Summary of the Invention

[0004] The purpose of this invention is to provide a method and system for testing application programming interfaces (APIs). This method enables automatic testing of APIs and accurately controls the number of times the API is run in a loop and the sample size.

[0005] To achieve the above objectives, embodiments of the present invention provide a method for testing an application programming interface (API), wherein the API is located on a test machine, and the method includes: the test machine receiving a test command, the test command including at least one of enabling the API, disabling the API, enabling oscilloscope sampling, and disabling oscilloscope sampling; controlling the API to run according to the test command, and controlling the oscilloscope to sample the running signals of the API; and determining the running parameters of the API based on the sampling results of the oscilloscope.

[0006] Optionally, the method further includes: pre-sampling the API multiple times consecutively using the oscilloscope to determine the sampling parameters of the oscilloscope, the sampling parameters including the sampling time base and the trigger delay.

[0007] Optionally, the step of pre-sampling the API multiple times continuously using the oscilloscope to determine the oscilloscope's sampling parameters includes: continuously running the API N2 times, with the oscilloscope continuously sampling the API; obtaining the single sampling time T2 of the API, the operating frequency f1 of the test machine running the API, and the sample size N1 of the API displayed on a single screen of the oscilloscope; determining the minimum sampling rate f2 of the oscilloscope based on the operating frequency f1 as: f2 = 3 * f1; determining the current sampling rate f3 of the oscilloscope based on the single sampling time T2 and the sample size N1 as: f3 = maximum sampling rate / N1 / T2; determining the sampling time base based on the minimum sampling rate f2, the current sampling rate f3, the sample size N1, and the single sampling time T2; and determining the trigger delay of the oscilloscope based on the sampling time base and the single sampling time T2.

[0008] Optionally, determining the sampling time base based on the minimum sampling rate f2, the current sampling rate f3, the sample size N1, and the single sampling time T2 includes: if the current sampling rate is greater than the minimum sampling rate, then the sampling time base is N1*T2 / 10; if the current sampling rate is not greater than the minimum sampling rate, then the sample size N1 of the oscilloscope single-screen display API is reduced, and the updated current sampling rate f3 is determined again, until f3 is greater than f2.

[0009] Optionally, determining the trigger delay of the oscilloscope based on the sampling time base and the single sampling time T2 includes: the trigger delay T3 of the oscilloscope is: T3 = sampling time base * 5 + T2.

[0010] Optionally, the API's runtime parameters may include at least the API's runtime, number of runs, and percentage parameters.

[0011] Optionally, the test machine is at least one of a chip and a circuit equipped with an API.

[0012] On the other hand, the present invention provides a system for testing application programming interfaces (APIs). The system includes: a test machine, an oscilloscope, and a host computer. The test machine is equipped with the API under test. The test machine is connected to both the oscilloscope and the host computer, and the host computer is connected to the oscilloscope. The host computer is used to send test commands to the test machine. The test commands include at least one of enabling the API, disabling the API, enabling oscilloscope sampling, and disabling oscilloscope sampling. The test machine is used to enable or disable oscilloscope sampling according to the test commands. The oscilloscope is used to sample the API's operating signals. The host computer is also used to determine the API's operating parameters based on the oscilloscope's sampling results.

[0013] Optionally, the oscilloscope is also used to perform multiple consecutive samples of the API in advance to determine the sampling parameters of the oscilloscope, the sampling parameters including the sampling time base and the trigger delay.

[0014] Optionally, the step of pre-sampling the API multiple times to determine the oscilloscope's sampling parameters includes: continuously running the API N2 times, with the oscilloscope continuously sampling the API; obtaining the API's continuous sampling time, single sampling time T2, the operating frequency f1 of the test machine running the API, and the sample size N1 of the API displayed on a single screen by the oscilloscope; determining the oscilloscope's minimum sampling rate f2 based on the operating frequency f1 as: f2 = 3 * f1; determining the oscilloscope's current sampling rate f3 based on the single sampling time T2 and the sample size N1 as: f3 = maximum sampling rate / N1 / T2; determining the sampling time base based on the minimum sampling rate f2, the current sampling rate f3, the sample size N1, and the single sampling time T2; and determining the oscilloscope's trigger delay based on the sampling time base and the single sampling time T2.

[0015] Optionally, determining the sampling time base based on the minimum sampling rate f2, the current sampling rate f3, the sample size N1, and the single sampling time T2 includes: if the current sampling rate is greater than the minimum sampling rate, then the sampling time base of the oscilloscope is N1*T2 / 10; if the current sampling rate is not greater than the minimum sampling rate, then the sample size N1 of the oscilloscope's single-screen display API is reduced, and the updated current sampling rate f3 is determined again, until f3 is greater than f2.

[0016] Optionally, determining the trigger delay of the oscilloscope based on the sampling time base and the single sampling time T2 includes: the trigger delay T3 of the oscilloscope is: T3 = sampling time base * 5 + T2.

[0017] Optionally, the API's runtime parameters may include at least the API's runtime, number of runs, and percentage parameters.

[0018] Optionally, the test machine is provided with an output pin for controlling the oscilloscope; the output pin is used to turn the oscilloscope sampling on or off.

[0019] The method and system for testing application programming interfaces (APIs) provided by this invention enable automatic testing of APIs and accurately control the number of times the API is run in a loop and the number of samples tested.

[0020] Other features and advantages of the embodiments of the present invention will be described in detail in the following detailed description section. Attached Figure Description

[0021] The accompanying drawings are provided to further illustrate embodiments of the present invention and form part of the specification. They are used together with the following detailed description to explain the embodiments of the present invention, but do not constitute a limitation thereof. In the drawings: Figure 1 This is a flowchart of a method for testing an application programming interface (API) according to the present invention; Figure 2 This is a flowchart of the method for intercepting the execution of a certain API according to the present invention; Figure 3 This is a schematic diagram of the process for calculating the oscilloscope time base according to the present invention; Figure 4 This is a schematic diagram of the process for calculating the number of measurements based on the sample size according to the present invention; Figure 5 This is another schematic diagram of the process for calculating the number of measurement books based on the sample size according to the present invention; Figure 6 This is a system connection diagram of a test application programming interface (API) according to the present invention.

[0022] Explanation of reference numerals in the attached figures 100-Testing Machine; 200-Oscilloscope; 300 - Host computer. Detailed Implementation

[0023] The specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are for illustration and explanation only and are not intended to limit the scope of the present invention.

[0024] Figure 1 This is a flowchart of a method for testing an application programming interface (API) according to the present invention, such as... Figure 1 As shown, the method for testing the application programming interface (API) includes: step S101 receiving a test command for the test machine, the test command including at least one of enabling the API, disabling the API, enabling oscilloscope sampling, and disabling oscilloscope sampling. The test command also includes the number of loops for API execution. The API (Application Program Interface) is a set of definitions, programs, and protocols that enable communication between computer software. A primary function of an API is to provide a general set of functions. Programmers can reduce programming tasks by calling API functions to develop applications. An API also serves as middleware, providing data sharing across various platforms.

[0025] In a preferred embodiment, the test machine is communicatively connected to a host computer, and the host computer sends test commands to the test machine. The test machine is at least one of a chip or circuit equipped with an API. The host computer is communicatively connected to the chip through a communication channel. The host computer correctly starts the API under test in the chip under test to run in a loop. The number of loop runs is specified by the API test command sent by the host computer.

[0026] Step S102 involves controlling the API to run according to the test command and controlling the oscilloscope to sample the API's running signal. When the test machine is a chip equipped with an API, the host computer starts the API in the chip under test through the communication channel. The API is continuously and uninterruptedly started inside the chip under test, and the number of cycles is set by the host computer to continuously observe the API's running status.

[0027] Specifically, the GPIO pins of the chip under test can be configured, and the API can be enabled and disabled by toggling the GPIO pins. For example, the GPIO pins can be toggled at the start of the API test and toggled again at the end of the API test. The interval between two consecutive GPIO toggle signals occupies 50% to 100% of the oscilloscope screen. During chip API testing, the host computer initiates the API operation of the functional module of the chip under test through the communication channel. The API will be continuously and uninterruptedly started within the chip under test, with the number of cycles set by the host computer to N2, to continuously observe the API's operation.

[0028] Step S103 involves determining the operating parameters of the API based on the sampling results of the oscilloscope. The operating parameters of the API include at least the API's running time, number of runs, and percentage parameters. Simultaneously with receiving the trigger signal, the oscilloscope acquires corresponding electrical characteristic curves according to the tester's requirements and sends them to the host computer. The host computer software processes the corresponding analysis data and takes further action.

[0029] According to one specific implementation method, such as Figure 2 As shown, the host computer software first sends a command to start the API test to the chip under test (DUT) via a communication device, while simultaneously setting the oscilloscope to a wait-to-trigger state. After the DUT completes the processing of the API test command, the oscilloscope can acquire the continuous running curve of the entire running range of the API test, thereby obtaining the time taken for the DUT to execute the entire API test command. Based on the acquired API test time, the oscilloscope parameters, the sample size corresponding to the test item, the number of tests required, etc., are calculated. After the calculation is completed, the electrical characteristic curve is extracted.

[0030] The command to start the API test is sent again. This time, the oscilloscope captures the electrical characteristic curves that meet the sampling rate and sampling accuracy requirements, and the test results are obtained based on the number of tests. This completes the electrical characteristic test of the API under test, supporting the testing of parameters such as voltage, current, and frequency of the pins used in this test. The method for testing the API can automatically calculate the actual runtime and sample size of a single API test on the chip under test.

[0031] The method for testing the API further includes: pre-sampling the API multiple times continuously using the oscilloscope to determine the sampling parameters of the oscilloscope, the sampling parameters including the sampling time base and the trigger delay. Pre-sampling the API multiple times continuously using the oscilloscope to determine the sampling parameters includes: continuously running the API N2 times, with the oscilloscope continuously sampling the API; obtaining the single sampling time T2 of the API, the operating frequency f1 of the test machine running the API, and the sample size N1 of the API displayed on a single screen of the oscilloscope; determining the minimum sampling rate f2 of the oscilloscope based on the operating frequency f1 as: f2 = 3 * f1; determining the current sampling rate f3 of the oscilloscope based on the single sampling time T2 and the sample size N1 as: f3 = maximum sampling rate / N1 / T2; determining the sampling time base based on the minimum sampling rate f2, the current sampling rate f3, the sample size N1, and the single sampling time T2; and determining the trigger delay of the oscilloscope based on the sampling time base and the single sampling time T2.

[0032] The sampling time base mentioned here refers to the scanning time base of the oscilloscope, which is the basic unit for time display in an oscilloscope. The time base, or time reference, is mainly used in electronic circuits to represent the reference clock in digital circuits. In an oscilloscope, if the time base is 400ns, then each horizontal line represents one time base, i.e., a time span of 400ns.

[0033] The step of determining the sampling time base based on the minimum sampling rate f2, the current sampling rate f3, the sample size N1, and the single sampling time T2 includes: if the current sampling rate is greater than the minimum sampling rate, then the sampling time base is N1*T2 / 10; if the current sampling rate is not greater than the minimum sampling rate, then the sample size N1 of the oscilloscope single-screen display API is reduced, and the updated current sampling rate f3 is determined again, until f3 is greater than f2.

[0034] According to another specific implementation method Figure 3 This is a schematic diagram of the process for calculating the oscilloscope time base according to the present invention, as shown below. Figure 3 As shown, the oscilloscope's time base parameter is first initialized. This parameter can be dynamically adjusted according to the number of API loops set by the API test command, or a fixed initial value can be set for all APIs.

[0035] After the oscilloscope completes the API test trigger acquisition, it needs to determine whether the oscilloscope screen has completely received the entire running range of the API test. If the screen occupancy is between 50% and 100%, the current API test execution time is obtained. If the screen occupancy is less than 50%, the oscilloscope time base needs to be changed to 0.5 times the previous time base value, and the screen occupancy is checked again to see if it is between 50% and 100%, until this condition is met. If the screen occupancy is greater than 100%, the oscilloscope time base needs to be changed to 4 times the previous time base value, and the screen occupancy is checked again to see if it is between 50% and 100%, adjusting the time base value according to the percentage until the screen occupancy condition is met. When the screen occupancy meets the condition of being between 50% and 100%, the host computer obtains the total API test runtime T1 from the oscilloscope.

[0036] Figure 4 This is a flowchart illustrating the process of calculating the number of measurements based on the sample size according to the present invention, as shown below. Figure 4 As shown, a method is used to extract the required number of test samples for the API under test by combining the oscilloscope sampling rate and the calculated single API run time, and finally obtain the test results of the electrical characteristics of the API that need to be obtained.

[0037] First, after obtaining the overall runtime T1, calculate the API single-run time T2 = T1 / N2, and initialize the number of API test commands sent by the host computer n = 0. Next, based on the current operating frequency f1 of the chip under test, calculate the minimum oscilloscope sampling rate that should satisfy f2 = 3 * f1. Based on the required API sample size N1, calculate the sampling rate f3 = maximum sampling rate / N1 / T2 when the oscilloscope displays the API continuously running N1 times on a single screen.

[0038] If f3 is greater than f2, the time base is calculated as N1*T2 / 10. If f3 is less than f2, n=n+1 is calculated, and the number of API runs displayed on a single screen of the oscilloscope is changed to N1=N1 / 2 (the number of API runs displayed on a single screen of the oscilloscope is halved). f3 is calculated again until f3 is greater than f2. After calculating a suitable time base value, the trigger point of the oscilloscope is set to the end point of the API test, and the trigger delay is set. It is determined whether the number of API tests n sent by the host computer is 0. Otherwise, the API test is restarted again, and n=n-1 is calculated until n=0. The host computer obtains the electrical characteristic curve of the API through the curve captured by the oscilloscope, and finally obtains the electrical characteristic test result of the API under test according to the value of n+1. The step of determining the trigger delay of the oscilloscope according to the sampling time base and the single sampling time T2 includes: the trigger delay T3 of the oscilloscope is: T3=sampling time base*5+T2.

[0039] Figure 5This is another schematic diagram of the process for calculating the number of measurement books based on the sample size according to the present invention, as shown below. Figure 5 As shown, first, obtain the overall running time T1 of the API test; then calculate the single API running time as T1 / N2; calculate the oscilloscope sampling rate f2 = 3 * f1; calculate the sample size N3 at sampling rate f2 = maximum sampling rate / f2 / T2; determine the number of API test commands sent by the host computer n = rounded up (N1 / N3); calculate the time base as N3 * T2 / 10; the trigger is the GPIO edge at the end of the API test; the trigger delay is (time base * 5 + T2); determine if the number of API test commands sent by the host computer n is zero. If it is not zero, obtain the single test result, then n = n - 1, until n = 0, then obtain the final test result.

[0040] This method reduces the number of decision branches that increase the sampling rate. Although it can theoretically meet the minimum sampling rate requirement, the sampling accuracy for APIs with high operating frequency is lower than that of other methods. Figure 4 Based on the test results, it is the preferred option. Figure 4 This invention does not sacrifice sampling accuracy at the expense of increasing testing speed, thus ensuring the consistency of subsequent sample retesting results.

[0041] By automatically calculating the actual running time of a single API test of the chip under test, while taking into account the sample size and sampling accuracy, the sampling rate is increased. Conditions are set for the power consumption curve and the total number of samples to ensure the consistency of the test environment and the completeness of the test samples. At the same time, the purpose of automatic testing is achieved, which provides a guarantee for the accuracy and consistency of the test results.

[0042] Figure 6 This is a system connection diagram of a test API of the present invention, as shown below. Figure 6 As shown, the system for testing the API includes: a test machine 100, an oscilloscope 200, and a host computer 300. The test machine 100 is equipped with the API to be tested. The test machine 100 is connected to the oscilloscope 200 and the host computer 300, respectively. The host computer 300 is connected to the oscilloscope 200.

[0043] Specifically, the host computer 300 and the testing machine 100 can interact, and the oscilloscope 200 can acquire test signals from the testing machine 100. It can also turn the acquisition signal switch on or off based on a trigger signal from the testing machine 100. The signals acquired by the oscilloscope 200 are processed and then sent to the host computer 300 in real time. The testing machine 100 has output pins for controlling the oscilloscope 200; these output pins are used to turn the oscilloscope 200's sampling on or off.

[0044] The host computer 300 is used to send test commands to the test machine 100. The test commands include at least one of enabling API, disabling API, enabling oscilloscope 200 sampling, and disabling oscilloscope 200 sampling. The test machine 100 is used to enable or disable oscilloscope 200 sampling according to the test commands. The oscilloscope 200 is used to sample the API operation signal of the test machine 100. The host computer 300 is also used to determine the API's operating parameters based on the oscilloscope 200 sampling results. The API's operating parameters include at least the API's running time, number of runs, and percentage parameters.

[0045] The oscilloscope is also used to perform multiple consecutive samples of the API in advance to determine the sampling parameters of the oscilloscope, including the sampling time base and the trigger delay.

[0046] The step of performing multiple consecutive samplings of the API to determine the sampling parameters of the oscilloscope includes: continuously running the API N2 times, with the oscilloscope continuously sampling the API; obtaining the continuous sampling time of the API, the single sampling time T2, the operating frequency f1 of the test machine running the API, and the sample size N1 of the API displayed on a single screen of the oscilloscope; determining the minimum sampling rate f2 of the oscilloscope based on the operating frequency f1 as: f2 = 3 * f1; determining the current sampling rate f3 of the oscilloscope based on the single sampling time T2 and the sample size N1 as: f3 = maximum sampling rate / N1 / T2; determining the sampling time base based on the minimum sampling rate f2, the current sampling rate f3, the sample size N1, and the single sampling time T2; and determining the trigger delay of the oscilloscope based on the sampling time base and the single sampling time T2. The step of determining the sampling time base based on the minimum sampling rate f2, the current sampling rate f3, the sample size N1, and the single sampling time T2 includes: if the current sampling rate is greater than the minimum sampling rate, then the sampling time base of the oscilloscope is N1*T2 / 10; if the current sampling rate is not greater than the minimum sampling rate, then the sample size N1 of the oscilloscope's single-screen display API is reduced, and the updated current sampling rate f3 is determined again, until f3 is greater than f2. The step of determining the trigger delay of the oscilloscope based on the sampling time base and the single sampling time T2 includes: the trigger delay T3 of the oscilloscope is: T3 = sampling time base * 5 + T2.

[0047] The testing machine is equipped with an output pin for controlling the oscilloscope; the output pin is used to turn the oscilloscope sampling on or off.

[0048] A method for testing an API according to the present invention includes: the testing machine receiving a test command, the test command including at least one of enabling the API, disabling the API, enabling oscilloscope sampling, and disabling oscilloscope sampling; controlling the operation of the API according to the test command, and the oscilloscope sampling the operation signal of the API; and determining the operation parameters of the API based on the sampling results of the oscilloscope. This method provides an automatic method for acquiring continuous operation curves of an API. In the electrical characteristic testing of the API, it ensures factors such as sample size, acquisition accuracy, and sampling rate, thereby improving test quality, test efficiency, and the level of automated testing, ultimately ensuring the reliability of the test results.

[0049] The optional embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the embodiments of the present invention are not limited to the specific details in the above embodiments. Within the scope of the technical concept of the embodiments of the present invention, various simple modifications can be made to the technical solutions of the embodiments of the present invention, and these simple modifications all fall within the protection scope of the embodiments of the present invention.

[0050] It should also be noted that the various specific technical features described in the above embodiments can be combined in any suitable manner without contradiction. To avoid unnecessary repetition, the embodiments of the present invention will not describe the various possible combinations separately.

[0051] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0052] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A method for testing an application programming interface (API), characterized in that, The API is located on the test machine, and the method includes: The test machine receives test commands, which include at least one of enabling API, disabling API, enabling oscilloscope sampling, and disabling oscilloscope sampling. The test command controls the operation of the API and controls the oscilloscope to sample the API's operation signals. The operating parameters of the API are determined based on the sampling results of the oscilloscope. The method further includes: pre-sampling the API multiple times consecutively using the oscilloscope to determine the oscilloscope's sampling parameters, the sampling parameters including a sampling time base and a trigger delay, including: The API is run N2 times continuously, and the oscilloscope continuously samples the API. Obtain the single sampling time T2 of the API, the operating frequency f1 of the test machine running the API, and the number of API samples N1 displayed on a single screen of the oscilloscope; Based on the operating frequency f1, the minimum sampling rate f2 of the oscilloscope is determined to be: f2 = 3 * f1; Based on the single sampling time T2 and the sample size N1, the current sampling rate f3 of the oscilloscope is determined as: f3 = maximum sampling rate / N1 / T2; The sampling time base is determined based on the minimum sampling rate f2, the current sampling rate f3, the sample size N1, and the single sampling time T2; The trigger delay of the oscilloscope is determined based on the sampling time base and the single sampling time T2.

2. The method according to claim 1, characterized in that, The step of determining the sampling time base based on the minimum sampling rate f2, the current sampling rate f3, the sample size N1, and the single sampling time T2 includes: If the current sampling rate is greater than the minimum sampling rate, then the sampling time base is N1*T2 / 10; If the current sampling rate is not greater than the minimum sampling rate, then the sample size N1 of the oscilloscope single-screen display API is reduced, and the updated current sampling rate f3 is determined again, until f3 is greater than f2.

3. The method according to claim 1, characterized in that, The step of determining the trigger delay of the oscilloscope based on the sampling time base and the single sampling time T2 includes: The trigger delay T3 of the oscilloscope is: T3 = sampling time base * 5 + T2.

4. The method according to claim 1, characterized in that, The API's runtime parameters include at least the API's runtime, number of runs, and percentage parameters.

5. The method according to claim 1, characterized in that, The testing machine is at least one of a chip and a circuit equipped with an API.

6. A system for testing application programming interface (API), characterized in that, The system includes: a test machine, an oscilloscope, and a host computer; the test machine is equipped with an API under test. The testing machine is connected to the oscilloscope and the host computer respectively, and the host computer is connected to the oscilloscope; The host computer is used to send test commands to the test machine. The test commands include at least one of enabling API, disabling API, enabling oscilloscope sampling, and disabling oscilloscope sampling. The test machine is used to turn the oscilloscope sampling on or off according to the test command, and the oscilloscope is used to sample the API operation signal of the test machine; The host computer is also used to determine the operating parameters of the API based on the sampling results of the oscilloscope; The oscilloscope is also used to pre-sample the API multiple times consecutively to determine the oscilloscope's sampling parameters, which include a sampling time base and a trigger delay, including: The API is run N2 times continuously, and the oscilloscope continuously samples the API. Obtain the continuous sampling time of the API, the single sampling time T2, the operating frequency f1 of the test machine running the API, and the number of API samples N1 displayed on a single screen of the oscilloscope; Based on the operating frequency f1, the minimum sampling rate f2 of the oscilloscope is determined to be: f2 = 3 * f1; Based on the single sampling time T2 and the sample size N1, the current sampling rate f3 of the oscilloscope is determined as: f3 = maximum sampling rate / N1 / T2; The sampling time base is determined based on the minimum sampling rate f2, the current sampling rate f3, the sample size N1, and the single sampling time T2; The trigger delay of the oscilloscope is determined based on the sampling time base and the single sampling time T2.

7. The system according to claim 6, characterized in that, The step of determining the sampling time base based on the minimum sampling rate f2, the current sampling rate f3, the sample size N1, and the single sampling time T2 includes: If the current sampling rate is greater than the minimum sampling rate, then the sampling time base of the oscilloscope is N1*T2 / 10; If the current sampling rate is not greater than the minimum sampling rate, then the sample size N1 of the oscilloscope single-screen display API is reduced, and the updated current sampling rate f3 is determined again, until f3 is greater than f2.

8. The system according to claim 6, characterized in that, The step of determining the trigger delay of the oscilloscope based on the sampling time base and the single sampling time T2 includes: The trigger delay T3 of the oscilloscope is: T3 = sampling time base * 5 + T2.

9. The system according to claim 6, characterized in that, The API's runtime parameters include at least the API's runtime, number of runs, and percentage parameters.

10. The system according to claim 6, characterized in that, The testing machine is equipped with an output pin for controlling the oscilloscope; The output pin is used to turn the oscilloscope sampling on or off.

Citation Information

Patent Citations

  • Chip testing device, platform and method

    CN111596203A