Observation method, device, electronic device and storage medium of method interface

By adding numbering and counting modules to function calls and definition modules in the Simulink model, analyzing the call instructions to generate structure types, solving the problem of obtaining information of the method class interface and improving software testing efficiency and accuracy.

CN115840705BActive Publication Date: 2025-08-22CHONGQING CHANGAN TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211604255.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-13
Publication Date
2025-08-22
Estimated Expiration
2042-12-13

AI Technical Summary

Technical Problem

In Simulink model development, it is impossible to obtain the calling information of the method-like interface by directly adding observed semaphores on the signal line, such as whether calls occur internally, objects that initiate calls, and parameters, etc., which leads to difficulties in software maintenance.

Method used

By adding a numbering and counting module to the function calling module and function definition module, parsing the call instructions and generating the target structure type, observing all information of the method class interface.

Benefits of technology

It improves the efficiency and accuracy of software testing, can clearly obtain key information during the call process, and reduces the difficulty of software maintenance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115840705B_ABST
    Figure CN115840705B_ABST
Patent Text Reader

Abstract

The present application relates to an observation method, device, electronic device and storage medium for a method interface, including: obtaining the call instruction when the current function definition module is called and parsing it, obtaining the number value corresponding to the call of the current function definition module, obtaining the number of times the current function definition module is called and the number of times multiple function call modules are called, and observing the target structure type generated according to the call instruction, the corresponding number value, the number of times the call is called and the number of times the call is initiated, and all information of the method interface. This solves the problem of not being able to obtain information required for later software maintenance such as whether a call occurs internally, the object that initiates the call, and the passed parameters by directly adding an observation semaphore on the signal line when the software is running, thereby improving testing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of vehicle software development, and in particular to an observation method, device, electronic device and storage medium for a method interface. Background Art

[0002] When using Simulink for model development, it is common to add observed semaphores to signal lines within the model, define the semaphores, generate corresponding global observed signal quantities, and combine them with the commonly used XCP / CCP protocol to achieve real-time reading of the observed quantities for status observation, problem troubleshooting, etc.

[0003] In related technologies, the software interface types based on the SOA (Service-Oriented Architecture) architecture mainly include notification classes and method classes. The interfaces of the method class are implemented in the form of functions during the software implementation process, and the transfer of data between interfaces is also achieved through function calls.

[0004] However, when the software is running, the information necessary for subsequent software maintenance, such as whether an internal call occurred, who initiated the call, what parameters were passed, etc., cannot be obtained by directly adding observation semaphores to the signal line, and this needs to be solved urgently. Summary of the Invention

[0005] The present application provides an observation method, device, electronic device and storage medium for a method interface to solve the problem that when the software is running, it is impossible to obtain information required for later software maintenance such as whether an internal call occurs, the object that initiates the call, and the passed parameters by directly adding an observation semaphore on the signal line, thereby improving testing efficiency.

[0006] The first embodiment of the present application provides a method for observing a method interface, comprising the following steps:

[0007] Obtaining a call instruction when the current function definition module is called, and parsing the call instruction to obtain a number value corresponding to calling the current function definition module;

[0008] Obtaining the number of times the current function definition module is called and the number of times multiple function call modules are called; and

[0009] A target structure type is generated according to the calling instruction, the number value corresponding to the current function definition module, the number of times the function is called, and the number of times the function is called, so as to observe all information of the method class interface according to the target structure type.

[0010] The above technical means solve the problem that when the software is running, it is impossible to obtain information required for later software maintenance such as whether an internal call occurs, the object that initiates the call, and the passed parameters by directly adding an observation semaphore on the signal line, thereby improving test efficiency.

[0011] Furthermore, before obtaining the calling instruction when the current function definition module is called, the method further includes:

[0012] The multiple function call modules are numbered based on a preset numbering strategy.

[0013] According to the above technical means, it is easy to clearly know which function call initiates the call when the function definition module is called.

[0014] Furthermore, after obtaining the number of times the current function definition module is called and the number of times the multiple function call modules are called, the method further includes:

[0015] Determine whether the number of times the calls are made is consistent with the number of times the calls are initiated;

[0016] If the number of times the call is made is consistent with the number of times the call is initiated, it is determined that there is no call missing in the current call process; otherwise, it is determined that there is a call missing in the current call process.

[0017] According to the above technical means, by reading the numerical values ​​of the counting modules of both parties, it is determined whether the missing call is due to the function call not being initiated or the function definition not receiving the called information, thereby improving the test accuracy.

[0018] Furthermore, after obtaining the number value corresponding to calling the current function definition module, the method further includes:

[0019] The identity information of the calling end is determined according to the number value, wherein the calling end includes the multiple function calling modules.

[0020] According to the above technical means, it is easy to know which function call initiated the call when the function definition module is called, and obtain the identity information of the calling end.

[0021] A second embodiment of the present application provides an observation device for a method interface, including:

[0022] A parsing module is used to obtain a calling instruction when the current function definition module is called, and parse the calling instruction to obtain a number value corresponding to calling the current function definition module;

[0023] An acquisition module, configured to acquire the number of times the current function definition module is called and the number of times multiple function call modules are called; and

[0024] The observation module is used to generate a target structure type according to the calling instruction, the number value corresponding to the current function definition module, the number of times it is called and the number of times it is called, so as to observe all information of the method class interface according to the target structure type.

[0025] Furthermore, before obtaining the calling instruction when the current function definition module is called, the parsing module is further configured to:

[0026] The multiple function call modules are numbered based on a preset numbering strategy.

[0027] Furthermore, before obtaining the calling instruction when the current function definition module is called, the parsing module is further configured to:

[0028] The multiple function call modules are numbered based on a preset numbering strategy.

[0029] Furthermore, after obtaining the number value corresponding to calling the current function definition module, the parsing module is further configured to:

[0030] The identity information of the calling end is determined according to the number value, wherein the calling end includes the multiple function calling modules.

[0031] The third aspect of the present application provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement an observation method of a method interface as described in the above embodiment.

[0032] A fourth aspect of the present application provides a computer-readable storage medium having a computer program stored thereon, which is executed by a processor to implement an observation method for a method interface as described in the above embodiments.

[0033] Therefore, this application adds numbers and counts to method class interfaces and integrates parameters to achieve observation of method class interfaces, solving the problem that when the software is running, it is impossible to obtain information required for later software maintenance such as whether an internal call occurs, the object that initiates the call, and the passed parameters by directly adding observation semaphores on the signal line, thereby improving testing efficiency.

[0034] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:

[0036] Figure 1 A schematic diagram of a flow chart of an observation method for a method interface provided according to an embodiment of the present application;

[0037] Figure 2 A schematic diagram of method class interface calls between SWC modules according to an embodiment of the present application;

[0038] Figure 3 Schematic diagram of a method class interface observation implementation scheme according to an embodiment of the present application;

[0039] Figure 4 Schematic diagram of a block diagram of an observation device of a method-type interface according to an embodiment of the present application;

[0040] Figure 5 Schematic diagram of the structure of an electronic device according to an embodiment of the present application.

[0041] Explanation of the reference numerals: 10 - observation device of method-type interface, 100 - parsing module, 200 - acquisition module, 300 - observation module, 501 - memory, 502 - processor, 503 - communication interface. DETAILED DESCRIPTION

[0042] The following describes in detail embodiments of the present application. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.

[0043] The following describes the observation method, device, electronic device and storage medium of the method class interface of the embodiment of the present application with reference to the accompanying drawings. In response to the problem mentioned in the above background technology that when the software is running, it is impossible to obtain information required for later software maintenance such as whether an internal call occurs, the object initiating the call, and the parameters passed by directly adding an observation semaphore on the signal line, the present application provides an observation method for a method class interface. In this method, the call instruction when the current function definition module is called is obtained and parsed to obtain the number value corresponding to the call of the current function definition module, the number of times the current function definition module is called and the number of times multiple function call modules are called, and then all information of the target structure type generated according to the call instruction, the corresponding number value, the number of times the call is made and the number of times the call is initiated is observed. In this way, the problem that when the software is running, it is impossible to obtain information required for later software maintenance such as whether an internal call occurs, the object initiating the call, and the parameters passed by directly adding an observation semaphore on the signal line is solved, thereby improving the testing efficiency.

[0044] Specifically, Figure 1A flow chart of an observation method for a method interface provided in an embodiment of the present application.

[0045] Before introducing the observation method of the method class interface of the embodiment of the present application, the principle of the solution is briefly introduced:

[0046] (1) If Figure 2 As shown, in the Simulink model, method class interface calls occur between various software components SWC (such as SWC1, SWC2 and SWC3). In the embodiment of the present application, multiple function call (Function Caller) modules are used to initiate function calls, and function definition (Simulink Function) modules are used to implement functions.

[0047] (2) For the function call module side, add a unique number to each function call module (such as function call module 1 and function call module 2), calculate the cumulative number of calls, and then integrate the number, number of calls, and parameters into a structure type. Add an additional connecting line and add the observation signal of the corresponding structure type;

[0048] (3) For the function definition module end, record the number of the calling end being executed and the number of times it is called, and then integrate the number, number of calls, and parameters being executed into a structure type. Add an additional connecting line and add the observation semaphore of the corresponding structure type.

[0049] like Figure 1 As shown, the observation method of the method class interface includes the following steps:

[0050] In step S101, a calling instruction when the current function definition module is called is obtained, and the calling instruction is parsed to obtain a number value corresponding to calling the current function definition module.

[0051] Among them, the calling instruction when the current function definition module is called is initiated by the function calling module, and the function definition module is used to implement the function.

[0052] Furthermore, in some embodiments, before obtaining the calling instruction when the current function definition module is called, the method further includes: numbering multiple function calling modules based on a preset numbering strategy.

[0053] Among them, the preset numbering strategy is pre-set by those skilled in the art to facilitate subsequent numbering operations on multiple function call modules.

[0054] It can be understood that since a function definition module can be called by multiple function calling modules, when the function definition module is called, in order to make it clear which function calling module initiated the call, the embodiment of the present application will number each function calling module based on a preset numbering strategy.

[0055] Furthermore, in some embodiments, after obtaining the number value corresponding to calling the current function definition module, it also includes: determining the identity information of the calling end according to the number value, wherein the calling end includes multiple function calling modules.

[0056] Specifically, the embodiment of the present application passes the number of each function call module to the function definition module through a parameter, so that the identity information of the calling end can be obtained by simply reading the number value received by the function definition module.

[0057] In step S102, the number of times the current function definition module is called and the number of times multiple function call modules are called are obtained.

[0058] Specifically, in the embodiment of the present application, modules for counting are added to the function call module and the function definition module. For the function call module, the count value is automatically increased by 1 each time the function is called. For the function definition module, the count value is automatically increased by 1 each time the function is called.

[0059] Furthermore, in some embodiments, after obtaining the number of times the current function definition module is called and the number of times calls are initiated by multiple function call modules, it also includes: determining whether the number of times called and the number of times calls are initiated are consistent; if the number of times called and the number of times calls are initiated are consistent, it is determined that there is no call missing in the current call process; otherwise, it is determined that there is a call missing in the current call process.

[0060] It's understandable that the counting module was designed to confirm whether there's a communication loss during the call process. In an SOA-based architecture, the interfaces that generate the call relationship are likely located within different ECUs (Electronic Control Units), with the calls transmitted via Ethernet. In this case, if the values ​​read from both counting modules match, it indicates no missing calls during the current call process. If they don't match, it indicates a missing call during the current call process, and it's possible to determine whether the missing call occurred because the function calling module didn't initiate the call or because the function definition module didn't receive the call information.

[0061] In step S103, a target structure type is generated according to the calling instruction, the number value corresponding to the current function definition module, the number of calls and the number of calls initiated, so as to observe all the information of the method class interface according to the target structure type.

[0062] Specifically, the call instruction, number value and call count value in the function call module and the function definition module are combined into a structure type, so that when it is used later, only one signal needs to be filtered to observe all the information of the method class interface, which is convenient for viewing the data of the observation quantity later. Figure 3 Add signal connection lines and define observations as shown.

[0063] According to the observation method of the method class interface proposed in the embodiment of the present application, the call instruction when the current function definition module is called is obtained and parsed to obtain the number value corresponding to the call of the current function definition module, the number of times the current function definition module is called and the number of times multiple function call modules are called are obtained, and then all the information of the target structure type observation method class interface is generated based on the call instruction, the corresponding number value, the number of times the call is made and the number of times the call is initiated. This solves the problem of not being able to obtain information required for later software maintenance such as whether a call occurs internally, the object that initiates the call, and the passed parameters by directly adding an observation semaphore on the signal line during software operation, thereby improving testing efficiency.

[0064] Next, an observation device for a method-type interface proposed in an embodiment of the present application will be described with reference to the accompanying drawings.

[0065] Figure 4 It is a block diagram of an observation device of a method-type interface according to an embodiment of the present application.

[0066] like Figure 4 As shown, the observation device 10 of the method interface includes: a parsing module 100 , an acquisition module 200 and an observation module 300 .

[0067] The parsing module 100 is used to obtain the calling instruction when the current function definition module is called, and parse the calling instruction to obtain the number value corresponding to the calling of the current function definition module;

[0068] An acquisition module 200 is used to acquire the number of times the current function definition module is called and the number of times multiple function call modules are called; and

[0069] The observation module 300 is used to generate a target structure type according to the calling instruction, the number value corresponding to the current function definition module, the number of calls and the number of calls initiated, so as to observe all the information of the method class interface according to the target structure type.

[0070] Furthermore, in some embodiments, before obtaining the calling instruction when the current function definition module is called, the parsing module 200 is further configured to:

[0071] Based on a preset numbering strategy, multiple function call modules are numbered.

[0072] Furthermore, in some embodiments, after obtaining the number of times the current function definition module is called and the number of times multiple function call modules are called, the obtaining module 200 is further configured to:

[0073] Determine whether the number of calls received is consistent with the number of calls initiated;

[0074] If the number of calls is consistent with the number of calls initiated, it is determined that there is no call missing in the current call process; otherwise, it is determined that there is a call missing in the current call process.

[0075] Furthermore, in some embodiments, after obtaining the number value corresponding to calling the current function definition module, the parsing module 200 is further configured to:

[0076] The identity information of the calling end is determined according to the number value, wherein the calling end includes multiple function calling modules.

[0077] It should be noted that the above explanation of the embodiment of the observation method of the method-type interface is also applicable to the observation device of the method-type interface of this embodiment, and will not be repeated here.

[0078] According to the observation device of the method class interface proposed in the embodiment of the present application, the call instruction when the current function definition module is called is obtained and parsed, and the number value corresponding to the call of the current function definition module is obtained. The number of times the current function definition module has been called and the number of times multiple function call modules have initiated calls are obtained. Then, all the information of the target structure type generated based on the call instruction, the corresponding number value, the number of times the call has been made, and the number of times the call has been initiated is observed. This solves the problem of not being able to obtain information required for later software maintenance such as whether a call has occurred internally, the object initiating the call, and the passed parameters by directly adding an observation semaphore on the signal line during software operation, thereby improving testing efficiency.

[0079] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device may include:

[0080] Memory 501 , processor 502 , and computer programs stored in the memory 501 and executable on the processor 502 .

[0081] When the processor 502 executes the program, the observation method of the method class interface provided in the above embodiment is implemented.

[0082] Furthermore, the electronic device further includes:

[0083] The communication interface 503 is used for communication between the memory 501 and the processor 502 .

[0084] The memory 501 is used to store computer programs that can be run on the processor 502 .

[0085] The memory 501 may include a high-speed RAM (Random Access Memory) memory, and may also include a non-volatile memory, such as at least one disk memory.

[0086] If the memory 501, processor 502, and communication interface 503 are implemented independently, the communication interface 503, memory 501, and processor 502 can be connected to each other via a bus and communicate with each other. The bus can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus. Buses can be divided into address buses, data buses, control buses, etc. For ease of representation, Figure 5 Only one thick line is used in the diagram, but this does not mean that there is only one bus or one type of bus.

[0087] Optionally, in a specific implementation, if the memory 501, the processor 502 and the communication interface 503 are integrated on a chip, the memory 501, the processor 502 and the communication interface 503 can communicate with each other through an internal interface.

[0088] The processor 502 may be a CPU (Central Processing Unit), or an ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present application.

[0089] An embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, it implements the observation method of the method class interface as described above.

[0090] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or N embodiments or examples in a suitable manner. In addition, those skilled in the art can combine and combine different embodiments or examples described in this specification and features of different embodiments or examples without contradiction.

[0091] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be understood to indicate or imply relative importance or implicitly specify the number of technical features indicated. Thus, a feature specified as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of this application, "N" means at least two, for example, two, three, etc., unless otherwise specifically defined.

[0092] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, fragment or portion of code comprising one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may be performed out of the order shown or discussed, including performing functions in a substantially simultaneous manner or in reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present application belong.

[0093] It should be understood that various parts of the present application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiment, the N steps or methods can be implemented using software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented using hardware, as in another embodiment, any one of the following technologies known in the art or a combination thereof can be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application-specific integrated circuit having a suitable combination of logic gate circuits, a programmable gate array, a field programmable gate array, etc.

[0094] Those skilled in the art will appreciate that all or part of the steps in the method for implementing the above-mentioned embodiment can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium. When the program is executed, it includes one or a combination of the steps of the method embodiment.

[0095] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations on the present application. Ordinary technicians in this field can change, modify, replace and modify the above embodiments within the scope of the present application.

Claims

1. An observation method of a method interface, characterized in that, The following steps are involved: Obtaining a call instruction when the current function definition module is called, and parsing the call instruction to obtain a number value corresponding to calling the current function definition module; Obtaining the number of times the current function definition module has been called and the number of times multiple function calling modules have been called, wherein the call instruction when the current function definition module is called is initiated by the function calling module, the current function definition module is used to implement a function, and the number value corresponding to the current function definition module is the number value of the function calling module; as well as Generate a target structure type according to the calling instruction, the number value corresponding to the current function definition module, the number of times the function is called, and the number of times the function is called, so as to observe all information of the method class interface according to the target structure type; When the target structure type is a structure type corresponding to the function call module, a unique number value is added to each function call module, the cumulative number of calls is calculated, and then the number value, the number of calls, and the parameters are integrated into a structure type. An additional connecting line is added to add an observation signal of the corresponding structure type; When the target structure type is a structure type corresponding to the function definition module, the number value and the number of calls of the function call module being executed are recorded, and then the number value, the number of calls, and the parameters being executed are integrated into a structure type, and an additional connecting line is added to add the observation signal of the corresponding structure type.

2. The method according to claim 1, characterized in that Before obtaining the calling instruction when the current function definition module is called, the method further includes: The multiple function call modules are numbered based on a preset numbering strategy.

3. The method according to claim 1, characterized in that After obtaining the number of times the current function definition module is called and the number of times the multiple function call modules are called, the method further includes: Determine whether the number of times the calls are made is consistent with the number of times the calls are initiated; If the number of times the call is made is consistent with the number of times the call is initiated, it is determined that there is no call missing in the current call process; otherwise, it is determined that there is a call missing in the current call process.

4. The method according to claim 1, wherein After obtaining the number value corresponding to calling the current function definition module, the method further includes: The identity information of the calling end is determined according to the number value, wherein the calling end includes the multiple function calling modules.

5. An observation device for a method interface, characterized in that include: A parsing module is used to obtain a calling instruction when the current function definition module is called, and parse the calling instruction to obtain a number value corresponding to calling the current function definition module; an acquisition module, configured to acquire the number of times the current function definition module has been called and the number of times multiple function call modules have been called, wherein the call instruction when the current function definition module is called is initiated by the function call module, the current function definition module is configured to implement a function, and the number value corresponding to the current function definition module is the number value of the function call module; as well as An observation module is used to generate a target structure type according to the calling instruction, the number value corresponding to the current function definition module, the number of calls and the number of calls initiated, so as to observe all information of the method class interface according to the target structure type; When the target structure type is a structure type corresponding to the function call module, it is used to add a unique number value to each function call module, calculate the cumulative number of calls, and then integrate the number value, number of calls, and parameters into a structure type, add an additional connecting line, and add an observation signal of the corresponding structure type; When the target structure type is a structure type corresponding to the function definition module, it is used to record the number value and the number of calls of the function call module being executed, and then integrate the number value, the number of calls, and the parameters being executed into a structure type, add an additional connecting line, and add the observation semaphore of the corresponding structure type.

6. The device according to claim 5, characterized in that Before obtaining the calling instruction when the current function definition module is called, the parsing module is further used to: The multiple function call modules are numbered based on a preset numbering strategy.

7. The device according to claim 5, characterized in that After obtaining the number of times the current function definition module is called and the number of times the multiple function call modules are called, the obtaining module is further configured to: Determine whether the number of times the calls are made is consistent with the number of times the calls are initiated; If the number of times the calls are made is consistent with the number of times the calls are initiated, it is determined that there is no call missing in the current call process; Otherwise, it is determined that there is a call missing in the current calling process.

8. The device according to claim 5, characterized in that After obtaining the number value corresponding to calling the current function definition module, the parsing module is further used to: The identity information of the calling end is determined according to the number value, wherein the calling end includes the multiple function calling modules.

9. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method for observing the method interface according to any one of claims 1 to 4.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: The program is executed by a processor to implement the observation method of the method interface according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Call function analysis method and device

    CN107102944A

  • Vehicle control system test method and device and electronic equipment

    CN114691511A