CN113268436A - Multi-granularity computer simulation operation information acquisition method based on hook points - Google Patents

Multi-granularity computer simulation operation information acquisition method based on hook points Download PDF

Info

Publication number
CN113268436A
CN113268436A CN202110822060.1A CN202110822060A CN113268436A CN 113268436 A CN113268436 A CN 113268436A CN 202110822060 A CN202110822060 A CN 202110822060A CN 113268436 A CN113268436 A CN 113268436A
Authority
CN
China
Prior art keywords
information
information acquisition
simulation model
acquisition
simulation
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110822060.1A
Other languages
Chinese (zh)
Other versions
CN113268436B (en
Inventor
赵国亮
周启平
伍泳燕
齐悦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Space Cqc Associate Software Testing And Evaluating Technology Beijing Co ltd
Original Assignee
Space Cqc Associate Software Testing And Evaluating Technology Beijing Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Space Cqc Associate Software Testing And Evaluating Technology Beijing Co ltd filed Critical Space Cqc Associate Software Testing And Evaluating Technology Beijing Co ltd
Priority to CN202110822060.1A priority Critical patent/CN113268436B/en
Publication of CN113268436A publication Critical patent/CN113268436A/en
Application granted granted Critical
Publication of CN113268436B publication Critical patent/CN113268436B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3604Software analysis for verifying properties of programs
    • G06F11/3608Software analysis for verifying properties of programs using formal methods, e.g. model checking, abstract interpretation

Abstract

The invention relates to a hook point-based multi-granularity computer simulation operation information acquisition method, relating to the technical field of data acquisition, wherein the method comprises the following steps: acquiring an information acquisition request; under the condition that the type identifier corresponding to the information acquisition request is a first identifier, generating an information acquisition strategy according to the information acquisition request; sending the information acquisition strategy to a simulation model so as to acquire event information of the simulation model according to the information acquisition strategy through an information acquisition hook function built in the simulation model; and storing the event information into an information warehouse through an information acquisition working thread corresponding to the simulation model. By adopting the technical scheme, the simulation operation information data is acquired by operating the lightweight information acquisition hook points in the simulation model, so that the relevant information data can be accurately and quickly acquired to support problem analysis and fault positioning of software running on the simulation system, and the influence of information acquisition on the simulation process is reduced.

Description

Multi-granularity computer simulation operation information acquisition method based on hook points
Technical Field
The disclosure relates to the technical field of data acquisition, in particular to a hook point-based multi-granularity computer simulation operation information acquisition method.
Background
Design and development of an embedded system based on a simulation virtual environment are taken as a brand-new agile development mode, and can effectively support system designers to perform dynamic behavior analysis on a virtual platform separated from physical hardware, but the dynamic behavior analysis needs a series of information data, including processor state information, memory information, interrupt information, bus information, excitation information, function execution time, function running tracks, dynamic code execution information, execution unit time sequence information and the like.
Currently, a common dynamic behavior analysis mode is program instrumentation, which is to implement inspection of program code execution, variable change and other conditions by inserting instrumentation codes into source codes, and obtain control flow and data flow information of a program. However, the program instrumentation technique may damage the time characteristics of the program, which is a serious problem for embedded software in the highly reliable field, and may easily cause the software execution error and seriously affect the simulation process.
Disclosure of Invention
In order to solve the above technical problem or at least partially solve the above technical problem, the present disclosure provides a hook-point-based multi-granularity computer simulation operation information acquisition method, which acquires simulation operation information data by operating lightweight information acquisition hook points in a simulation model, can accurately and quickly acquire related information data to support problem analysis and fault location of software running on a simulation system, has a very low influence on a simulation flow in an information acquisition process, and solves a problem that a simulation flow is seriously influenced by a method of inserting stub codes into source codes in the prior art.
The embodiment of the first aspect of the disclosure provides a hook point-based multi-granularity computer simulation operation information acquisition method, which includes:
acquiring an information acquisition request;
under the condition that the type identifier corresponding to the information acquisition request is a first identifier, generating an information acquisition strategy according to the information acquisition request;
sending the information acquisition strategy to a simulation model so as to acquire event information of the simulation model according to the information acquisition strategy through an information acquisition hook function built in the simulation model;
and storing the event information into an information warehouse through an information acquisition working thread corresponding to the simulation model.
In an optional embodiment of the present disclosure, the storing the event information into an information warehouse by the information collection working thread corresponding to the simulation model includes:
storing the event information into an information buffer area corresponding to the simulation model;
and acquiring the event information from the information buffer area through an information acquisition working thread corresponding to the simulation model and storing the event information into the information warehouse.
In an optional embodiment of the disclosure, the method further comprises:
generating acquisition management information according to the information acquisition request under the condition that the type identifier corresponding to the information acquisition request is a second identifier;
acquiring a target identifier of a simulation model from the acquisition management information;
and acquiring information data from an information acquisition address in the acquisition management information through an information acquisition working thread corresponding to the simulation model of the target identifier, and storing the information data in the information warehouse.
In an optional embodiment of the present disclosure, the acquiring information address is an information acquiring hook function built in a simulation model, and acquiring information data from the information acquiring address in the acquisition management information by an information acquiring work thread corresponding to the simulation model of the target identifier includes:
and calling an information acquisition hook function built in the simulation model of the target identifier through an information acquisition working thread corresponding to the simulation model of the target identifier so as to acquire the information data.
In an optional embodiment of the present disclosure, the acquiring the information data from the information acquisition address in the acquisition management information by the information acquisition working thread corresponding to the simulation model of the target identifier includes:
and reading information data from an information buffer area corresponding to the simulation model of the target identifier through an information acquisition working thread corresponding to the simulation model of the target identifier, wherein the information data is event information.
In an optional embodiment of the present disclosure, the information collection request is a plurality of requests; the acquiring of the information acquisition request includes:
sequentially acquiring a target information acquisition request from a request queue in which a plurality of information acquisition requests are stored so as to acquire information;
after the event information is stored in an information warehouse through the information acquisition working thread corresponding to the simulation model, the method further comprises the following steps:
and writing the target information acquisition request into the tail part of the request queue.
In an optional embodiment of the present disclosure, the simulation model includes a processor model, a memory model, a peripheral model, and an excitation model, and the information collection working thread includes a processor information collection working thread, a memory information collection working thread, a peripheral information collection working thread, and an excitation information collection working thread.
The embodiment of the second aspect of the present disclosure provides a hook point-based multi-granularity computer simulation operation information acquisition apparatus, including:
the request acquisition module is used for acquiring an information acquisition request;
the acquisition strategy generation module is used for generating an information acquisition strategy according to the information acquisition request under the condition that the type identifier corresponding to the information acquisition request is a first identifier;
the acquisition module is used for sending the information acquisition strategy to a simulation model so as to acquire event information of the simulation model according to the information acquisition strategy through an information acquisition hook function built in the simulation model;
and the storage module is used for storing the event information into an information warehouse through an information acquisition working thread corresponding to the simulation model.
In an optional embodiment of the present disclosure, the storage module is specifically configured to:
storing the event information into an information buffer area corresponding to the simulation model;
and acquiring the event information from the information buffer area through an information acquisition working thread corresponding to the simulation model and storing the event information into the information warehouse.
In an optional embodiment of the present disclosure, the apparatus further comprises:
the management information generation module is used for generating acquisition management information according to the information acquisition request under the condition that the type identifier corresponding to the information acquisition request is a second identifier;
the information acquisition module is used for acquiring an information acquisition address and a target identifier of the simulation model from the acquisition management information;
and the processing module is used for acquiring information data from the information acquisition address through an information acquisition working thread corresponding to the simulation model of the target identifier and storing the information data into the information warehouse.
In an optional embodiment of the present disclosure, the information acquisition address is an information acquisition hook function built in the simulation model, and the processing module is specifically configured to:
and calling an information acquisition hook function built in the simulation model of the target identifier through an information acquisition working thread corresponding to the simulation model of the target identifier so as to acquire the information data.
In an optional embodiment of the disclosure, the information acquisition address is an information buffer corresponding to the simulation model, and the processing module is specifically configured to:
and reading information data from an information buffer area corresponding to the simulation model of the target identifier through an information acquisition working thread corresponding to the simulation model of the target identifier, wherein the information data is event information.
In an optional embodiment of the present disclosure, the information collection request is a plurality of requests; the request acquisition module is specifically configured to:
sequentially acquiring a target information acquisition request from a request queue in which a plurality of information acquisition requests are stored so as to acquire information;
the device, still include:
and the writing module is used for writing the target information acquisition request into the tail part of the request queue.
In an optional embodiment of the present disclosure, the simulation model includes a processor model, a memory model, a peripheral model, and an excitation model, and the information collection working thread includes a processor information collection working thread, a memory information collection working thread, a peripheral information collection working thread, and an excitation information collection working thread.
An embodiment of a third aspect of the present disclosure provides an electronic device, including: a processor and a memory;
the processor is used for executing the steps of the hook point-based multi-granularity computer simulation operation information acquisition method according to the embodiment of the first aspect by calling the program or the instruction stored in the memory.
A fourth aspect of the present disclosure provides a computer-readable storage medium, which stores a program or instructions for causing a computer to execute the steps of the hook point-based multi-granularity computer simulation operation information collection method according to the first aspect.
Compared with the prior art, the technical scheme provided by the embodiment of the disclosure has the following advantages:
the method comprises the steps of acquiring an information acquisition request, generating an information acquisition strategy according to the information acquisition request under the condition that a type identifier corresponding to the information acquisition request is a first identifier, calling an information acquisition hook function built in a simulation model according to the information acquisition strategy to acquire event information of the simulation model, and storing the event information into an information warehouse through an information acquisition working thread corresponding to the simulation model. By adopting the technical scheme, the simulation operation information data is acquired by operating the lightweight information acquisition hook points in the simulation model, the relevant information data can be accurately and quickly acquired to support problem analysis and fault location of software operated on the simulation system, and the influence of the information acquisition process on the simulation process is very low.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure.
In order to more clearly illustrate the embodiments or technical solutions in the prior art of the present disclosure, the drawings used in the description of the embodiments or prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
Fig. 1 is a schematic flowchart of a hook-point-based multi-granularity computer simulation operation information collection method according to an embodiment of the present disclosure;
fig. 2 is a schematic flow chart of a method for collecting information of hook-point-based multi-granularity computer simulation operation according to another embodiment of the present disclosure;
fig. 3 is a schematic diagram of a multi-thread information collection framework based on hook points according to an embodiment of the present disclosure;
fig. 4 is a schematic view of an information acquisition processing flow proposed by the embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of a hook-point-based multi-granularity computer simulation operation information acquisition device according to an embodiment of the present disclosure.
Detailed Description
In order that the above objects, features and advantages of the present disclosure may be more clearly understood, aspects of the present disclosure will be further described below. It should be noted that the embodiments and features of the embodiments of the present disclosure may be combined with each other without conflict.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present disclosure, but the present disclosure may be practiced in other ways than those described herein; it is to be understood that the embodiments disclosed in the specification are only a few embodiments of the present disclosure, and not all embodiments.
The method for collecting information of hook-point-based multi-granularity computer simulation operation according to the embodiment of the application is described below with reference to the accompanying drawings.
The embedded system occupies a crucial position in each model of aerospace, and if a traditional hardware-software-first research and development mode is adopted, the research and development of the aerospace model embedded system face a plurality of problems. Firstly, due to the complexity of hardware development, the development period is often prolonged, so that the development time of final software is very short, and the development progress of a product is influenced; secondly, because the embedded system is a system with cooperative software and hardware, the software behavior is closely coupled with the hardware, and strict requirements are provided in the aspects of time sequence, resource consumption and the like, and the design scheme of the system cannot be pre-evaluated and verified; in addition, in the fields with high safety and reliability requirements, such as aerospace and other fields, the software safety and reliability requirements are high, and complex fault mode tests and comprehensive dynamic behavior analysis are difficult to realize based on a real hardware platform.
The digital simulation virtual environment provides a solution for the problems, the design and development of the embedded system based on the simulation virtual environment is a brand-new agile development mode, and system designers can be effectively supported to carry out system definition, design evaluation, software development, test verification, integration and deployment on a virtual platform separated from physical hardware. The core of the digitalized simulation virtual environment is operated by a software simulation Central Processing Unit (CPU). The pure software CPU simulation is an important technology for developing CPU design and embedded software debugging, and the main technical idea is to simulate the running logic and operation flow of the CPU and provide an instruction set and an interface which are completely the same as those of a processor. The software program may run unmodified. When the CPU simulates, each instruction of the software is explained and executed. From the reality degree of the CPU simulation, the CPU simulation can be divided into a plurality of layers, wherein the first layer is used for simulating the sequential logic of a chip; the second layer is to simulate the CPU instruction; the third level is to simulate the whole hardware development board.
The digitalized simulation virtual environment can effectively support system designers to perform dynamic behavior analysis on a virtual platform separated from physical hardware, but the dynamic behavior analysis needs a series of information data including processor state information, memory information, interrupt information, bus information, excitation information, function execution time, function running tracks, dynamic code execution information, execution unit time sequence information and the like.
The current common dynamic behavior analysis mode comprises program instrumentation and a bypass test chip. Program instrumentation realizes the inspection of the execution of program codes, the change of variables and other conditions by inserting instrumentation codes into source codes, and can obtain the control flow and data flow information of programs, but the program instrumentation is fatal to embedded software in a high-reliability field, because the time characteristic and the like of the programs can be damaged by the program instrumentation technology, the software execution error is caused, and the simulation flow is seriously influenced; the bypass Test chip is to add a Test module, such as a Joint Test Action Group (JTAG) chip, in a CPU having a JTAG Debug interface module, and access an internal register of the CPU and a device hung on a CPU bus through a JTAG interface as long as a clock is normal.
In order to solve the problems, the inventor of the present disclosure uses a digital simulation technology to construct a full-digital computer simulation system, and provides a high-performance multi-granularity computer simulation operation information acquisition scheme based on hook points on the basis of the simulation system, so as to realize flexible, on-demand and multi-granularity information acquisition capabilities, thereby accurately and quickly acquiring effective information, supporting problem analysis and fault location of software running on the simulation system by using acquired simulation operation information data, realizing flexible software test verification, and reducing the influence of information acquisition on a simulation flow.
Fig. 1 is a schematic flow chart of a hook-point-based multi-granular computer simulation operation information collection method according to an embodiment of the present disclosure, where the method may be executed by a hook-point-based multi-granular computer simulation operation information collection apparatus according to an embodiment of the present disclosure, and the apparatus may be implemented by software and/or hardware, and may be integrated on any electronic device with processing capability, such as a notebook computer, a server, and other terminal devices.
As shown in fig. 1, the method for collecting information of multi-granularity computer simulation operation based on hook points may include the following steps:
step 101, an information acquisition request is obtained.
The information acquisition request may be input by a tester according to an actual information acquisition requirement, and the information acquisition request may include, but is not limited to, one or a combination of at least two of information such as an acquisition type, an acquisition address, an acquired information quantity, and an acquisition condition, which is not limited in this disclosure. The acquisition type can be real-time acquisition, namely acquiring required event information data in real time in the running process of the simulation system, and the real-time acquisition is mainly used for acquiring asynchronous events in running, such as event information of execution instruction sequences, interrupt events, abnormal events, key data changes, memory access errors and the like; the collection type may also be on-demand collection, which is mainly used for collecting normal state information or statistical information of simulation, etc. The tester can set an information acquisition request according to actual requirements to acquire information according to requirements or acquire the information in real time, flexible information acquisition is realized, and the information acquisition range is widened.
And 102, generating an information acquisition strategy according to the information acquisition request under the condition that the type identifier corresponding to the information acquisition request is a first identifier.
The first identifier is used for marking the type of the information acquisition request as real-time acquisition, the type identifier corresponding to the information acquisition request may be marked as type, the first identifier may be 0, for example, if it is detected that the type identifier type =0 corresponding to the information acquisition request indicates that the information acquisition request is a real-time acquisition request, in this case, the information acquisition policy is generated according to the information acquisition request.
And 103, sending the information acquisition strategy to a simulation model, and acquiring event information of the simulation model according to the information acquisition strategy through an information acquisition hook function built in the simulation model.
In the embodiment of the disclosure, after the information acquisition policy is generated according to the information acquisition request, the information acquisition policy may be sent to the simulation model, and event information of the simulation model is acquired according to the information acquisition policy through an information acquisition hook function built in the simulation model.
The simulation model includes but is not limited to at least one of a processor model, a memory model, a peripheral model and an excitation model, and a data acquisition hook function is inserted into each simulation model to realize specific information acquisition operation. And the information acquisition hook function is arranged on a simulation framework of the processor model, the memory model, the peripheral model and the excitation model, and realizes the information acquisition capability according to the information acquisition strategy. The information acquisition hook function converts the received information acquisition strategy into an information acquisition switch by analyzing the information acquisition strategy, thereby realizing the controlled acquisition of various types of information in the model. Because the hook function is a section of program and the magnitude of order is very light, the simulation operation information is acquired by embedding the hook function in the simulation model, so that the information acquisition can be realized only by operating the light-weight information acquisition hook function in the simulation model, and the influence of the information acquisition process on the simulation flow is very low.
As a possible implementation manner, the information collection policy may include an information collection condition, for example, information data of which event is collected, and in the running process of the simulation model, when the information collection execution condition is met, a hook function in the simulation model executes an information collection operation to collect information data of an event that triggers the information collection condition.
As a possible implementation manner, when the information acquisition request includes information data acquisition requirements for a plurality of simulation models, a corresponding information acquisition policy may be generated for each simulation model, and the information acquisition policy is sent to the corresponding simulation model, so as to realize acquisition of relevant event information through a hook function built in the simulation model.
And 104, storing the event information into an information warehouse through an information acquisition working thread corresponding to the simulation model.
The information repository may be, for example, a specific database.
In the embodiment of the present disclosure, each simulation model is correspondingly provided with an information acquisition working thread, for example, the simulation model includes a processor model, a memory model, a peripheral model and an excitation model, and correspondingly, the information acquisition working thread includes a processor information acquisition working thread, a memory information acquisition working thread, a peripheral information acquisition working thread and an excitation information acquisition working thread. After the event information is collected through the information collection hook function built in the simulation model, the collected event information can be stored in the information warehouse through the information collection working thread corresponding to the simulation model. Furthermore, by using the related information stored in the information warehouse, dynamic behavior analysis can be performed, and problem analysis and fault location of software running on the simulation system can be realized.
According to the hook point-based multi-granularity computer simulation operation information acquisition method, an information acquisition request is obtained, an information acquisition strategy is generated according to the information acquisition request under the condition that a type identifier corresponding to the information acquisition request is a first identifier, an information acquisition hook function built in a simulation model is called according to the information acquisition strategy to acquire event information of the simulation model, and then the event information is stored in an information warehouse through an information acquisition working thread corresponding to the simulation model. By adopting the technical scheme, the simulation operation information data is acquired by operating the lightweight information acquisition hook points in the simulation model, the relevant information data can be accurately and quickly acquired to support problem analysis and fault location of software operated on the simulation system, and the influence of the information acquisition process on the simulation process is very low.
Since the exceptional information is asynchronous, the volume of data is typically very large. Therefore, in a possible implementation manner of the embodiment of the present disclosure, a larger information buffer may be set for each simulation model, and is used to receive event information acquired by an information acquisition hook function of the simulation model, and the acquired event information may be inserted into the information buffer according to an executed time scale. Therefore, storing the event information into an information warehouse through an information acquisition working thread corresponding to the simulation model may include:
storing the event information into an information buffer area corresponding to the simulation model;
and acquiring the event information from the information buffer area through an information acquisition working thread corresponding to the simulation model and storing the event information into the information warehouse.
For example, after the information acquisition hook function built in the processor model acquires the relevant event information in the processor model, the acquired event information is sent to the processor information buffer area in real time, and the processor information acquisition working thread corresponding to the processor model acquires the event information from the processor information buffer area and stores the acquired event information in the information warehouse.
According to the information acquisition method and device, the information buffer area is introduced, one-way data transmission is carried out between the information acquisition hook function and the information acquisition working thread through the large-capacity information buffer area, synchronous operation is not needed to be executed between the information acquisition hook function and the information acquisition working thread, lock-free synchronization is achieved, the information acquisition process is not interfered by a synchronization mechanism, and the fact that the simulation performance is not affected in the information acquisition process is guaranteed.
Fig. 2 is a schematic flow chart of a hook-point-based multi-granular computer simulation operation information collection method according to another embodiment of the present disclosure, and as shown in fig. 2, the hook-point-based multi-granular computer simulation operation information collection method may include the following steps:
step 201, an information acquisition request is obtained.
Step 202, under the condition that the type identifier corresponding to the information acquisition request is the first identifier, generating an information acquisition strategy according to the information acquisition request.
And 203, sending the information acquisition strategy to a simulation model, and acquiring event information of the simulation model according to the information acquisition strategy through an information acquisition hook function built in the simulation model.
And step 204, storing the event information into an information buffer area corresponding to the simulation model.
And step 205, acquiring the event information from the information buffer area through an information acquisition working thread corresponding to the simulation model, and storing the event information into the information warehouse.
It should be noted that, in the embodiment of the present disclosure, for the description of step 201 to step 205, reference may be made to the description of relevant contents in the foregoing embodiment, and details are not described here again.
And step 206, generating acquisition management information according to the information acquisition request under the condition that the type identifier corresponding to the information acquisition request is the second identifier.
The second identifier is used for marking the type of the information acquisition request as acquisition on demand, the type identifier corresponding to the information acquisition request may be marked as type, the second identifier may be 1, for example, if it is detected that the type identifier type =1 corresponding to the information acquisition request indicates that the information acquisition request is the acquisition on demand request, and in this case, the acquisition management information is generated according to the information acquisition request.
As an example, the collection management information may include a plurality of information fields, and the collection management information is generated by determining field values of the information fields according to the information collection request and filling the field values in the corresponding information fields.
And step 207, acquiring a target identifier of the simulation model from the acquisition management information.
In the embodiment of the disclosure, the acquisition management information may include a target identifier of a simulation model of information data to be acquired, the target identifier is used for uniquely identifying the simulation model, and the hook-point-based multi-granularity computer simulation operation information acquisition device may acquire the target identifier of the simulation model from the acquisition management information.
And 208, acquiring information data from an information acquisition address in the acquisition management information through an information acquisition working thread corresponding to the simulation model of the target identifier, and storing the information data into the information warehouse.
The simulation model of the target identifier refers to a simulation model with the target identifier, that is, a simulation model uniquely determined according to the target identifier.
In the embodiment of the present disclosure, the acquisition management information may further include an information acquisition address, and the information acquisition address may be a hook function of the simulation model or a buffer corresponding to the simulation model.
In the embodiment of the disclosure, after the target identifier of the simulation model of the data to be collected is obtained, the collection management information may be sent to the information collection working thread corresponding to the simulation model of the target identifier, and the information collection working thread obtains the information data from the information collection address according to the information collection address included in the collection management information, and stores the collected information data in the information warehouse through the information collection working thread.
As a possible implementation manner, when the information acquisition address is an information acquisition hook function built in the simulation model, the acquiring information data from the information acquisition address in the acquisition management information by the information acquisition working thread corresponding to the simulation model of the target identifier includes:
and calling an information acquisition hook function built in the simulation model of the target identifier through an information acquisition working thread corresponding to the simulation model of the target identifier so as to acquire the information data.
As another possible implementation manner, when the information acquisition address is an information buffer corresponding to the simulation model, the acquiring information data from the information acquisition address in the acquisition management information by the information acquisition working thread corresponding to the simulation model of the target identifier includes:
and reading information data from an information buffer area corresponding to the simulation model of the target identifier through an information acquisition working thread corresponding to the simulation model of the target identifier, wherein the information data is event information.
For example, if the target identifier of the simulation model included in the acquisition management information is a processor model and the acquisition address is a hook function built in the simulation model, the required information data is acquired by calling the information acquisition hook function built in the processor model through a processor information acquisition working thread corresponding to the processor model.
The information data is acquired by calling an information acquisition hook function built in the simulation model or acquiring the information data from an information buffer area corresponding to the simulation model, so that the flexible acquisition of the information data is realized, and the information acquisition range in the virtual simulation environment is enlarged.
Further, as a possible implementation manner, when the collected information data is stored in the information warehouse, the time reference information may be obtained from the simulation time and timing service module, the sequential relationship between the collected information data is processed according to the time reference information, and then the processed data is stored in the information warehouse.
The hook point-based multi-granularity computer simulation operation information acquisition method comprises the steps of acquiring an information acquisition request, generating an information acquisition strategy according to the information acquisition request under the condition that a type identifier corresponding to the information acquisition request is a first identifier, sending the information acquisition strategy to a simulation model, acquiring event information of the simulation model through an information acquisition hook function built in the simulation model, storing the event information into an information buffer area corresponding to the simulation model, and acquiring the event information from the information buffer area through an information acquisition working thread corresponding to the simulation model and storing the event information into an information warehouse; and under the condition that the type identifier corresponding to the information acquisition request is the second identifier, generating acquisition management information according to the information acquisition request, acquiring a target identifier of the simulation model from the acquisition management information, acquiring information data from an information acquisition address in the acquisition management information through an information acquisition working thread corresponding to the simulation model of the target identifier, and storing the information data in an information warehouse. Therefore, the flexible, on-demand and multi-granularity acquisition capacity is provided, the information acquisition range is improved, and the flexibility is strong.
In a possible implementation manner of the embodiment of the present disclosure, the number of the information acquisition requests may be multiple, and the acquiring of the information acquisition request may include: sequentially acquiring a target information acquisition request from a request queue in which a plurality of information acquisition requests are stored to acquire information, and further, after the information acquisition working thread corresponding to the simulation model stores the event information into an information warehouse, the method further comprises: and writing the target information acquisition request into the tail part of the request queue.
That is, when there are a plurality of information acquisition requests, the plurality of information acquisition requests may be recorded in the request queue, and according to the storage sequence of the information acquisition requests in the request queue, one information acquisition request (denoted as a target information acquisition request) is acquired from the request queue each time to perform information acquisition, and if the target information acquisition request is a real-time acquisition request, after the acquired event information is stored in the information warehouse, the target information acquisition request is hung at the tail of the request queue, and the next information acquisition request is continuously acquired to perform information acquisition. Further, if the target information collection request is an on-demand collection request, the target information collection request is deleted from the request queue after storing the collected information data into the information warehouse.
The operation information collection plays an important role in software security testing, but the operation information collection also has a great influence on the whole simulation performance. In order to reduce the influence of information acquisition on simulation performance, the present disclosure provides a multi-threaded information acquisition framework based on hook points, and fig. 3 is a schematic diagram of a multi-threaded information acquisition framework based on hook points, which is provided by an embodiment of the present disclosure.
As shown in fig. 3, the hook-point-based multi-thread information collection framework includes a processor model with an information collection hook point built therein, a memory model with an information collection hook point built therein, an external model with an information collection hook point built therein, an excitation model with an information collection hook point built therein, a processor information buffer and a processor information collection working thread corresponding to the processor model, a memory information buffer and a memory information collection working thread corresponding to the memory model, an external information buffer and an external information collection working thread corresponding to the external model, an excitation information buffer and an excitation information collection working thread corresponding to the excitation model, an information collection service thread, a simulation time and timing service module, and an information warehouse.
The information acquisition service thread is responsible for the overall management work of information acquisition of the whole simulation system, provides a user interface, receives an external acquisition request, provides information acquisition service outwards, manages the information acquisition work thread and the information acquisition hook point downwards, distributes an information acquisition strategy to each simulation model, sends acquisition management information to each information acquisition work thread and the like.
The information acquisition hook points built in each simulation model are execution components for information acquisition, are uniformly implanted through a simulation model development framework and are responsible for explaining an information acquisition strategy and acquiring data according to the information acquisition strategy, and particularly, the information acquisition hook points convert the information acquisition strategy into an information acquisition switch by analyzing the information acquisition strategy, so that various types of information in the simulation model can be acquired under control, and the acquired information is sent to an information acquisition working thread according to the policy regulation.
The information acquisition working thread corresponds to each simulation model, is in charge of information collection and storage capacity of the corresponding simulation model and execution of acquisition management information issued by the information acquisition service thread, acquires information by actively calling an information acquisition hook point interface or reading the information from an information buffer area, processes the sequence relation among the information, and then stores the acquired data in an acquired information warehouse.
The information acquisition in the embodiment of the present disclosure may be divided into two types, on-demand acquisition and real-time acquisition. The method comprises the steps of collecting collection management information given by each information collection working thread according to an information collection service thread according to needs, actively calling an interface provided by an information collection hook point, and collecting state information of each simulation model, such as the running state, the system time, the number of executed instructions, interrupt/abnormal constants and the like of a processor. Collecting normal state information or statistical information mainly used for collecting simulation according to needs. The real-time acquisition does not need an information acquisition working thread to send out a request, each simulation model information acquisition hook point acquires an event triggering an acquisition condition in a simulation running process according to an information acquisition strategy and sends the event to an acquisition buffer area in real time, and the information acquisition working thread reads data from the corresponding buffer area. The real-time acquisition is mainly used for acquiring asynchronous events during operation, such as execution instruction sequences, interrupt events, abnormal events, critical data changes, memory access errors and the like.
Fig. 4 is a schematic diagram of an information collection processing flow provided in the embodiment of the present disclosure, where the information collection processing flow is implemented based on the information collection framework shown in fig. 3. As shown in fig. 4, the information collection process flow may include the following steps: 1) initializing an acquisition request queue by an information acquisition service thread, receiving an external acquisition request, and marking an acquisition request type, wherein if the external acquisition request is a real-time acquisition request, marking type = 0; if the external acquisition request is an on-demand acquisition request, marking type = 1; 2) the information acquisition service thread judges the type of the acquisition request, if the type =0, the information acquisition request is stored in a real-time acquisition request queue, and under the condition that the real-time acquisition request queue is not empty, the acquisition request is acquired from the real-time acquisition request queue to generate an acquisition strategy, and the acquisition strategy is distributed to each simulation model; if the type =1, storing the information acquisition request into an on-demand acquisition request queue, and sending acquisition management information to the information acquisition working thread under the condition that the on-demand acquisition request queue is not empty; 3) receiving and analyzing an information acquisition strategy by an information acquisition hook point in the simulation model, executing information acquisition operation by the information acquisition hook point in the simulation model when an information acquisition execution condition is met, storing acquired data into a buffer area, hanging an acquisition request to the tail of a real-time acquisition request queue, and hanging the acquisition request to the tail of the real-time acquisition request queue when the information acquisition execution condition is not met; then, continuously judging whether the real-time acquisition request queue is empty, if not, continuously acquiring the acquisition request to acquire the information data, and if so, ending; 4) the information acquisition working thread acquires an information acquisition address from the acquisition management information as a hook point or a buffer area built in the simulation model according to the received acquisition management information, actively calls an information acquisition hook point interface built in the simulation model or reads information from the buffer area, can acquire time reference information from a simulation time and time sequence service module when reading the information so as to process the sequence relation between the acquired data according to the time reference information, then stores the acquired data into an information warehouse, deletes the acquisition request from an on-demand acquisition request queue, then continuously judges whether the on-demand acquisition request queue is empty or not, continuously acquires the acquisition request to acquire the information data if the on-demand acquisition request queue is not empty, and ends if the on-demand acquisition request queue is empty. Experiments show that the scheme provided by the disclosure can reduce the influence of information acquisition on the simulation performance, can fully utilize the computing power and memory resources in the multi-core computing environment through acquisition activity decomposition, and can reduce the influence of information acquisition on the simulation performance to within 10%.
In order to realize the embodiment, the disclosure further provides a hook point-based multi-granularity computer simulation operation information acquisition device.
Fig. 5 is a schematic structural diagram of a hook-point-based multi-granularity computer simulation operation information acquisition apparatus according to an embodiment of the present disclosure, where the apparatus may be implemented by software and/or hardware, and may be integrated on any electronic device with processing capability, such as a terminal device, such as a notebook computer, a server, and the like.
As shown in fig. 5, the hook-point-based multi-granularity computer simulation operation information acquisition apparatus 50 may include: the system comprises a request acquisition module 501, an acquisition strategy generation module 502, an acquisition module 503 and a storage module 504.
The request obtaining module 501 is configured to obtain an information acquisition request;
an acquisition policy generation module 502, configured to generate an information acquisition policy according to the information acquisition request when the type identifier corresponding to the information acquisition request is a first identifier;
the acquisition module 503 is configured to send the information acquisition policy to a simulation model, so as to acquire event information of the simulation model according to the information acquisition policy through an information acquisition hook function built in the simulation model;
and the storage module 504 is configured to store the event information in an information warehouse through an information acquisition working thread corresponding to the simulation model.
Optionally, the storage module is specifically configured to:
storing the event information into an information buffer area corresponding to the simulation model;
and acquiring the event information from the information buffer area through an information acquisition working thread corresponding to the simulation model and storing the event information into the information warehouse.
Optionally, the hook-point-based multi-granularity computer simulation operation information acquisition apparatus 50 further includes:
the management information generation module is used for generating acquisition management information according to the information acquisition request under the condition that the type identifier corresponding to the information acquisition request is a second identifier;
the information acquisition module is used for acquiring an information acquisition address and a target identifier of the simulation model from the acquisition management information;
and the processing module is used for acquiring information data from the information acquisition address through an information acquisition working thread corresponding to the simulation model of the target identifier and storing the information data into the information warehouse.
Optionally, the information acquisition address is an information acquisition hook function built in the simulation model, and the processing module is specifically configured to:
and calling an information acquisition hook function built in the simulation model of the target identifier through an information acquisition working thread corresponding to the simulation model of the target identifier so as to acquire the information data.
Optionally, the information acquisition address is an information buffer corresponding to the simulation model, and the processing module is specifically configured to:
and reading information data from an information buffer area corresponding to the simulation model of the target identifier through an information acquisition working thread corresponding to the simulation model of the target identifier, wherein the information data is event information.
Optionally, the number of the information acquisition requests is multiple; the request acquisition module is specifically configured to:
sequentially acquiring a target information acquisition request from a request queue in which a plurality of information acquisition requests are stored so as to acquire information;
the hook-point-based multi-granularity computer simulation operation information acquisition device 50 further includes:
and the writing module is used for writing the target information acquisition request into the tail part of the request queue.
Optionally, the simulation model includes a processor model, a memory model, a peripheral model, and an excitation model, and the information collection working thread includes a processor information collection working thread, a memory information collection working thread, a peripheral information collection working thread, and an excitation information collection working thread.
The hook point-based multi-granularity computer simulation operation information acquisition device provided by the embodiment of the disclosure can execute the hook point-based multi-granularity computer simulation operation information acquisition method provided by any embodiment of the disclosure, and has corresponding functional modules and beneficial effects of the execution method.
In order to implement the above embodiment, the present disclosure further provides an electronic device, including: a processor and a memory; the processor is used for executing the steps of the hook point-based multi-granularity computer simulation operation information acquisition method according to the previous embodiment by calling the program or the instruction stored in the memory.
In order to achieve the above embodiments, the present disclosure also proposes a computer-readable storage medium storing a program or instructions for causing a computer to execute the steps of the hook point-based multi-granular computer simulation operation information collection method according to the foregoing embodiments.
In order to implement the foregoing embodiments, the present disclosure also provides a computer program product, which includes a computer program/instruction, and when the computer program/instruction is executed by a processor, the hook point-based multi-granular computer simulation operation information collection method in the foregoing embodiments is implemented.
It is noted that, in this document, relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The foregoing are merely exemplary embodiments of the present disclosure, which enable those skilled in the art to understand or practice the present disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the disclosure. Thus, the present disclosure is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A multi-granularity computer simulation operation information acquisition method based on hook points is characterized by comprising the following steps:
acquiring an information acquisition request;
under the condition that the type identifier corresponding to the information acquisition request is a first identifier, generating an information acquisition strategy according to the information acquisition request;
sending the information acquisition strategy to a simulation model so as to acquire event information of the simulation model according to the information acquisition strategy through an information acquisition hook function built in the simulation model;
and storing the event information into an information warehouse through an information acquisition working thread corresponding to the simulation model.
2. The hook-point-based multi-granularity computer simulation operation information collection method according to claim 1, wherein the storing the event information into an information warehouse through an information collection working thread corresponding to the simulation model comprises:
storing the event information into an information buffer area corresponding to the simulation model;
and acquiring the event information from the information buffer area through an information acquisition working thread corresponding to the simulation model and storing the event information into the information warehouse.
3. The method for collecting information of multi-granularity computer simulation operation based on hook points according to claim 2, further comprising:
generating acquisition management information according to the information acquisition request under the condition that the type identifier corresponding to the information acquisition request is a second identifier;
acquiring a target identifier of a simulation model from the acquisition management information;
and acquiring information data from an information acquisition address in the acquisition management information through an information acquisition working thread corresponding to the simulation model of the target identifier, and storing the information data in the information warehouse.
4. The hook-point-based multi-granularity computer simulation operation information collection method according to claim 3, wherein the information collection address is an information collection hook function built in a simulation model, and the obtaining of information data from the information collection address in the collection management information by an information collection working thread corresponding to the simulation model of the target identifier comprises:
and calling an information acquisition hook function built in the simulation model of the target identifier through an information acquisition working thread corresponding to the simulation model of the target identifier so as to acquire the information data.
5. The hook-point-based multi-granularity computer simulation operation information collection method according to claim 3, wherein the information collection address is an information buffer corresponding to a simulation model, and the obtaining of information data from the information collection address in the collection management information by an information collection working thread corresponding to the simulation model of the target identifier comprises:
and reading information data from an information buffer area corresponding to the simulation model of the target identifier through an information acquisition working thread corresponding to the simulation model of the target identifier, wherein the information data is event information.
6. The hook-point-based multi-granularity computer simulation operation information collection method as claimed in claim 1, wherein the information collection request is a plurality of; the acquiring of the information acquisition request includes:
sequentially acquiring a target information acquisition request from a request queue in which a plurality of information acquisition requests are stored so as to acquire information;
after the event information is stored in an information warehouse through the information acquisition working thread corresponding to the simulation model, the method further comprises the following steps:
and writing the target information acquisition request into the tail part of the request queue.
7. The hook-point-based multi-granular computer simulation operation information collection method according to claim 1, wherein the simulation model includes a processor model, a memory model, a peripheral model, and an excitation model, and the information collection worker thread includes a processor information collection worker thread, a memory information collection worker thread, a peripheral information collection worker thread, and an excitation information collection worker thread.
8. A multi-granularity computer simulation operation information acquisition device based on hook points is characterized by comprising the following components:
the request acquisition module is used for acquiring an information acquisition request;
the acquisition strategy generation module is used for generating an information acquisition strategy according to the information acquisition request under the condition that the type identifier corresponding to the information acquisition request is a first identifier;
the acquisition module is used for sending the information acquisition strategy to a simulation model so as to acquire event information of the simulation model according to the information acquisition strategy through an information acquisition hook function built in the simulation model;
and the storage module is used for storing the event information into an information warehouse through an information acquisition working thread corresponding to the simulation model.
9. An electronic device, comprising: a processor and a memory;
the processor is used for executing the steps of the hook point-based multi-granularity computer simulation operation information acquisition method according to any one of claims 1 to 7 by calling the program or the instructions stored in the memory.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a program or instructions for causing a computer to execute the steps of the hook point-based multi-granularity computer simulation operation information collection method according to any one of claims 1 to 7.
CN202110822060.1A 2021-07-21 2021-07-21 Multi-granularity computer simulation operation information acquisition method based on hook points Active CN113268436B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110822060.1A CN113268436B (en) 2021-07-21 2021-07-21 Multi-granularity computer simulation operation information acquisition method based on hook points

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110822060.1A CN113268436B (en) 2021-07-21 2021-07-21 Multi-granularity computer simulation operation information acquisition method based on hook points

Publications (2)

Publication Number Publication Date
CN113268436A true CN113268436A (en) 2021-08-17
CN113268436B CN113268436B (en) 2021-10-08

Family

ID=77236945

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110822060.1A Active CN113268436B (en) 2021-07-21 2021-07-21 Multi-granularity computer simulation operation information acquisition method based on hook points

Country Status (1)

Country Link
CN (1) CN113268436B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101051874A (en) * 2007-05-18 2007-10-10 北京大学 Simulating moving self organization network method
US20100095281A1 (en) * 2008-10-14 2010-04-15 Riverside Research Institute Internal Function Debugger
CN108628291A (en) * 2018-06-26 2018-10-09 绿色动力环保集团股份有限公司 A kind of expert intelligence diagnostic system of the garbage burning factory based on emulation platform
CN109635311A (en) * 2018-10-24 2019-04-16 中国电子科技集团公司第二十八研究所 A kind of l-G simulation test data collection system based on DDS
CN113076233A (en) * 2021-03-30 2021-07-06 中国建设银行股份有限公司 IO performance detection method, device, equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101051874A (en) * 2007-05-18 2007-10-10 北京大学 Simulating moving self organization network method
US20100095281A1 (en) * 2008-10-14 2010-04-15 Riverside Research Institute Internal Function Debugger
CN108628291A (en) * 2018-06-26 2018-10-09 绿色动力环保集团股份有限公司 A kind of expert intelligence diagnostic system of the garbage burning factory based on emulation platform
CN109635311A (en) * 2018-10-24 2019-04-16 中国电子科技集团公司第二十八研究所 A kind of l-G simulation test data collection system based on DDS
CN113076233A (en) * 2021-03-30 2021-07-06 中国建设银行股份有限公司 IO performance detection method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN113268436B (en) 2021-10-08

Similar Documents

Publication Publication Date Title
US8214189B2 (en) Performance evaluation simulation
Zhang et al. Panappticon: Event-based tracing to measure mobile application and platform performance
US20090172664A1 (en) Adding a profiling agent to a virtual machine to permit performance and memory consumption analysis within unit tests
Fabre et al. Assessment of COTS microkernels by fault injection
US20080209436A1 (en) Automated testing of programs using race-detection and flipping
CN108153587B (en) Slow task reason detection method for big data platform
US8819496B2 (en) Apparatus for collecting trace information and processing trace information, and method for collecting and processing trace information
JP2017117442A (en) Method and device for data flow analysis in processor trace log using compiler-type information
CN109964207A (en) The tracking based on cache debugged and analyzed for time stroke
US7684971B1 (en) Method and system for improving simulation performance
CN113268436B (en) Multi-granularity computer simulation operation information acquisition method based on hook points
Ilin et al. Performance analysis of software with a variant NoSQL data schemes
Gioachin et al. Robust non-intrusive record-replay with processor extraction
Machado et al. Lightweight cooperative logging for fault replication in concurrent programs
Schumacher et al. SCandal: SystemC analysis for nondeterminism anomalies
CN114239452A (en) Design function verification method, system, verification electronic device, and storage medium
CN113742252B (en) Method and device for detecting memory disorder
Lutz et al. Testing tools (software)
Hu et al. A performance prototyping approach to designing concurrent software architectures
Zhao et al. Host-compiled reliability modeling for fast estimation of architectural vulnerabilities
CN114115887A (en) Adaptive scheduling with dynamic partition load balancing for fast partition compilation
JP4997144B2 (en) Multitask processing apparatus and method
Sundmark et al. Monitored software components-a novel software engineering approach
US20080163180A1 (en) Dynamic discovery of data segments within instrumented code
CN108604205B (en) Test point creating method, device and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant