WCET acquisition method and device based on dynamic measurement

Through the WCET acquisition method based on dynamic measurement, using instrumentation algorithm and dynamic measurement technology, the problems of low WCET calculation efficiency and poor accuracy of traditional static analysis methods in complex processors are solved, and efficient and accurate worst execution is achieved Time analysis.

CN119415436APending Publication Date: 2025-02-11LUOYANG INST OF ELECTRO OPTICAL EQUIP OF AVIC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411593858.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-08
Publication Date
2025-02-11

AI Technical Summary

Technical Problem

Traditional static analysis methods are difficult to accurately calculate the worst-case execution time (WCET) of the program and are inefficient when the processor characteristics are complex.

Method used

The WCET acquisition method based on dynamic measurement is adopted, and the branch call tree is obtained through the instrumentation algorithm, invalid branch points are removed, valid use cases are generated, and the program execution time is dynamically measured until all paths are covered, and the real worst execution time is obtained.

Benefits of technology

It improves the accuracy and efficiency of WCET analysis, avoids the processing of complex processor instructions and catches in static analysis, and realizes the traversal of the program's full branch path on the real target machine, and the results are real and accurate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119415436A_ABST
    Figure CN119415436A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of avionics. The invention provides a WCET acquisition method and device based on dynamic measurement. According to the embodiment of the invention, the worst running time can be analyzed without considering static analysis processes such as complex machine instructions and catch processing, so that the efficiency is improved; the full branch path of the program is traversed on the real target machine, and the result is real and accurate.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] EUROCAE ED-12B / RTCA DO-178B "Software Considerations in Airborne Systems and Equipment Qualification Review" (hereinafter referred to as DO-178B) is a guideline recommended to be followed in the software development process, proposed by the American Radio Technical Commission for Aeronautics and the European Civil Aviation Equipment Organization to support the development of airborne systems and equipment containing digital computers. DO-178B is applicable to the development and qualification review of software in airborne systems and equipment. It can be used by developers of airborne systems and equipment (including software) and by qualification review agencies. Civil aircraft projects require airworthiness certification, and related software must meet the requirements of DO-178B. Section 6.3.4 f of DO-178B stipulates: Software must meet accuracy and consistency goals, which include worst case execution time (WCET) analysis, etc.

[0003] Traditional static analysis methods calculate the WCET of a program based on the characteristics of the target processor, such as machine instructions, catch, etc. However, when the processor characteristics are very complex, the corresponding static analysis and calculation process also becomes very complex and inefficient. In addition, this method may introduce many unknown settings, which may lead to inaccurate final results and only serve as estimates.

[0004] Therefore, it is necessary to improve one or more problems existing in the above-mentioned related technical solutions.

[0005] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention

[0006] The purpose of the embodiments of the present disclosure is to provide a WCET acquisition method and device based on dynamic measurement, thereby overcoming one or more problems caused by limitations and defects of related technologies at least to a certain extent.

[0007] According to a first aspect of an embodiment of the present disclosure, a WCET acquisition method based on dynamic measurement is provided, the method comprising: Based on the branch points and function call relationships of the source code functions, the instrumentation algorithm is used to obtain the branch point sequence set from the root node to the leaf node of the branch call tree; Removing invalid branch points from the branch point sequence set to obtain all valid paths, and checking and confirming the removed branch point sequence; Generate and determine effective use cases, and integrate the effective use cases with developed use cases to obtain a test case set; Adding program execution time to the branch point sequence set and performing packaging processing to generate a first target code, and executing the test case set according to the first target code to obtain the worst execution time and the corresponding worst test case of the case execution to all path nodes; Determine whether all paths are covered according to the path nodes executed by the test case; if so, output the worst test case; if not, update the test case set; Execute the updated test case set according to the first target code to update the case execution to all path nodes, the worst execution time and the worst test case; Continue to determine whether all paths are covered, until all paths are covered, to obtain the worst test case; The program execution time is increased to the source code and packaged to generate a second target code. The worst test case is executed according to the second target code to obtain the real worst execution time.

[0008] Furthermore, based on the branch points of the functions in the source code and the function call relationship, the step of using the stub algorithm to obtain the branch point sequence set of the branch call tree from the root node to the leaf node includes: Query the branch points of all functions of the source code and display all branch points; Acquire the function call relationship according to the source code, and insert branch markers into each branch point through the plugging algorithm; Get the branch call tree starting from the entry function and the branch point sequence set from the root node to the leaf node of the branch call tree.

[0009] Furthermore, the step of removing invalid branch points from the branch point sequence set to obtain all valid paths, and verifying and confirming the removed branch point sequence includes: Removing invalid branch points from the branch point sequence set to obtain all valid paths; List all the invalid branch points and branch paths that have been removed, and verify the invalid branch points and branch paths that have been removed; If the verification result is correct, add it to the valid path; If the verification result is incorrect, it will be deleted.

[0010] Further, the steps of generating and determining effective use cases, and integrating the effective use cases with developed use cases to obtain a test case set include: Acquire interface information, and associate related interfaces in the interface information to obtain effectively associated interfaces; Automatically generate use cases by combining the effectively associated interfaces, and determine the effective use cases by general example pre-execution; The formats of the developed use cases are converted and unified, and the integrated developed use cases and the valid use cases are integrated to obtain the test case set.

[0011] Further, the step of adding program execution time to the branch point sequence set and performing packaging processing to generate a first target code, and executing the test case set according to the first target code to obtain the steps of executing the test case to all path nodes, the worst execution time and the corresponding worst test case includes: Processing the branch point sequence set to increase program execution time, and packaging the branch point sequence set to generate the first target code; Execute the test case set according to the first target code to obtain the execution time of the test case to all path nodes, each path branch and the maximum path node; The worst execution time and the corresponding worst test case are obtained according to the execution time of each path branch and the maximum path node.

[0012] Furthermore, the step of updating the test case set includes: Counting uncovered paths, and removing invalid branch points from the valid paths again to update the valid paths; According to the new valid test case, a new test case is generated to update the test case set.

[0013] Further, executing the updated test case set according to the first target code to update the test case execution to all path nodes, the worst execution time and the worst test case step includes: Execute the updated test case set according to the first target code to obtain new test cases executed to all path nodes, new worst execution time and new worst test cases; According to the new use case being executed to all path nodes, the new worst execution time and the new worst test case, the execution of the use case to all path nodes, the worst execution time and the worst test case are updated.

[0014] According to a second aspect of an embodiment of the present disclosure, a WCET acquisition device based on dynamic measurement is provided, the device comprising: Program branch stub, which is used to obtain the branch point sequence set of the branch call tree from the root node to the leaf node based on the branch points and function call relationship of the source code. A path processor, used for removing invalid branch points from the branch point sequence set to obtain all valid paths, and checking and confirming the removed branch point sequence; A use case capturer, used to generate and determine valid use cases, and integrate the valid use cases with developed use cases to obtain a test case set; A first program execution time statistics device is used to add program execution time to the branch point sequence set and perform packaging processing, generate a first target code, and execute the test case set according to the first target code to obtain the execution of the test case to all path nodes, the worst execution time and the corresponding worst test case; A first branch traverser is used to determine whether all paths are covered according to the path nodes executed by the test case; if so, output the worst test case; if not, update the test case set; A second program execution time statistics device, used for executing the updated test case set according to the first target code, so as to update the execution of the test case to all path nodes, the worst execution time and the worst test case; A second branch traverser is used to continue to determine whether all paths are covered, until all paths are covered, so as to obtain the worst test case; The third program execution time statistics device is used to add program execution time to the source code and package it to generate a second target code, and execute the worst test case according to the second target code to obtain the real worst execution time.

[0015] According to a third aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the steps of the WCET acquisition method based on dynamic measurement described in any one of the above embodiments are implemented.

[0016] According to a fourth aspect of an embodiment of the present disclosure, there is provided an electronic device, including: Processor; and A memory, configured to store executable instructions of the processor; The processor is configured to execute the steps of the WCET acquisition method based on dynamic measurement in any one of the above embodiments by executing the executable instructions.

[0017] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects: In the embodiments of the present disclosure, through the WCET acquisition method and device based on dynamic measurement, on the one hand, the worst execution time analysis of the program is realized by means of use case stimulation and dynamic measurement. According to the branch points of the function and the function call relationship, the branch point sequence set from the root node to the leaf node of the branch call tree is obtained by the stub algorithm. The invalid branch points of the branch point sequence set are removed to obtain all valid paths, and the removed branches and the reasons for removal are checked and confirmed. Automatically generate valid use cases, convert and unify the format of the developed use cases, integrate all use cases to obtain test cases; build a driver for the generated test cases, and use the examples to drive the software; obtain the path nodes covered by the input test cases, count the uncovered paths, feed back to the path processor, delete the invalid branches, feed back to the use case capturer, and design use cases for valid branches. Process the source code, add the program execution time statistics function, and then obtain the execution time of each path branch and obtain the maximum path node and the worst execution time. On the other hand, the worst-case running time analysis does not need to consider complex static analysis processes such as machine instructions and catch processing, which improves efficiency; the entire branch path of the program is traversed on the real target machine, and the results are true and accurate.

[0018] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.

[0020] Figure 1 A step diagram showing a WCET acquisition method based on dynamic measurement in an exemplary embodiment of the present disclosure; Figure 2 A schematic diagram showing a WCET acquisition device based on dynamic measurement in an exemplary embodiment of the present disclosure; Figure 3 A schematic diagram showing an instrumentation point using a program branch instrumenter in an exemplary embodiment of the present disclosure; Figure 4 A schematic diagram showing the functional composition of a program branch inserter in an exemplary embodiment of the present disclosure is shown; Figure 5 A schematic diagram showing the functional composition of a path processor in an exemplary embodiment of the present disclosure is shown; Figure 6A schematic diagram showing the functional composition of a use case capturer in an exemplary embodiment of the present disclosure is shown; Figure 7 A schematic diagram showing the functional composition of a first branch traverser in an exemplary embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0021] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the disclosure will be more comprehensive and complete and to fully convey the concepts of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0022] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.

[0023] In this example implementation, a WCET acquisition method based on dynamic measurement is first provided, which can be applied to a terminal device, such as a mobile phone, a personal digital assistant, a laptop, a tablet computer, a smart watch, and other mobile terminals [flexibly adjusted according to specific circumstances, such as the terminal device is a server, etc.]. Figure 1 As shown in , the method may include the following steps: Step S101: Based on the branch points and function call relationships of the source code functions, a branch point sequence set of a branch call tree from a root node to a leaf node is obtained by using an instrumentation algorithm; Step S102: removing invalid branch points from the branch point sequence set to obtain all valid paths, and checking and confirming the removed branch point sequence; Step S103: Generate and determine valid use cases, and integrate the valid use cases with developed use cases to obtain a test case set; Step S104: adding program execution time to the branch point sequence set and performing packaging processing to generate a first target code, and executing the test case set according to the first target code to obtain the execution of the test case to all path nodes, the worst execution time and the corresponding worst test case; Step S105: judging whether all paths are covered according to the path nodes executed by the test case; if so, outputting the worst test case; if not, updating the test case set; Step S106: executing the updated test case set according to the first target code to update the case execution to all path nodes, the worst execution time and the worst test case; Step S107: Continue to determine whether all paths are covered, until all paths are covered, so as to obtain the worst test case; Step S108: adding program execution time to the source code and packaging it to generate a second target code, and executing the worst test case according to the second target code to obtain the actual worst execution time.

[0024] Through the WCET acquisition method based on dynamic measurement, on the one hand, the worst execution time analysis of the program is realized by using use case stimulation and dynamic measurement. According to the branch points of the function and the function call relationship, the branch point sequence set from the root node to the leaf node of the branch call tree is obtained through the stub algorithm. The invalid branch points of the branch point sequence set are removed to obtain all valid paths, and the removed branches and the reasons for removal are checked and confirmed. Automatically generate valid use cases, convert and unify the format of the developed use cases, integrate all use cases to obtain test cases; build a driver for the generated test cases, and use the examples to drive the software; obtain the path nodes covered by the input test cases, count the uncovered paths, and feed back to the path processor 120 to delete invalid branches, and feed back to the use case capturer 130 to design use cases for valid branches. Process the source code, add the program execution time statistics function, and then obtain the execution time of each path branch and obtain the maximum path node and the worst execution time. On the other hand, the worst-case running time analysis does not need to consider complex static analysis processes such as machine instructions and catch processing, which improves efficiency; the entire branch path of the program is traversed on the real target machine, and the results are true and accurate.

[0025] Next, we will refer to Figure 1 Each step of the above method in this example implementation is described in more detail.

[0026] In step S101, the program branch stub query the branch points of all functions of the source code (such as conditional judgment, loop, etc.) and display all branch points; the instrumentation unit obtains the function call relationship according to the source program or target code, and inserts branch marks into each branch point through the stub technology, thereby obtaining the branch call tree starting from the entry function, and the branch point sequence set of the branch call tree from the root node to the leaf node.

[0027] In step S102, the input of the path processor is the above-mentioned branch point sequence. First, the path processor removes invalid branch points, such as empty branches reserved for robustness (empty else, default branches, etc.), branches that are unreachable due to inconsistencies, and then obtains all valid paths, that is, paths that are reachable when the software is actually running. Finally, all removed branch points and branch paths are listed. The verification unit will perform verification and display the machine verification results. The results will present the types of invalid branches removed and the logic before and after, and the verification results can be confirmed by manually adding instructions.

[0028] In step S103, first, according to the use case automatic generation unit, the interface information of the software is obtained, the related interfaces are associated, and the effectively associated interfaces are combined to automatically generate the use case. The validity of the final use case needs to be confirmed by the use case pre-execution. Then, by regularizing the use case unit, the format of the developed use case is converted and unified, and all use cases are integrated. Finally, the use case is fed into the branch traverser.

[0029] In step S104 to step S108, the branch point sequence set is processed to increase the program execution time, and is packaged to generate a first target code; the test case set is executed according to the first target code to obtain the execution time of the case to all path nodes, the execution time of each path branch and the maximum path node; the worst execution time and the corresponding worst test case are obtained according to the execution time of each path branch and the maximum path node.

[0030] Determine whether all paths are covered based on the path nodes reached by the use case execution; If so, output the worst test case; If not, update the test case set, count the uncovered paths, and remove invalid branch points from the valid paths again to update the valid paths.

[0031] Generate new test cases based on new valid test cases to update the test case set.

[0032] Execute the updated test case set according to the first target code to obtain new test case execution to all path nodes, new worst execution time and new worst test case; based on the new test case execution to all path nodes, new worst execution time and new worst test case, update the test case execution to all path nodes, worst execution time and worst test case.

[0033] Continue to determine whether all paths are covered until all paths are covered to obtain the worst test case; increase the program execution time to the source code and package it to generate a second target code, and execute the worst test case according to the second target code to obtain the real worst execution time.

[0034] It should be noted that, although the steps of the method in the present disclosure are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step for execution, and / or one step may be decomposed into multiple steps for execution, etc. In addition, it is also easy to understand that these steps may be, for example, executed synchronously or asynchronously in multiple modules / processes / threads.

[0035] Furthermore, in this exemplary embodiment, a WCET acquisition device based on dynamic measurement is also provided. Figure 2 As shown in , the apparatus 100 may include a program branch inserter 110, a path processor 120, a use case capturer 130, a first program execution time statistics 140, a first branch traverser 150, a second program execution time statistics 160, a second branch traverser 170, and a second program execution time statistics 180. Among them, A program branch plugger 110 is used to obtain a branch point sequence set from a root node to a leaf node of a branch call tree using a plugging algorithm based on the branch points and function call relationships of the source code functions; The path processor 120 is used to remove invalid branch points from the branch point sequence set to obtain all valid paths, and to check and confirm the removed branch point sequence; A use case capturer 130, used to generate and determine valid use cases, and integrate the valid use cases with developed use cases to obtain a test case set; A first program execution time statistics device 140 is used to add program execution time to the branch point sequence set and perform packaging processing, generate a first target code, and execute the test case set according to the first target code to obtain the worst execution time and the corresponding worst test case of the test case execution to all path nodes; The first branch traverser 150 is used to determine whether all paths are covered according to the path nodes executed by the test case; if so, output the worst test case; if not, update the test case set; A second program execution time statistics device 160, configured to execute the updated test case set according to the first target code to update the execution of the test case to all path nodes, the worst execution time and the worst test case; The second branch traverser 170 is used to continue to determine whether all paths are covered, until all paths are covered, so as to obtain the worst test case; The third program execution time statistics device 180 is used to add program execution time to the source code and perform packaging processing to generate a second target code, and execute the worst test case according to the second target code to obtain the real worst execution time.

[0036] In the program branch plugger 110, the program branch plugger 110 queries the branch points (such as conditional judgment, loop, etc.) of all functions in the source code and displays all branch points; the plug-in unit obtains the function call relationship according to the source program or the target code, and inserts branch marks into each branch point through the plug-in technology, thereby obtaining the branch call tree starting from the entry function, and the branch point sequence set of the branch call tree from the root node to the leaf node, such as Figure 3 The sequence in (entry function->insertion point 3->insertion point 15), the functional composition of the program branch plugger 110 is as follows Figure 4 shown.

[0037] The input of the path processor 120 is the above-mentioned branch point sequence. First, the path processor 120 removes invalid branch points, such as empty branches reserved for robustness (empty else, default branches, etc.), and branches that are unreachable due to inconsistencies, and then obtains all valid paths, that is, paths that are reachable when the software is actually running. Finally, all removed branch points and branch paths are listed. The verification unit will perform the verification and display the machine verification results. The results will show the types of invalid branches removed and the logic before and after, and the verification results can be confirmed by manually adding instructions. The functional composition of the path processor 120 is as follows: Figure 5 shown.

[0038] In the use case capturer 130, first, according to the use case automatic generation unit, the interface information of the software is obtained, the related interfaces are associated, and the valid associated interfaces are combined to automatically generate the use case. The validity of the final use case needs to be confirmed by the use case pre-execution. Then, by regularizing the use case unit, the format of the developed use case is converted and unified, and all use cases are integrated. Finally, the use case is fed into the branch traverser. The functional composition of the use case capturer 130 is as follows: Figure 6 shown.

[0039] In the branch traverser (i.e., the first branch traverser 150 and the second branch traverser 170), a use case driver is constructed through a use case driver unit, and the software can be driven using examples; the branch point information is packaged and processed, and the target code is loaded onto the target machine. The bus driver unit initializes the data transmission bus and uploads the branch information, time information, etc. of the program. The result processing unit obtains the path nodes covered by the input test case; counts the uncovered paths, feeds back to the path processor 120, deletes invalid branches, and feeds back to the use case capturer 130 to design use cases for valid branches; at the same time, it can also display the paths that have not been executed, and provide prompts for use case design. The functional composition of the first branch traverser is as follows: Figure 7 shown.

[0040] The program execution time statistics device (i.e., the first program execution time statistics device 140, the second program execution time statistics device 160, and the third program execution time statistics device 180) processes the source code to add the program execution time statistics function; and then obtains the execution time of each path branch and obtains the maximum path node, and the maximum execution time.

[0041] In a specific embodiment, according to the following source code:

[0042] For the above source code, all branch points, insertion points, and branch point sequences are obtained through the program branch plugger 110. In the example, the branch points and insertion points of each function found by the program branch plugger 110 have been marked in the comments. The obtained branch point sequences are: main->insertion point 1->insertion point 3->insertion point 5; main->insertion point 1->insertion point 3->insertion point 6; main->insertion point 1->insertion point 4->insertion point 5; main->insertion point 1->insertion point 4->insertion point 6; main->insertion point 2->insertion point 5; main->insertion point 2->insertion point 6.

[0043] The path processor 120 removes the branch point (insertion point 2) reserved for robustness, and the branch path where the insertion point 2 is located (main->insertion point 2->insertion point 5; main->insertion point 2->insertion point 6) is removed.

[0044] The use case capturer 130 is used to automatically generate and integrate use cases; the remaining four valid branches are traversed through the branch traverser; and the program execution time is obtained through the get_Time_Start and get_Time_End functions designed by the program execution time statistics device.

[0045] Through the WCET acquisition method and device based on dynamic measurement, on the one hand, the worst execution time analysis of the program is realized by use case stimulation and dynamic measurement. According to the branch points of the function and the function call relationship, the branch point sequence set from the root node to the leaf node of the branch call tree is obtained through the stub algorithm. The invalid branch points of the branch point sequence set are removed to obtain all valid paths, and the removed branches and the reasons for removal are checked and confirmed. Automatically generate valid use cases, convert and unify the format of the developed use cases, integrate all use cases to obtain test cases; build a driver for the generated test cases, and use the examples to drive the software; obtain the path nodes covered by the input test cases, count the uncovered paths, and feed back to the path processor 120 to delete invalid branches, feed back to the use case capturer 130, and design use cases for valid branches. Process the source code, add the program execution time statistics function, and then obtain the execution time of each path branch and obtain the maximum path node and the worst execution time. On the other hand, the worst-case running time analysis does not need to consider complex static analysis processes such as machine instructions and catch processing, which improves efficiency; the entire branch path of the program is traversed on the real target machine, and the results are true and accurate.

[0046] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0047] It should be noted that although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiment of the present disclosure, the features and functions of two or more modules or units described above can be concretized in one module or unit. Conversely, the features and functions of a module or unit described above can be further divided into multiple modules or units for concretization. The components displayed as modules or units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the disclosed solution. Those of ordinary skill in the art can understand and implement it without paying creative work.

[0048] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is further provided, on which a computer program is stored, and when the program is included in a processor and executed, the steps of the WCET acquisition method based on dynamic measurement described in any of the above embodiments can be implemented. In some possible implementations, various aspects of the present invention can also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps of various exemplary embodiments of the present invention described in the WCET acquisition method based on dynamic measurement section of the specification.

[0049] In an exemplary embodiment of the present disclosure, an electronic device is further provided, which may include a processor and a memory for storing executable instructions of the processor, wherein the processor is configured to execute the steps of the WCET acquisition method based on dynamic measurement in any of the above embodiments by executing the executable instructions.

[0050] It will be appreciated by those skilled in the art that various aspects of the present invention may be implemented as a system, method or program product. Therefore, various aspects of the present invention may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as a "circuit", "module" or "system".

[0051] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any modification, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the appended claims.

Claims

1. A WCET acquisition method based on dynamic measurement, characterized in that: The method includes: Based on the branch points and function call relationships of the source code functions, the instrumentation algorithm is used to obtain the branch point sequence set from the root node to the leaf node of the branch call tree; Removing invalid branch points from the branch point sequence set to obtain all valid paths, and checking and confirming the removed branch point sequence; Generate and determine effective use cases, and integrate the effective use cases with developed use cases to obtain a test case set; Adding program execution time to the branch point sequence set and performing packaging processing to generate a first target code, and executing the test case set according to the first target code to obtain the worst execution time and the corresponding worst test case of the case execution to all path nodes; Determine whether all paths are covered according to the path nodes executed by the test case; if so, output the worst test case; if not, update the test case set; Execute the updated test case set according to the first target code to update the case execution to all path nodes, the worst execution time and the worst test case; Continue to determine whether all paths are covered, until all paths are covered, to obtain the worst test case; The program execution time is increased to the source code and packaged to generate a second target code. The worst test case is executed according to the second target code to obtain the real worst execution time.

2. The WCET acquisition method based on dynamic measurement according to claim 1, characterized in that: Based on the branch points and function call relationships of the source code functions, the step of using the instrumentation algorithm to obtain a branch point sequence set from the root node to the leaf node of the branch call tree includes: Query the branch points of all functions of the source code and display all branch points; Acquire the function call relationship according to the source code, and insert branch markers into each branch point through the plugging algorithm; Get the branch call tree starting from the entry function and the branch point sequence set from the root node to the leaf node of the branch call tree.

3. The WCET acquisition method based on dynamic measurement according to claim 2 is characterized in that: The step of removing invalid branch points from the branch point sequence set to obtain all valid paths, and checking and confirming the removed branch point sequence includes: Removing invalid branch points from the branch point sequence set to obtain all valid paths; List all the invalid branch points and branch paths that have been removed, and verify the invalid branch points and branch paths that have been removed; If the verification result is correct, add it to the valid path; If the verification result is incorrect, it will be deleted.

4. The WCET acquisition method based on dynamic measurement according to claim 3 is characterized in that: The step of generating and determining effective use cases, and integrating the effective use cases with developed use cases to obtain a first test case set includes: Acquire interface information, and associate related interfaces in the interface information to obtain effectively associated interfaces; Automatically generate use cases by combining the effectively associated interfaces, and determine the effective use cases by general example pre-execution; The formats of the developed use cases are converted and unified, and the integrated developed use cases and the valid use cases are integrated to obtain the test case set.

5. The WCET acquisition method based on dynamic measurement according to claim 4 is characterized in that: The step of increasing the program execution time for the branch point sequence set and performing packaging processing to generate a first target code, and executing the test case set according to the first target code to obtain the steps of executing the test case to all path nodes, the worst execution time and the corresponding worst test case, includes: Processing the branch point sequence set to increase program execution time, and packaging the branch point sequence set to generate the first target code; Execute the test case set according to the first target code to obtain the execution time of the test case to all path nodes, each path branch and the maximum path node; The worst execution time and the corresponding worst test case are obtained according to the execution time of each path branch and the maximum path node.

6. The WCET acquisition method based on dynamic measurement according to claim 5 is characterized in that: The step of updating the test case set includes: Counting uncovered paths, and removing invalid branch points from the valid paths again to update the valid paths; According to the new valid test case, a new test case is generated to update the test case set.

7. The WCET acquisition method based on dynamic measurement according to claim 6 is characterized in that: The step of executing the updated test case set according to the first target code to update the case execution to all path nodes, the worst execution time and the worst test case includes: Execute the updated test case set according to the first target code to obtain new test cases executed to all path nodes, new worst execution time and new worst test cases; According to the new use case being executed to all path nodes, the new worst execution time and the new worst test case, the execution of the use case to all path nodes, the worst execution time and the worst test case are updated.

8. A WCET acquisition device based on dynamic measurement, characterized in that: The device includes: Program branch stub, which is used to obtain the branch point sequence set of the branch call tree from the root node to the leaf node based on the branch points and function call relationship of the source code. A path processor, used for removing invalid branch points from the branch point sequence set to obtain all valid paths, and checking and confirming the removed branch point sequence; A use case capturer, used to generate and determine valid use cases, and integrate the valid use cases with developed use cases to obtain a test case set; A first program execution time statistics device is used to add program execution time to the branch point sequence set and perform packaging processing, generate a first target code, and execute the test case set according to the first target code to obtain the execution of the test case to all path nodes, the worst execution time and the corresponding worst test case; A first branch traverser is used to determine whether all paths are covered according to the path nodes executed by the test case; if so, output the worst test case; if not, update the test case set; A second program execution time statistics device, used for executing the updated test case set according to the first target code, so as to update the execution of the test case to all path nodes, the worst execution time and the worst test case; A second branch traverser is used to continue to determine whether all paths are covered, until all paths are covered, so as to obtain the worst test case; The third program execution time statistics device is used to add program execution time to the source code and package it to generate a second target code, and execute the worst test case according to the second target code to obtain the real worst execution time.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the WCET acquisition method based on dynamic measurement described in any one of claims 1 to 7 are implemented.

10. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to execute the steps of the WCET acquisition method based on dynamic measurement according to any one of claims 1 to 7 by executing the executable instructions.