An embedded software system monitoring method, device, equipment, medium and product
By inserting timestamp recording code into the embedded software system and using the application core's preset process for data recording, the problems of high monitoring cost and low resource utilization in embedded software systems are solved, achieving low-intrusion and high-efficiency real-time performance monitoring.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- IMOTION AUTOMOTIVE TECH (SUZHOU) CO LTD
- Filing Date
- 2026-03-23
- Publication Date
- 2026-06-12
AI Technical Summary
Existing embedded software system monitoring solutions are costly and have low resource utilization of the real-time core, affecting the real-time performance and stability of the system.
By setting macro switches in the embedded software system, inserting timestamp recording code during the compilation stage, recording the timestamp of the target monitoring object in the real-time core, and writing the data records to the file system through the application core's preset process, pure software monitoring is achieved, avoiding hardware intrusion.
It reduced monitoring costs, improved the resource utilization of the real-time core, reduced the performance impact on real-time tasks, and ensured the authenticity of monitoring data and the stability of the system.
Smart Images

Figure CN122195779A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of embedded system technology, and in particular to a method, apparatus, device, medium and product for monitoring embedded software systems. Background Technology
[0002] In embedded systems, especially in software development compliant with the AUTOSAR (Automotive Open System Architecture) standard, accurate measurement of the performance of Tasks and Runnables running on the R-core (real-time core) is crucial. This directly impacts the system's real-time performance, stability, and security. Existing monitoring solutions typically include external hardware debuggers, built-in code logging, and general-purpose software monitoring tools. However, external hardware debuggers are expensive and have complex interfaces, and built-in code logging introduces file I / O (Input / Output) operations, severely interfering with the R-core's real-time performance. General-purpose software monitoring tools may not be fully compatible with specific embedded hardware platforms or may consume excessive R-core resources, affecting normal system behavior.
[0003] Therefore, how to reduce the intrusion into embedded software systems while lowering the monitoring costs and improving the resource utilization of real-time cores is a technical problem that needs to be solved by those skilled in the art. Summary of the Invention
[0004] In view of this, the purpose of this application is to provide an embedded software system monitoring method, apparatus, device, medium, and product, which can reduce the cost of embedded software system monitoring, reduce intrusion into the embedded software system, and improve the resource utilization of the real-time core. The specific solution is as follows: In a first aspect, this application discloses a method for monitoring embedded software systems, including: In the real-time core, the start and end timestamps of the target monitoring objects in the embedded software system are recorded to shared memory through timestamp recording code; wherein, the target monitoring objects include target tasks and target runnable entities, and the embedded software system is equipped with macro switches. During the compilation phase, when the macro switches are turned on, the timestamp recording code is inserted at the entry and exit points of the target monitoring objects using instrumentation code; In the application core, a preset process reads data records from the shared memory and writes the data records into the application core's file system, wherein the data records are the data records corresponding to the start timestamp and the end timestamp.
[0005] Optionally, a preset process is used to read data records from the shared memory and write the data records into the application core's file system, including: The system uses a data reading thread in a preset process to read data records from the shared memory, and a data writing thread in the preset process to write the data records into the application core's file system.
[0006] Optionally, data records are read from the shared memory using a data reading thread in a preset process, including: The data reading thread in the preset process reads data records from the shared memory and writes the data records into the target buffer of the application core. The target buffer includes a first buffer and a second buffer. When the first buffer or the second buffer is full, the data reading thread switches to the other buffer for writing. Accordingly, the step of using the data writing thread in the preset process to write the data record into the application core's file system includes: The data record in the target buffer is written into the file system of the application core using the data writing thread in the preset process.
[0007] Optionally, writing the data records into the application core's file system includes: If the record time of the target file corresponding to the last write operation reaches a preset time threshold, a new target file is created in the file system of the application core, and the data record is written to the new target file. The recording time is the time interval between the moment the target file was first written and the current moment.
[0008] Optionally, the shared memory is a circular buffer, and the step of recording the start and end timestamps of the target monitoring object in the embedded software system to the shared memory via timestamp recording code includes: When the start or end timestamp of the target monitoring object in the embedded software system is obtained, the code records the data at the circular buffer based on the write pointer, and writes the data record corresponding to the start or end timestamp at that position.
[0009] Optionally, the start and end timestamps of the target monitoring object in the embedded software system are recorded to shared memory via timestamp recording code, including: The timestamp recording code records the start and end timestamps of the target monitoring object in the embedded software system, as well as the identification information of the target monitoring object, into shared memory.
[0010] Secondly, this application provides an embedded software system monitoring device, comprising: The data recording module is used in the real-time core to record the start and end timestamps of the target monitoring objects in the embedded software system to shared memory through timestamp recording code; wherein, the target monitoring objects include target tasks and target runnable entities, and the embedded software system is equipped with a macro switch. During the compilation phase, when the macro switch is turned on, the timestamp recording code is inserted at the entry and exit points of the target monitoring objects using instrumentation code; The file writing module is used in the application core to read data records from the shared memory using a preset process and write the data records into the file system of the application core, wherein the data records are the data records corresponding to the start timestamp and the end timestamp.
[0011] Thirdly, this application provides an electronic device, including a memory and a processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program to implement the aforementioned embedded software system monitoring method.
[0012] Fourthly, this application provides a computer-readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the aforementioned embedded software system monitoring method.
[0013] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the aforementioned embedded software system monitoring method.
[0014] As can be seen from the above scheme, the present invention provides an embedded software system monitoring method, including: in the real-time core, recording the start and end timestamps of the target monitoring object in the embedded software system to shared memory through timestamp recording code; wherein, the target monitoring object includes a target task and a target runnable entity, the embedded software system is equipped with a macro switch, and during the compilation stage, when the macro switch is turned on, the timestamp recording code is inserted at the entry and exit points of the target monitoring object using instrumentation code; in the application core, reading data records from the shared memory using a preset process, and writing the data records into the file system of the application core, wherein the data records are the data records corresponding to the start and end timestamps.
[0015] Therefore, the beneficial effects of this application are as follows: By setting a macro switch, during the compilation phase of the embedded software system, when the macro switch is turned on, the timestamp recording code is inserted at the entry and exit points of the target monitoring object using instrumentation code. During runtime, in the real-time core, the start and end timestamps of the target monitoring object are recorded to shared memory through the timestamp recording code. The data records are then read from the shared memory by a preset process in the application core and written to the file system of the application core. In this way, it is a pure software implementation without any additional hardware. It can be easily switched between development / debugging and production / release versions through macro switch control, with low cost. In the real-time core, only memory write operations at the start and end of the target monitoring object are added, which is low-intrusive and has minimal impact on the performance of real-time tasks. The resource-intensive file processing operations are transferred to the application core, which has higher performance and lower real-time requirements, ensuring that the tasks of the real-time core are not affected and the resource utilization is higher. It can reduce the monitoring cost of the embedded software system, reduce the intrusion into the embedded software system, and improve the resource utilization of the real-time core.
[0016] Correspondingly, the embedded software system monitoring device, equipment, and readable storage medium provided in this application also have the above-mentioned technical effects. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0018] Figure 1 A flowchart of an embedded software system monitoring method provided in this application embodiment; Figure 2 A schematic diagram of code instrumentation provided for an embodiment of this application; Figure 3 This application provides a schematic diagram of real-time core data acquisition. Figure 4 A schematic diagram illustrating the file system writing process of an application core, provided as an embodiment of this application; Figure 5 This is a runtime sequence diagram of an embedded software system monitoring scheme provided in an embodiment of this application; Figure 6 A schematic diagram of an embedded software system monitoring device provided in this application embodiment; Figure 7 This is a structural diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0019] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0020] In embedded systems, such as automotive embedded systems, and especially in AUTOSAR-compliant software development, accurate measurement of the performance of tasks and runnables running on the R-core (Real-time Core) is crucial. This directly relates to the system's real-time performance, stability, and security.
[0021] Existing monitoring solutions mainly fall into the following categories: 1. External hardware debuggers: such as using hardware tools like JTAG (Joint Test Action Group) or ETM (Embedded Trace Macrocell). While accurate, these solutions are expensive, have complex interfaces, and typically require a laboratory environment, making them difficult to apply in real-world vehicle road testing environments. 2. Built-in code logging: inserting print statements into the code to output time information. This introduces file I / O operations, severely interfering with R-core's real-time performance, significantly altering the code's runtime sequence, and causing measurement distortion. 3. General-purpose software monitoring tools: some general-purpose RTOS (Real-Time Operating System) monitoring tools may not be fully compatible with specific embedded hardware platforms (such as A-core (Application Core) + R-core heterogeneous platforms), or their monitoring agents may consume significant R-core resources, affecting normal system behavior. The above solutions present significant technical challenges in achieving low-cost, low-intrusion runtime monitoring in real-world vehicle environments. Therefore, this application provides an embedded software system monitoring scheme that can reduce the intrusion into the embedded software system and improve the resource utilization of the real-time core while reducing the monitoring cost of the embedded software system.
[0022] See Figure 1 As shown in the figure, this application discloses an embedded software system monitoring method, including: Step S11: In the real-time core, the start and end timestamps of the target monitoring object in the embedded software system are recorded to shared memory using timestamp recording code; wherein, the target monitoring object includes the target task and the target runnable entity, and the embedded software system is equipped with a macro switch. During the compilation stage, when the macro switch is turned on, the timestamp recording code is inserted at the entry and exit points of the target monitoring object using instrumentation code.
[0023] In this embodiment, the embedded software system runs in a heterogeneous multi-core environment (i.e., a real-time core and an application core). The real-time core is a processor core running an RTOS, and the application core is a processor core running a Linux operating system. The embedded software system can be an automotive embedded software system. During the software compilation stage, a timestamp recording code addition function is selectively enabled via a configurable macro switch. When the timestamp recording code addition function is enabled, simplified timestamp recording code is automatically inserted at the entry and exit points of specified tasks and runnable entities via an automated script, i.e., the aforementioned instrumentation code. The entry point is the first code execution point where the logic of the unit (i.e., task or runnable entity) begins to execute. The exit point is the last code execution point where the logic of the unit terminates. The function of the timestamp recording code is to obtain the current high-precision clock count value, obtain the start timestamp or end timestamp, and record it in shared memory. The timestamp is used to record the time point when an event occurs. Shared memory is a memory area shared among multi-core processors.
[0024] When the system is officially released, disabling this macro switch will completely eliminate the timestamp recording code from the final binary file, achieving zero overhead. For debugging, simply enable the macro and recompile.
[0025] Furthermore, in an optional embodiment, recording the start and end timestamps of the target monitoring object in the embedded software system to shared memory via timestamp recording code includes: recording the start and end timestamps of the target monitoring object in the embedded software system, as well as the identification information of the target monitoring object, to shared memory via timestamp recording code.
[0026] In other words, the timestamp recording code writes the start or end timestamp along with a unique identifier (used to identify the entry or exit point of a task or runnable entity) as a single data unit into pre-allocated shared memory. This allows for subsequent problem localization based on the identifier. The execution of the timestamp recording code does not involve complex logic, conditional statements, or I / O operations, ensuring that the impact on the original execution timing of the real-time core is minimized.
[0027] In an optional embodiment, the shared memory is a circular buffer. The step of recording the start and end timestamps of the target monitoring object in the embedded software system to the shared memory via the timestamp recording code includes: when the start or end timestamp record of the target monitoring object in the embedded software system is obtained, the timestamp recording code determines the position to write to the circular buffer based on the write pointer, and writes the data record corresponding to the start or end timestamp at that position.
[0028] In this embodiment, a shared memory region is designated as part of the physical memory accessible to both the real-time core and the application core during system startup. The timestamp recording code acts as a producer on the real-time core, continuously writing data units corresponding to the timestamps into this region. This embodiment can employ a circular buffer to manage this memory, achieving efficient, lock-free, or low-contention data writing. Furthermore, after writing the data record corresponding to the start or end timestamp at this location, the write pointer is atomically updated. When the circular buffer is full, the oldest data is overwritten or the new data is discarded; this is configurable.
[0029] Step S12: In the application core, a preset process is used to read data records from the shared memory and write the data records into the file system of the application core, wherein the data records are the data records corresponding to the start timestamp and the end timestamp.
[0030] It should be noted that steps S11 and S12 do not restrict the execution order. In this embodiment, the real-time core's writing to shared memory and the application core's reading of shared memory can be executed in parallel.
[0031] In an optional embodiment, reading data records from the shared memory using a preset process and writing the data records into the application core's file system includes: reading data records from the shared memory using a data reading thread in the preset process, and writing the data records into the application core's file system using a data writing thread in the preset process.
[0032] In this embodiment, an independent process is created within the application core. This process polls shared memory at a preset period. When a data record is detected, it is read and written to the application core's file system. In this embodiment, operations such as opening, writing, closing, and file system management are performed by the application core, without consuming the CPU (Central Processing Unit) resources of the real-time core. Multiple data records can be read in batches to improve efficiency, and the read pointer is updated after each data record is read.
[0033] Furthermore, reading data records from the shared memory using a data reading thread in a preset process can include: reading data records from the shared memory using the data reading thread in the preset process, and writing the data records into a target buffer of the application core, wherein the target buffer includes a first buffer and a second buffer, and the data reading thread switches to the other buffer for writing when the first buffer or the second buffer is full. Correspondingly, writing the data records into the application core's file system using a data writing thread in the preset process can include: writing the data records from the target buffer into the application core's file system using the data writing thread in the preset process.
[0034] That is, in this embodiment of the application, the preset process includes two threads: a data reading thread and a data writing thread. Furthermore, a double buffering mechanism is adopted: the data reading thread copies data records from shared memory to a buffer; when that buffer is full, it switches to the other buffer. The data writing thread reads data from both buffers sequentially and writes it to the file system. The two threads work in parallel to avoid blocking.
[0035] In an optional embodiment, the data record is written to the application core's file system, including: if the recording time of the target file corresponding to the last write operation reaches a preset time threshold, a new target file is created in the application core's file system, and the data record is written to the new target file; wherein, the recording time is the time interval from the moment the target file was first written to the current moment.
[0036] In this embodiment, the file can be stored in binary format to save space. The file includes a file header and file content. The file header may include version information, a mapping between identification information and task name, and the name of the runnable entity. The file content consists of identification information and a timestamp. Furthermore, this embodiment can store the file in segments, meaning that recording time can be set, such as recording 10 minutes of data in one file, to avoid a single file becoming too large. In an optional implementation, the file can also be compressed to further reduce storage space.
[0037] As can be seen, in this embodiment, a macro switch is set. During the embedded software system compilation stage, when the macro switch is turned on, instrumentation code is used to insert the timestamp recording code at the entry and exit points of the target monitoring object. During runtime, in the real-time core, the start and end timestamps of the target monitoring object are recorded to shared memory through the timestamp recording code. The data records are then read from the shared memory by a preset process in the application core and written to the file system of the application core. In this way, it is a pure software implementation without any additional hardware. It can be easily switched between development / debugging and production / release versions through macro switch control, with low cost. In the real-time core, only memory write operations at the start and end of the target monitoring object are added, which is low-intrusive and has a minimal impact on the performance of real-time tasks. The resource-intensive file processing operations are transferred to the application core, which has higher performance and lower real-time requirements, ensuring that the tasks of the real-time core are not affected and the resource utilization is higher. It can reduce the monitoring cost of the embedded software system, reduce the intrusion into the embedded software system, and improve the resource utilization of the real-time core.
[0038] Further, see Figure 2 As shown, Figure 2This is a schematic diagram of code instrumentation provided in an embodiment of this application. During the compilation phase, RTA (i.e., RTE TimeStamp Addition, the RTE (Runtime Environment) timestamp addition component, also known as the aforementioned timestamp recording code addition function) automatically inserts code: RTA automatically inserts timestamp recording code at the entry and exit points of each Task and Runnable by parsing the RTE source code configuration. A Task is a task unit in an RTOS, and a Runnable is the smallest executable unit in an RTOS. This can be achieved as follows: when a Runnable starts, a timestamp TS_start is recorded; when a Runnable ends, a timestamp TS_end is recorded. The timestamp data is written to a shared memory circular buffer, and the compiled artifact carries the timestamp recording code. In other words, this embodiment can perform code instrumentation. During the software compilation phase, the RTA function can be selectively enabled through a configurable macro switch, i.e., the timestamp recording function can be controlled by a macro definition. When RTA is enabled, automated scripts (e.g., cpj_chery / tools / icar05 / rcoreTimestamp) automatically insert minimal timestamp recording code at the entry and exit points of specified Tasks and Runnables. This code is purely functional: it retrieves the current high-precision clock count and, along with a unique event ID (identifying which Task / Runnable's entry or exit point), writes it as a single data unit to a pre-allocated shared memory buffer. This process involves no complex logic, conditional statements, or I / O operations, ensuring minimal impact on the original execution timing of R-core.
[0039] In this way, the instrumentation code of the RTA can be completely enabled or removed through compile-time macro definitions. When the system is officially released, disabling the macro ensures that the timestamp recording code is completely absent from the final binary file, achieving zero overhead. For debugging, simply enable the macro and recompile. That is, this embodiment employs a lightweight timestamp recording code insertion mechanism. During the compilation phase, the RTA automatically analyzes the RTE code structure through a script and inserts timestamp recording code at critical locations. Disabling it normally has no impact on the system; it is enabled when monitoring is required. The code for timestamp acquisition and recording is very concise, with execution time in the microsecond range, having minimal impact on system real-time performance.
[0040] Furthermore, data transfer is achieved through shared memory. At system startup, a block of physical memory accessible to both A-core and R-core is designated as a shared memory region. The RTA function acts as a producer on R-core, continuously writing timestamp data units into this region. A circular buffer is used to manage shared memory, enabling efficient, lock-free, or low-contention data writing. Data collection and persistence are handled by a pre-defined process, which can be called RRS (R-core Runtime Server, also known as the aforementioned pre-defined process, monitoring and recording data on the R-core during runtime). RRS runs as an independent process (or daemon) on a general-purpose operating system such as Linux on A-core. RRS acts as a consumer, polling the shared memory region at a low frequency (e.g., every 100 milliseconds). When new timestamp data is detected, RRS reads it from shared memory and appends it to A-core's file system. All heavyweight operations, such as file opening, writing, closing, and file system management, are handled by A-core, without consuming any of R-core's valuable CPU resources. File management features include aggregating multiple files and deleting files.
[0041] This embodiment implements data acquisition and transmission during the runtime phase. See also... Figure 3 As shown, Figure 3 This is a schematic diagram of real-time core data acquisition provided in an embodiment of this application. Tasks / runnable entities execute, recording the start timestamp, executed business, and end timestamp, and writing them to shared memory, i.e., a circular buffer. See [link / reference]. Figure 4 As shown, Figure 4 This diagram illustrates a file system write operation within the core of an application, as provided in an embodiment of this application. The RRS process starts, periodically checks shared memory, reads TS data (i.e., the aforementioned data records), and writes it to the file system. See also... Figure 5 As shown, Figure 5 This is a runtime sequence diagram of an embedded software system monitoring scheme provided in an embodiment of this application. Taking Runnable execution as an example, a timestamp TS_start is recorded at the start of the Runnable, business code is executed, and a timestamp TS_end is recorded at the end of the Runnable. The timestamp records are written to shared memory. The RRS server, i.e., a preset process, periodically polls the shared memory, checks for new data, returns TS data (data records), and writes them to the file system.
[0042] To efficiently transfer data and avoid memory overflow, a circular buffer design is used for shared memory. R-core write logic: atomically updates `write_index` (write pointer), overwriting the oldest data (or discarding new data, configurable) when the buffer is full. Each record contains the aforementioned identification information. A-core read logic: periodically reads data records based on `read_index` (read pointer), allowing batch reading of multiple records to improve efficiency, and updating `read_index` after each read. An RRS data persistence strategy is adopted: RRS runs on A-core Linux and includes two threads: a data reading thread reads timestamp data from shared memory, and a data writing thread writes data to the file system; a double buffering mechanism is used: the reading thread copies data from shared memory to buffer A, and when buffer A is full, it switches to buffer B; the writing thread writes data from buffer A to the file. The two threads work in parallel to avoid blocking. File storage format can use binary format to save space, can include a file header, and optionally supports data compression. It can also segment files to avoid excessively large single files.
[0043] This application implements a low-intrusive runtime monitoring scheme for embedded real-time systems based on heterogeneous dual-core collaboration. Only lightweight timestamp instrumentation is performed on the real-time core, and data is written to shared memory. Meanwhile, an independent server process runs on the application core to read and persistently store this data. This achieves high-precision monitoring of the real-time system while minimizing the impact of monitoring overhead on the performance of the real-time core. In complex automotive heterogeneous multi-core (A-core + R-core) environments, it accurately measures the real-time performance of the R-core while minimizing interference from the monitoring system itself on the R-core performance and avoiding the use of expensive external hardware, thus enabling convenient deployment and measurement in real-world vehicle environments.
[0044] This application implements a low-intrusion, high-efficiency dual-core collaborative real-time system runtime monitoring solution. Utilizing a heterogeneous multi-core architecture, it offloads data processing and storage tasks that significantly impact real-time performance to the non-real-time A-core, enabling accurate and low-interference measurement of the R-core. It features extremely low invasiveness: the code on the R-core only adds a few memory write operations, which have a negligible impact on the performance of real-time tasks compared to methods like log printing, ensuring the authenticity of the measurement data. It improves resource efficiency: by offloading resource-intensive operations such as data processing and file I / O to the more powerful and less real-time-critical A-core, it ensures that the core tasks of the R-core remain unaffected. It offers flexible deployment and low cost: implemented purely in software, requiring no additional hardware. Through macro switch control, it can easily switch between development / debugging and production release versions without leaving any performance "backdoors" in the release version. It is suitable for real-world vehicle environments: the RRS runs on the A-core and can continuously record data in the file system, making it ideal for long-term real-world road testing and data acquisition to capture intermittent, sporadic performance issues.
[0045] See Figure 6 As shown, this application provides an embedded software system monitoring device, comprising: The data recording module 11 is used to record the start and end timestamps of the target monitoring object in the embedded software system to shared memory in the real-time core by using timestamp recording code; wherein, the target monitoring object includes the target task and the target runnable entity, and the embedded software system is equipped with a macro switch. During the compilation stage, when the macro switch is turned on, the timestamp recording code is inserted at the entry and exit of the target monitoring object using instrumentation code; The file writing module 12 is used in the application core to read data records from the shared memory using a preset process and write the data records into the file system of the application core, wherein the data records are the data records corresponding to the start timestamp and the end timestamp.
[0046] The file writing module 12 is specifically used for: The system uses a data reading thread in a preset process to read data records from the shared memory, and a data writing thread in the preset process to write the data records into the application core's file system.
[0047] In an optional embodiment, the file writing module 12 is specifically used for: The data reading thread in the preset process reads data records from the shared memory and writes the data records into the target buffer of the application core. The target buffer includes a first buffer and a second buffer. When the first buffer or the second buffer is full, the data reading thread switches to the other buffer for writing. The data writing thread in the preset process writes the data records in the target buffer into the file system of the application core.
[0048] Furthermore, the file writing module 12 is specifically used to: if the recording time of the target file corresponding to the last write operation reaches a preset time threshold, then create a new target file in the file system of the application core and write the data record into the new target file; wherein, the recording time is the time interval from the moment the target file was first written to the current moment.
[0049] In an optional implementation, the shared memory is a circular buffer, and the data recording module 11 can be specifically used to: when the start timestamp or end timestamp record of the target monitoring object in the embedded software system is obtained, the code determines the position to write to the circular buffer based on the write pointer, and writes the data record corresponding to the start timestamp or end timestamp at that position.
[0050] Furthermore, the data recording module 11 can be specifically used to record the start and end timestamps of the target monitoring object in the embedded software system, as well as the identification information of the target monitoring object, to shared memory through timestamp recording code.
[0051] As can be seen, in this embodiment, a macro switch is set. During the embedded software system compilation stage, when the macro switch is turned on, instrumentation code is used to insert the timestamp recording code at the entry and exit points of the target monitoring object. During runtime, in the real-time core, the start and end timestamps of the target monitoring object are recorded to shared memory through the timestamp recording code. The data records are then read from the shared memory by a preset process in the application core and written to the file system of the application core. In this way, it is a pure software implementation without any additional hardware. It can be easily switched between development / debugging and production / release versions through macro switch control, with low cost. In the real-time core, only memory write operations at the start and end of the target monitoring object are added, which is low-intrusive and has a minimal impact on the performance of real-time tasks. The resource-intensive file processing operations are transferred to the application core, which has higher performance and lower real-time requirements, ensuring that the tasks of the real-time core are not affected and the resource utilization is higher. It can reduce the monitoring cost of the embedded software system, reduce the intrusion into the embedded software system, and improve the resource utilization of the real-time core.
[0052] See Figure 7 As shown in the figure, this application discloses an electronic device 20, including a processor 21 and a memory 22; wherein, the memory 22 is used to store a computer program; the processor 21 is used to execute the computer program, the embedded software system monitoring method disclosed in the foregoing embodiment.
[0053] For details regarding the specific process of the above-mentioned embedded software system monitoring method, please refer to the relevant content disclosed in the foregoing embodiments, which will not be repeated here.
[0054] Furthermore, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk, or optical disk, and the storage method can be temporary storage or permanent storage.
[0055] In addition, the electronic device 20 also includes a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26; wherein, the power supply 23 is used to provide operating voltage for the various hardware devices on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0056] Furthermore, embodiments of this application also disclose a computer-readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the embedded software system monitoring method disclosed in the foregoing embodiments.
[0057] For details regarding the specific process of the above-mentioned embedded software system monitoring method, please refer to the relevant content disclosed in the foregoing embodiments, which will not be repeated here.
[0058] Furthermore, embodiments of this application provide a computer program product, including a computer program, which, when executed by a processor, provides the embedded software system monitoring method disclosed in the foregoing embodiments.
[0059] For details regarding the specific process of the above-mentioned embedded software system monitoring method, please refer to the relevant content disclosed in the foregoing embodiments, which will not be repeated here.
[0060] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0061] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0062] The above provides a detailed description of an embedded software system monitoring method, apparatus, device, medium, and product provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A monitoring method for an embedded software system, characterized in that, include: In the real-time core, the start and end timestamps of the target monitoring objects in the embedded software system are recorded to shared memory through timestamp recording code; wherein, the target monitoring objects include target tasks and target runnable entities, and the embedded software system is equipped with macro switches. During the compilation phase, when the macro switches are turned on, the timestamp recording code is inserted at the entry and exit points of the target monitoring objects using instrumentation code; In the application core, a preset process reads data records from the shared memory and writes the data records into the application core's file system, wherein the data records are the data records corresponding to the start timestamp and the end timestamp.
2. The embedded software system monitoring method according to claim 1, characterized in that, The process of reading data records from the shared memory using a preset process and writing the data records into the application core's file system includes: The system uses a data reading thread in a preset process to read data records from the shared memory, and a data writing thread in the preset process to write the data records into the application core's file system.
3. The embedded software system monitoring method according to claim 2, characterized in that, Reading data records from the shared memory using a data reading thread in a preset process includes: The data reading thread in the preset process reads data records from the shared memory and writes the data records into the target buffer of the application core. The target buffer includes a first buffer and a second buffer. When the first buffer or the second buffer is full, the data reading thread switches to the other buffer for writing. Accordingly, the step of using the data writing thread in the preset process to write the data record into the application core's file system includes: The data record in the target buffer is written into the file system of the application core using the data writing thread in the preset process.
4. The embedded software system monitoring method according to claim 1, characterized in that, Writing the data records into the application's core file system includes: If the record time of the target file corresponding to the last write operation reaches a preset time threshold, a new target file is created in the file system of the application core, and the data record is written to the new target file. The recording time is the time interval between the moment the target file was first written and the current moment.
5. The embedded software system monitoring method according to claim 1, characterized in that, The shared memory is a circular buffer. The step of recording the start and end timestamps of the target monitoring object in the embedded software system to the shared memory via timestamp recording code includes: When the start or end timestamp of the target monitoring object in the embedded software system is obtained, the code records the data at the circular buffer based on the write pointer, and writes the data record corresponding to the start or end timestamp at that position.
6. The embedded software system monitoring method according to any one of claims 1 to 5, characterized in that, The timestamp recording code records the start and end timestamps of the target monitoring object in the embedded software system to shared memory, including: The timestamp recording code records the start and end timestamps of the target monitoring object in the embedded software system, as well as the identification information of the target monitoring object, into shared memory.
7. An embedded software system monitoring device, characterized in that, include: The data recording module is used in the real-time core to record the start and end timestamps of the target monitoring objects in the embedded software system to shared memory through timestamp recording code; wherein, the target monitoring objects include target tasks and target runnable entities, and the embedded software system is equipped with a macro switch. During the compilation phase, when the macro switch is turned on, the timestamp recording code is inserted at the entry and exit points of the target monitoring objects using instrumentation code; The file writing module is used in the application core to read data records from the shared memory using a preset process and write the data records into the file system of the application core, wherein the data records are the data records corresponding to the start timestamp and the end timestamp.
8. An electronic device, characterized in that, Includes memory and processor, wherein: The memory is used to store computer programs; The processor is configured to execute the computer program to implement the embedded software system monitoring method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, Used to store a computer program, wherein the computer program, when executed by a processor, implements the embedded software system monitoring method as described in any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the embedded software system monitoring method as described in any one of claims 1 to 6.