Error logging method based on double timestamp circular queue

By using a dual-timestamp circular queue error logging method, which combines a general circular queue and a buffered circular queue, the storage limitation problem of error logging in airborne equipment is solved, enabling the recording of more useful information and accurate error occurrence time within limited storage space.

CN114443339BActive Publication Date: 2025-10-24CHINESE AERONAUTICAL RADIO ELECTRONICS RES INST
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210110351.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-29
Publication Date
2025-10-24
Estimated Expiration
2042-01-29

AI Technical Summary

Technical Problem

Existing error logging methods for airborne equipment cannot simultaneously record the latest error information and the time of error occurrence, and frequent errors can overwrite previous log records.

Method used

An error logging method based on a dual-timestamp circular queue is adopted. By combining the overall circular queue and the buffered circular queue, the error number, first timestamp, second timestamp and count are recorded to distinguish between the first type and the second type of error, and the logging is optimized under limited storage space.

Benefits of technology

With limited storage space, it can record more useful error log information, ensure that frequent errors do not overwrite previous logs, and provide accurate records of when errors occur.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114443339B_ABST
    Figure CN114443339B_ABST
Patent Text Reader

Abstract

The application discloses a kind of error log recording methods based on double time stamp circulating queue, step 1, after receiving error number, judge whether it is second type error, if this error number is second type error log, enter step 2, otherwise enter step 3;Step 2, write the error log of error number in the address that overall circulating queue head pointer points;Wherein overall circulating queue is a part in nonvolatile memory space, the format of writing error log in overall circulating queue includes error number, first time stamp, second time stamp and number of times, first time stamp is the time that the error is recorded for the first time, second time stamp is the time that the error is recorded for the last time, and the number of times is the number of times that the error occurs between first time stamp and second time stamp;Step 3, write the error log of error number in buffer circulating queue.The application records more useful error log information as far as possible under the constraint of limited storage space.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of device exception error processing, in particular to an error log recording method based on a double timestamp circular queue. BACKGROUND

[0002] With the functional complication and performance improvement of airborne electronic devices, more and more airborne devices have resident software to support the normal operation of the airborne devices. During the software operation, an error log recording function is usually designed, which is generally used to record the self-detection results of the airborne devices for post-flight fault analysis. Since the airborne electronic devices often cannot provide large-capacity storage devices to store a large amount of log information, the common practice is to open up a space in the non-volatile memory to store error log information. There are two simple error log design methods: the first error log is based on the enumeration of all error types, that is, after sufficient statistical analysis, M errors that the device can generate are found, and when designing the error log storage space size, a storage space to store M records is opened up. When an error occurs, the error information corresponding to the error is recorded in the fixed position, the error number is incremented by 1, and the error occurrence time is updated; the second error log is based on the error occurrence time, that is, a circular storage queue of N error logs is opened up, and when an error occurs, a new error log is directly recorded, and when the circular storage queue is full, a new error log replaces the tail of the queue. The first type of design has the advantage of recording the latest error occurrence time, but the disadvantage is that it cannot capture the specific occurrence time of the error that has occurred before; the second design has the advantage of recording the latest N errors, but the disadvantage is that when a certain error occurs frequently, it will cover all the previous error log records. SUMMARY

[0003] To solve the above problems, the purpose of the present application is to provide an error log recording method based on a double timestamp circular queue, which combines the above two basic error log recording methods and records as much useful error log information as possible under the constraint of limited storage space.

[0004] The purpose of the present application is achieved by the following technical solutions.

[0005] An error log recording method based on a double timestamp circular queue, comprising the following steps:

[0006] Step 1: After receiving the error number, it is judged whether it is a second type of error. If this error number is a second type of error log, go to step 2, otherwise go to step 3; wherein the error that users pay more attention to the accurate time of error occurrence is classified as the second type of error;

[0007] Step 2, write the error log of the error number at the address pointed by the head pointer of the whole circular queue; wherein the whole circular queue is a part of the non-volatile memory space, the format of the error log written in the whole circular queue contains the error number, the first timestamp, the second timestamp (the content is consistent with the first timestamp) and the number of times (the number of times is 1), the first timestamp is the time when the error is first recorded, the second timestamp is the time when the error is last recorded, and the number of times is the number of times the error occurs between the first timestamp and the second timestamp;

[0008] Step 3, write the error log of the error number in the buffer circular queue;

[0009] Wherein, the buffer circular queue is a part of the memory space, and the format of the error log written in the buffer circular queue contains the mapping address, the error number, the first timestamp, the second timestamp and the number of times, wherein the mapping address records the position information of the error log of the error number in the whole circular queue.

[0010] Preferably, the writing measure of step 3 is:

[0011] a) if the error number exists in the buffer circular queue, find the log entry pointing to the error number in the buffer circular queue, update the second timestamp of the error log, and increase the number of times by 1:

[0012] b) if the error number does not exist in the buffer circular queue, and the buffer circular queue is full, write the error log at the tail of the buffer circular queue back to the whole circular queue, and clear the error log at the tail of the buffer circular queue, then write the new error log to the whole circular queue, and finally write the new error log to the space of the buffer circular queue just cleared;

[0013] c) if the error number does not exist in the buffer circular queue, and the buffer circular queue is not full, write the new error log to the buffer circular queue.

[0014] Preferably, a non-periodic task is set to be responsible for synchronizing the error log in the buffer circular queue to the whole circular queue outside the normal task execution period of the device.

[0015] Preferably, if the device has an unexpected power failure, the error log in the buffer circular queue is synchronized to the whole circular queue by using the time of power failure protection.

[0016] Preferably, when the number of times of the second type of error exceeds the threshold value in a time period, the error log in the buffer circular queue is written to the whole circular queue, and the buffer circular queue is cleared.

[0017] Preferably, when the current pointer of the whole circular queue has pointed to the position corresponding to the mapping address in the buffer circular queue, the error logs in the whole circular queue are written into the buffer circular queue, and the buffer circular queue is emptied.

[0018] Preferably, the number of the second type of error is recorded in the exception queue, and whether the error log is the second type of error is determined by determining whether the error number exists in the exception queue. BRIEF DESCRIPTION OF DRAWINGS

[0019] Figure 1 Whole circular queue error log format schematic diagram.

[0020] Figure 2 Buffer circular queue error log format schematic diagram.

[0021] Figure 3 Whole circular queue and buffer circular queue working schematic diagram.

[0022] Figure 4 Exception queue schematic diagram.

[0023] Figure 5 Error log recording process schematic diagram. DETAILED DESCRIPTION

[0024] The application will be further described in detail below in combination with the drawings and examples.

[0025] Referring to Figure 5 The error log recording method based on the double time stamp circular queue shown in the embodiment comprises the following steps:

[0026] Step 1, after receiving the error number, it is determined whether it is the second type of error, if the error number is the second type of error log, step 2 is entered, otherwise step 3 is entered. In the embodiment, the error log of the type of error that the user pays more attention to the number of occurrences in a period of time is classified as the first type of error, the error log of the type of error that the user pays more attention to the accurate time of occurrence is classified as the second type of error, and the number of the second type of error is recorded in the exception queue, and whether the error log is the second type of error can be determined by determining whether the error number exists in the exception queue.

[0027] Step 2, the error log of the error number is written at the address pointed by the head pointer of the whole circular queue. The whole circular queue is a part of the non-volatile memory space, and the format of the error log written in the whole circular queue is as follows: Figure 1As shown, it contains error number, first timestamp, second timestamp (the content is the same as the first timestamp) and times (the times is 1). The first timestamp is the time when the error is recorded for the first time, the second timestamp is the time when the error is recorded for the last time, and the times is the number of times the error occurs between the first timestamp and the second timestamp.

[0028] Step 3, write the error log of the error number in the buffer circular queue. The buffer circular queue is a part of the memory space, and the format of the error log written in the buffer circular queue is as follows Figure 2 As shown, it contains mapping address, error number, first timestamp, second timestamp and times. The mapping address records the position information of the error log of this error number in the overall circular queue. The meanings of other format elements are the same as those in the overall circular queue.

[0029] The writing measures are as follows:

[0030] a) If the error number exists in the buffer circular queue, find the log entry pointing to the error number in the buffer circular queue, update the second timestamp of the error log, and increase the times by 1:

[0031] b) If the error number does not exist in the buffer circular queue, and the buffer circular queue is full, write back the error log at the tail of the buffer circular queue to the overall circular queue, and clear the error log at the tail of the buffer circular queue, then write the new error log to the overall circular queue, and finally write the new error log to the space just cleared in the buffer circular queue.

[0032] c) If the error number does not exist in the buffer circular queue, and the buffer circular queue is not full, write the new error log to the buffer circular queue.

[0033] Step 4, set a non-periodic task to be responsible for synchronizing the error logs in the buffer circular queue to the overall circular queue outside the normal task execution period of the device.

[0034] Step 5, if the device has an unexpected power failure, the error logs in the buffer circular queue can also be synchronized to the overall circular queue by using the time of power failure protection.

[0035] In the above steps, if the second type of error occurs too frequently, a threshold value is set, when the second type of error exceeds the threshold value in a time period, the error logs in the buffer circular queue are written to the overall circular queue, and the buffer circular queue is cleared to prevent the first type of error log from being overwritten. For example, the threshold value is defined as 40 times of the second type of error occurring within 10 seconds.

[0036] If the current pointer of the whole circular queue has pointed to the position corresponding to the mapping address in the buffer circular queue because of too many second type errors, the error log of the mapping address in the buffer circular queue is written into the whole circular queue, and the buffer circular queue is emptied to prevent the first type error log from being overwritten.

[0037] The size of the whole circular queue is determined according to the size of the non-volatile memory of the on-board device and the space allocation of other functions, and the available storage space is calculated to determine the size of the whole circular queue. When the device is started, the position information of the head of the whole circular queue is determined by restoring the head front pointer of the whole circular queue. If the maximum number of error logs stored in the whole circular queue is P, when the number of error logs stored in the whole circular queue is greater than P, the new error log will overwrite the error log at the tail of the queue, as shown in Figure 3 .

[0038] The buffer circular queue is also a circular queue, and the size of the buffer circular queue is determined according to engineering experience. The error logs stored in the buffer circular queue are all first type errors, and the position information of the last Q first type error logs can be recorded, as shown in Figure 4 . The buffer circular queue allocates memory space when it is initialized. When the first first type error (assuming the number is ID1) is generated, this first type error is recorded in the whole circular queue and then in the buffer circular queue (fill in the mapping address, error number, timestamp 1, and number of times); when a repeated first type error is generated (assuming the number is still ID1), this first type error is recorded in the buffer circular queue (fill in the timestamp 2 and the number of times); and in the idle time, this error is synchronized to the whole circular queue in the non-volatile memory (update the mapping address). When other first type errors are generated (assuming the number is ID2), the buffer circular queue starts to grow. When the type of the generated first type error is greater than 4, the information pointed to by the head pointer of the buffer circular queue is written into the whole circular queue, and the data pointed to by the tail pointer of the buffer circular queue is emptied to start storing new type error log data.

[0039] The exception queue stores the error numbers of all possible second type errors of the device. In order to locate the accurate time of the fault occurrence time, the second type error log design pays attention to recording the accurate time of the error occurrence. Since the number of such errors is small, an exception queue is established, and the queue only contains the error numbers of the second type errors.

Claims

1. A method for error logging based on double timestamp circular queue, comprising the following steps: Step 1, after receiving the error number, it is judged whether it is the second type of error, if this error number is the second type of error log, step 2 is entered, otherwise step 3 is entered; wherein, Classifying the error in which the user pays more attention to the accurate time of error occurrence as the second type of error; Step 2, writing the error log of the error number at the address pointed by the head pointer of the whole circular queue; wherein the whole circular queue is a part of the non-volatile memory space, and the format of the error log written in the whole circular queue comprises the error number, the first timestamp, the second timestamp and the number of times, the first timestamp is the time when the error is recorded for the first time, the second timestamp is the time when the error is recorded for the last time, and the number of times is the number of times the error occurs between the first timestamp and the second timestamp; In this step, the first timestamp, the second timestamp are the same, and the number of times is 1; Step 3, writing the error log of the error number in the buffer circular queue; Wherein, the buffer circular queue is a part of the memory space, and the format of the error log written in the buffer circular queue comprises the mapping address, the error number, the first timestamp, the second timestamp and the number of times, wherein the mapping address records the position information of the error log of the error number in the whole circular queue.

2. The method according to claim 1, wherein The writing measure of step 3 is: a) if the error number exists in the buffer circular queue, find the log entry pointing to the error number in the buffer circular queue, update the second timestamp of the error log, and increase the number of times by 1: b) if the error number does not exist in the buffer circular queue, and the buffer circular queue is full, write back the error log at the tail of the buffer circular queue to the whole circular queue, and clear the error log at the tail of the buffer circular queue, then write the new error log to the whole circular queue, and finally write the new error log to the space of the buffer circular queue just cleared; c) if the error number does not exist in the buffer circular queue, and the buffer circular queue is not full, write the new error log to the buffer circular queue.

3. The method of claim 1, wherein Further comprising: Step 4, setting a non-periodic task to be responsible for synchronizing the error log in the buffer circular queue to the whole circular queue outside the normal task execution period of the device.

4. The method of claim 1, wherein Further comprising: If the device has an unexpected power failure, use the time of power failure protection to synchronize the error log in the buffer circular queue to the whole circular queue.

5. The method of claim 1, wherein When the number of occurrences of the second type of error exceeds the threshold value in a time period, write the error log in the buffer circular queue to the whole circular queue, and clear the buffer circular queue.

6. The method of claim 1, wherein When the current pointer of the whole circular queue has pointed to the position corresponding to the mapping address in the buffer circular queue, write all the error logs in the buffer circular queue to the whole circular queue, and clear the buffer circular queue.

7. The method of claim 1, wherein, Record the number of the second type of error in the exception queue, and determine whether the error log is the second type of error by judging whether the error number exists in the exception queue.

Citation Information

Patent Citations

  • Method for storing log data and log data storage system

    CN102891873A

  • Web test method and test machine

    CN105550113A