Fault information storage method and device, equipment, medium and vehicle
By setting two pointers in the cache space, directly traversing the cache blocks that have stored fault information and updating or storing fault information, the problem of low storage efficiency in the existing technology is solved, and more efficient fault information management is achieved.
Patent Information
- Application Number
- CN202311338982.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-16
- Publication Date
- 2025-04-18
AI Technical Summary
In the prior art, fault information is stored in the cache space inefficiently and it is necessary to traverse all cache blocks to find and update fault information.
By setting two pointers, the first pointer points to the first cache block where the fault information has been stored, and the second pointer points to the first cache block that is free, so when the target fault information is received, it directly traverses the cache block where the fault information has been stored and updates or stores the fault information, avoiding traversing the free cache block.
The storage efficiency of fault information is improved, and the search and update efficiency of cache blocks is improved by reducing unnecessary traversal and comparison.
Smart Images

Figure CN119847797A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of operation and maintenance technology, and in particular, relates to a fault information storage method, device, equipment, medium and vehicle. Background Art
[0002] In the existing diagnostic event management (DEM) solution of the AUTomotive Open System Architecture (AUTOSAR), DEM supports converting fault information into cache (Primary Memory or User Defined Memory), and solidifying fault information into non-volatile memory through the correspondence between cache blocks (Memory Entry) and non-volatile memory blocks (NvM Block).
[0003] At present, the cache structure in DEM is a common structure array. Based on this, in order to store fault information in the cache space, each time the fault information is queried or updated, it is usually necessary to traverse all cache blocks in the cache space, including cache blocks that have stored fault information and free cache blocks that do not store fault information. This is because when fault information needs to be stored, the device traverses all cache blocks according to the arrangement order of the cache blocks in the cache space, and compares the fault number of the current fault information with the information number stored in the cache block during the traversal process. If the comparison is consistent, the traversal is stopped. In addition, since the cache blocks that store fault information and the free cache blocks in the cache space are fused together in disorder, the device does not know which cache block stores information. Therefore, before finding the cache block with the same number, whether the cache block is a free cache block or not, it needs to be queried and compared. Among them, the fault number taken from the free cache block may be a null value. In this way, the number of the current fault information to be stored must also be compared with the null value, resulting in low storage efficiency of fault information. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a fault information storage method, device, equipment, medium and vehicle, which can improve the storage efficiency of fault information.
[0005] In a first aspect, an embodiment of the present application provides a method for storing fault information, the method comprising:
[0006] receiving target fault information to be stored;
[0007] Starting from the cache block pointed to by the first pointer in the cache space, traverse at least one cache block that has stored fault information, and compare the fault number corresponding to the target fault information with the fault number corresponding to the fault information stored in the at least one cache block, wherein the first pointer is used to point to the first cache block that has stored fault information in the cache space;
[0008] In the case where the first cache block exists, updating the fault information stored in the first cache block according to the target fault information, wherein the fault number corresponding to the fault information stored in the first cache block is the same as the fault number corresponding to the target fault information;
[0009] In the case that the first cache block does not exist, the target fault information is stored in a second cache block pointed to by a second pointer, wherein the second pointer is used to point to a first free cache block in the cache space.
[0010] In some implementation modes, storing the target fault information in the second cache block pointed to by the second pointer includes:
[0011] Get the value of the second pointer;
[0012] When the value of the second pointer is not empty, the target fault information is stored in the second cache block pointed to by the second pointer according to the value of the second pointer.
[0013] In some implementation modes, before receiving the target fault information to be stored, the method further includes:
[0014] Obtaining the fault number corresponding to the fault information stored in the cache space;
[0015] According to the fault numbers, all cache blocks in the cache space that have stored fault information are arranged to obtain the cache space arranged according to the fault numbers.
[0016] In some implementation modes, after storing the target fault information in the second cache block pointed to by the second pointer, the method further includes:
[0017] Pointing the forward cursor of the second cache block to the third cache block, wherein the fault number corresponding to the fault information stored in the third cache block is smaller than the fault number corresponding to the target fault information;
[0018] The backward cursor of the second cache block is pointed to the fourth cache block, wherein the fault number corresponding to the fault information stored in the fourth cache block is greater than the fault number corresponding to the target fault information.
[0019] In some implementation modes, after obtaining the value of the second pointer, the method further includes:
[0020] When the value of the second pointer is empty, determining the replacement priority corresponding to the fault information stored in the cache space;
[0021] Determine, from the cache blocks in the cache space that have stored the fault information, a fifth cache block where the fault information with the highest replacement priority is located;
[0022] The fault information stored in the fifth cache block is replaced with the target fault information.
[0023] In some implementation modes, before receiving the target fault information to be stored, the method further includes:
[0024] According to the replacement priority, all cache blocks in the cache space that have stored fault information are arranged to obtain the cache space arranged according to the replacement priority.
[0025] In some implementation modes, determining the fifth cache block where the fault information with the highest replacement priority is located from the cache blocks in the cache space where the fault information has been stored includes:
[0026] When all cache blocks having stored fault information in the cache space are arranged in ascending order according to the replacement priority, the last cache block among the cache blocks having stored fault information in the cache space is determined to be the fifth cache block.
[0027] In a second aspect, an embodiment of the present application provides a fault information storage device, the device comprising:
[0028] A receiving module, used for receiving target fault information to be stored;
[0029] a traversal module, configured to traverse at least one cache block having stored fault information, starting from a cache block pointed to by a first pointer in the cache space, and compare a fault number corresponding to the target fault information with a fault number corresponding to the fault information stored in the at least one cache block, wherein the first pointer is used to point to the first cache block having stored fault information in the cache space;
[0030] an updating module, configured to update the fault information stored in the first cache block according to the target fault information if the first cache block exists, wherein the fault number corresponding to the fault information stored in the first cache block is the same as the fault number corresponding to the target fault information;
[0031] A storage module is used to store the target fault information in a second cache block pointed to by a second pointer when the first cache block does not exist, wherein the second pointer is used to point to a first free cache block in the cache space.
[0032] In a third aspect, an embodiment of the present application provides an electronic device, the electronic device comprising: a processor and a memory storing computer program instructions;
[0033] When the processor executes the computer program instructions, the steps of the fault information storage method in any one of the embodiments of the first aspect are implemented.
[0034] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, a fault information storage method provided by any one of the implementations in the first aspect is implemented.
[0035] In a fifth aspect, an embodiment of the present application provides a vehicle, the vehicle at least comprising:
[0036] The fault information storage device of the second aspect;
[0037] Such as the electronic device of the third aspect;
[0038] A computer-readable storage medium as in the fourth aspect.
[0039] In the fault information storage method, device, equipment, medium and vehicle in the embodiment of the present application, two pointers are set, namely the first pointer and the second pointer, wherein the first pointer is used to point to the first cache block in the cache space where the fault information has been stored. Therefore, when the target fault information is received, starting from the cache block pointed to by the first pointer in the cache space, at least one cache block where the fault information has been stored is traversed without traversing the free cache blocks in the cache space, so that the search efficiency of the cache block can be improved. Based on this, when the fault number corresponding to the fault information stored in the first cache block is the same as the fault number corresponding to the target fault information, the fault information stored in the first cache block is directly updated according to the target fault information, so that the storage efficiency of the fault information can be improved. In addition, since the second pointer is used to point to the first free cache block in the cache space, by storing the target fault information in the second cache block pointed to by the second pointer when the first cache block does not exist, that is, by storing the target fault information in the first free cache block in the cache space, without traversing the cache space where the cache information has been stored to find a free cache block, the cache block search efficiency can be improved, and then the storage efficiency of the fault information can be improved. In summary, through the embodiments of the present application, the storage efficiency of the fault information can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0041] Figure 1 It is a flowchart of a method for storing fault information provided in an embodiment of the present application;
[0042] Figure 2 It is a flowchart of another fault information storage method provided by an embodiment of the present application;
[0043] Figure 3 It is a structural schematic diagram of a fault information storage device provided in an embodiment of the present application;
[0044] Figure 4 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0045] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0046] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.
[0047] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the term "comprising" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprising a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0048] In addition, in the embodiments of the present application, the abbreviations and key terms are defined as follows:
[0049] AUTOSAR: AUTomotive Open System Architecture;
[0050] Dem (Diagnostic Event Manager): AUTOSAR module responsible for centralized management of reporting, caching, solidification and export of diagnostic faults;
[0051] Primary Memory: The priority cache area of the Dem module, which is the default supported cache area;
[0052] User Defined Memory: User-defined buffer area of Dem module;
[0053] NvM: AUTOSAR module responsible for managing and abstracting non-volatile memory;
[0054] ECU: Electronic Control Unit.
[0055] Based on this, in order to solve the problems of the prior art, the embodiments of the present application provide a fault information storage method, device, equipment, medium and vehicle.
[0056] The fault information storage method provided by the embodiment of the present application is described in detail below through specific embodiments and application scenarios in conjunction with the accompanying drawings.
[0057] Figure 1 FIG. 1 is a flow chart of a method for storing fault information provided by an embodiment of the present application. Figure 1 As shown, the fault information storage method may specifically include the following steps:
[0058] S110, receiving target fault information to be stored;
[0059] S120, starting from the cache block pointed to by the first pointer in the cache space, traverse at least one cache block that has stored fault information, and compare the fault number corresponding to the target fault information with the fault number corresponding to the fault information stored in the at least one cache block, wherein the first pointer is used to point to the first cache block that has stored fault information in the cache space;
[0060] S130, if the first cache block exists, updating the fault information stored in the first cache block according to the target fault information, wherein the fault number corresponding to the fault information stored in the first cache block is the same as the fault number corresponding to the target fault information;
[0061] S140. In the case where the first cache block does not exist, store the target fault information in the second cache block pointed to by the second pointer, wherein the second pointer is used to point to the first free cache block in the cache space.
[0062] Thus, since two pointers are set, namely the first pointer and the second pointer, wherein the first pointer is used to point to the first cache block in the cache space where fault information has been stored, therefore, by starting from the cache block pointed to by the first pointer in the cache space when the target fault information is received, traversing at least one cache block where fault information has been stored, without traversing the free cache blocks in the cache space, the search efficiency of the cache blocks can be improved. Based on this, by directly updating the fault information stored in the first cache block according to the target fault information when the fault number corresponding to the fault information stored in the first cache block is the same as the fault number corresponding to the target fault information, the storage efficiency of the fault information can be improved. In addition, since the second pointer is used to point to the first free cache block in the cache space, therefore, by storing the target fault information in the second cache block pointed to by the second pointer when the first cache block does not exist, that is, by storing the target fault information in the first free cache block in the cache space, without traversing the cache space where the cache information has been stored to find the free cache block, the search efficiency of the cache block can be improved, and thus the storage efficiency of the fault information can be improved. In summary, through the embodiments of the present application, the storage efficiency of fault information can be improved.
[0063] The specific implementation methods of the above steps are introduced below.
[0064] In some implementations, in S110, the target fault information to be stored may be information obtained after preprocessing the fault information reported by the fault detection module. The preprocessing may include checking the fault information reported by the fault detection module, debounce, and other processing. The target fault information to be stored may meet an enable condition and a storage condition.
[0065] In some embodiments, in S120, the storage structure in the cache space may be a static linked list. The static linked list may be a type of linear storage structure. The implementation basis of the static linked list may be a static array, and by adding a bidirectional cursor, the static linked list may take into account the advantages of both a sequential list and a linked list. The cache space (i.e., the static linked list) may include cache blocks that have stored fault information and free cache blocks. The cache space may also include a first pointer and a second pointer. Among them, the first pointer may be used to point to the first cache block that has stored fault information in the cache space. The stored fault information may be information obtained after preprocessing the fault information reported by the fault detection module. The stored fault information may also meet the enabling condition and the storage condition.
[0066] As an example, the pre-processed fault information may be stored in the cache space in the order of fault numbers from small to large, wherein one fault information may correspond to one fault number.
[0067] In addition, the second pointer can be used to point to the first free cache block in the cache space. As an example, after the DEM module is initialized, multiple cache blocks in the same cache space can be initialized to initial values, and the second pointer can point to the first cache block among the multiple cache blocks in the cache space.
[0068] Based on this, as an example, after receiving the target fault information to be stored, the cache management submodule can start from the cache block pointed to by the first pointer in the cache space, traverse at least one cache block that has stored fault information, and compare the fault number corresponding to the target fault information with the fault number corresponding to the fault information stored in at least one cache block to query whether the target fault information already exists in the storage space.
[0069] In some embodiments, in S130, the target fault information may include snapshot data, extended data, counter data and other data. The fault information stored in the cache block may also include snapshot data, extended data, counter data and other data. If the cache management submodule can query the fault number that is the same as the fault number corresponding to the target fault information from the cache space, the cache block corresponding to the fault number in the cache space can be determined as the first cache block. If there is a first cache block in the cache space, the target fault information can be stored in the first cache block. Specifically, the cache management submodule can replace the snapshot data, extended data, counter data and other data in the first cache block with the snapshot data, extended data, counter data and other data in the target fault information, so as to update the fault information stored in the first cache block according to the target fault information.
[0070] In some embodiments, in S140, if the cache management submodule does not query the fault number that is the same as the fault number corresponding to the target fault information from the cache space, the first cache block may not exist in the cache space. If the first cache block does not exist in the cache space, the target fault information may be stored in the second cache block pointed to by the second pointer. The second cache block may be the first free cache block in the cache space. That is, if the first cache block does not exist in the cache space, the target fault information may be stored in the first cache block among the free cache blocks.
[0071] Based on this, in order to improve the storage efficiency of fault information, in some embodiments, the above S140 may specifically include:
[0072] Get the value of the second pointer;
[0073] When the value of the second pointer is not empty, the target fault information is stored in the second cache block pointed to by the second pointer according to the value of the second pointer.
[0074] Here, since the second pointer can point to the second cache block, the value of the second pointer can be the second cache block. If the value of the second pointer is null, the second cache block may not exist in the cache space. If the value of the second pointer is not null, the second cache block may exist in the cache space. Since the second cache block may be the first free cache block in the cache space, if the value of the second pointer is null, there may not be a free cache block in the cache space. If the value of the second pointer is not null, there may be a free cache block in the cache space.
[0075] As an example, if the value of the second pointer is not empty, the cache management submodule may determine that the fault corresponding to the target fault information is a new fault, and then may store the target fault information in the first free cache block in the cache space.
[0076] In this way, by storing the target fault information in the first free cache block in the cache space when the value of the second pointer is not empty, without traversing the cache space to find a free cache block, the cache block search efficiency can be improved, thereby improving the storage efficiency of the fault information.
[0077] Based on this, in order to improve the efficiency of determining the first cache block, in some embodiments, before receiving the target fault information to be stored, the following may also be included:
[0078] Obtain the fault number corresponding to the fault information stored in the cache space;
[0079] According to the fault numbers, all cache blocks that have stored fault information in the cache space are arranged to obtain a cache space arranged according to the fault numbers.
[0080] Here, in the cache space, the cache blocks that have stored the fault information can be arranged randomly or according to the fault number. The cache space arranged according to the fault number can be arranged in descending order of the fault number or in ascending order of the fault number, which is not limited here.
[0081] As an example, the cache block pointed to by the first pointer may be the cache block corresponding to the largest fault number, or the cache block corresponding to the smallest fault number. If the cache block pointed to by the first pointer is the cache block corresponding to the largest fault number, and the largest fault number is smaller than the fault number corresponding to the target fault information, it is not necessary to traverse at least one cache block that has stored the fault information to determine that the first cache block does not exist in the cache space.
[0082] In this way, by arranging all cache blocks that have stored fault information in the cache space according to the fault numbers, the efficiency of determining the first cache block can be improved.
[0083] Based on this, when the storage blocks in the storage space are arranged in order of fault numbers from small to large, in order to improve the efficiency of subsequent determination of the first cache block, in some embodiments, after storing the target fault information in the second cache block pointed to by the second pointer, the following may also be included:
[0084] Pointing the forward cursor of the second cache block to the third cache block, wherein the fault number corresponding to the fault information stored in the third cache block is smaller than the fault number corresponding to the target fault information;
[0085] The backward cursor of the second cache block is pointed to the fourth cache block, wherein the fault number corresponding to the fault information stored in the fourth cache block is greater than the fault number corresponding to the target fault information.
[0086] Here, since the fault number corresponding to the fault information stored in the third cache block is smaller than the fault number corresponding to the target fault information, and the fault number corresponding to the fault information stored in the fourth cache block is larger than the fault number corresponding to the target fault information, therefore, by pointing the forward cursor of the second cache block to the third cache block and pointing the backward cursor of the second cache block to the fourth cache block, it can be ensured that the storage blocks storing the fault information are arranged in ascending order of the fault numbers, thereby improving the efficiency of subsequent determination of the first cache block.
[0087] In addition, by storing the target fault information in the second cache block and then inserting the second cache block into the cache block that has stored the fault information, the orderliness of the fault information cached in the cache space can be guaranteed after multiple rounds of fault occurrence and fault recovery, and the idle cache blocks and the cache blocks storing the fault information can be distinguished, thereby improving the management efficiency of the fault information in the cache space.
[0088] In addition, when the value of the second pointer is empty, that is, when there is no fault number in the storage space that is the same as the fault number corresponding to the target fault information, and all cache blocks in the cache space store fault information, the replacement process can be triggered. Specifically, the replacement process can be that the cache management submodule replaces the fault information in the last cache block among multiple cache blocks with the target fault information. Among them, the fault number corresponding to the last cache block can be the largest or the smallest, which is not limited here.
[0089] Based on this, in order to ensure the cache value of the fault information cached in the cache space, as another implementation method of the present application, the present application also provides another implementation method of the fault information storage method, please refer to the following embodiments for details.
[0090] See also Figure 2 Another implementation of the fault information storage method provided in the present application includes the following steps: S210-S270, which are explained in detail below.
[0091] S210: Receive target fault information to be stored.
[0092] S220. Starting from the cache block pointed to by the first pointer in the cache space, traverse at least one cache block that has stored fault information, and compare the target fault information with the fault information stored in at least one cache block, wherein the first pointer is used to point to the first cache block that has stored fault information in the cache space.
[0093] S230. If the first cache block exists, update the fault information stored in the first cache block according to the target fault information, wherein the fault number corresponding to the fault information stored in the first cache block is the same as the fault number corresponding to the target fault information.
[0094] S240. In the case where the first cache block does not exist, obtain the value of the second pointer, where the second pointer is used to point to the first free cache block in the cache space.
[0095] The value of the second pointer may be the second cache block. If the value of the second pointer is null, the second cache block may not exist in the cache space. If the value of the second pointer is not null, the second cache block may exist in the cache space. Since the second cache block may be the first free cache block in the cache space, if the value of the second pointer is null, there may not be a free cache block in the cache space. If the value of the second pointer is not null, there may be a free cache block in the cache space.
[0096] S250: When the value of the second pointer is empty, determine the replacement priority corresponding to the fault information stored in the cache space.
[0097] The replacement priority may be related to the fault type corresponding to the fault information. The replacement priority corresponding to each fault information may be predetermined. As an example, the priority corresponding to the fault information may be determined according to the fault type. The replacement priority corresponding to the fault information may be determined according to the priority corresponding to the fault information. Among them, the higher the priority corresponding to the fault information, the lower the replacement priority corresponding to the fault information may be.
[0098] As an example, when the value of the second pointer is null, that is, when there is no free cache block in the storage space, the replacement process can be triggered. That is, the fault information in a cache block is replaced with the target fault information. Before triggering the replacement process, the replacement priority corresponding to each stored fault information can be determined.
[0099] S260: Determine, from the cache blocks in the cache space that have stored the fault information, the fifth cache block where the fault information with the highest replacement priority is located.
[0100] The fifth cache block may be a cache block storing fault information with the highest replacement priority.
[0101] S270: Replace the fault information stored in the fifth cache block with the target fault information.
[0102] After the fifth cache block is determined, the replacement process can be triggered, that is, the fault information in the fifth cache block is replaced with the target fault information.
[0103] In addition, S210 to S230 are the same as S110 to S130 in the above embodiment, and for the sake of brevity, they are not described in detail here.
[0104] Therefore, by determining the fifth cache block where the fault information with the highest replacement priority is located from the cache blocks that have stored fault information in the cache space, and replacing the fault information stored in the fifth cache block with the target fault information, compared with random replacement and replacement according to fault number, it can ensure that the fault information in the cache space is fault information with a higher priority, thereby ensuring the cache value of the fault information cached in the cache space.
[0105] Based on this, in order to improve the replacement efficiency of fault information, in some embodiments, before receiving the target fault information to be stored, the following may also be included:
[0106] According to the replacement priority, all cache blocks that have stored fault information in the cache space are arranged to obtain the cache space arranged according to the replacement priority.
[0107] Here, in the cache space, the cache blocks that have stored the fault information can be arranged randomly, can be arranged according to the fault number, or can be arranged according to the replacement priority. Among them, the cache space arranged according to the replacement priority can be arranged in the order of replacement priority from large to small, or can be arranged in the order of replacement priority from small to large, which is not limited here.
[0108] Based on this, in order to improve the replacement efficiency of fault information, in some embodiments, the above S260 may specifically include:
[0109] When all cache blocks having stored fault information in the cache space are arranged in ascending order of replacement priority, the last cache block among the cache blocks having stored fault information in the cache space is determined to be the fifth cache block.
[0110] Here, if the cache blocks are arranged in ascending order of replacement priority, the last cache block may be the cache block corresponding to the fault information with the highest replacement priority.
[0111] In this way, by directly determining that the last cache block is the fifth cache block from the cache blocks that have stored fault information in the cache space, the efficiency of determining the fifth cache block can be improved, thereby improving the efficiency of replacing the fault information.
[0112] Based on this, by managing fault information based on the static linked list in the embodiment of the present application, the efficiency of DEM in managing fault information can be improved when a large number of faults occur (for example, when large-scale communications are lost).
[0113] It should be noted that the application scenarios described in the above-mentioned embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Ordinary technicians in this field can know that with the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0114] Based on the same inventive concept, the present application also provides a fault information storage device. Figure 3 Provide detailed explanation.
[0115] Figure 3 It is a structural diagram of a fault information storage device provided by an embodiment of the present application.
[0116] like Figure 3 As shown, the fault information storage device 300 may include:
[0117] A receiving module 310 is used to receive target fault information to be stored;
[0118] A traversal module 320, configured to traverse at least one cache block having stored fault information, starting from the cache block pointed to by the first pointer in the cache space, and compare the fault number corresponding to the target fault information with the fault number corresponding to the fault information stored in the at least one cache block, wherein the first pointer is used to point to the first cache block having stored fault information in the cache space;
[0119] An updating module 330, configured to update the fault information stored in the first cache block according to the target fault information if the first cache block exists, wherein the fault number corresponding to the fault information stored in the first cache block is the same as the fault number corresponding to the target fault information;
[0120] The storage module 340 is used to store the target fault information in the second cache block pointed to by the second pointer when the first cache block does not exist, wherein the second pointer is used to point to the first free cache block in the cache space.
[0121] The above-mentioned fault information storage device 300 is described in detail below, as shown below:
[0122] In some embodiments, the storage module 340 may specifically include:
[0123] An acquisition submodule, used to acquire the value of the second pointer;
[0124] The storage submodule is used to store the target fault information in the second cache block pointed to by the second pointer according to the value of the second pointer when the value of the second pointer is not empty.
[0125] In some embodiments, the fault information storage device 300 may further include:
[0126] An acquisition module, used for acquiring the fault number corresponding to the fault information stored in the cache space before receiving the target fault information to be stored;
[0127] The first arrangement module is used to arrange all cache blocks that have stored fault information in the cache space according to the fault numbers, so as to obtain the cache space arranged according to the fault numbers.
[0128] In some embodiments, the storage module 340 may specifically include:
[0129] A first pointing submodule is used to point the forward cursor of the second cache block to a third cache block after storing the target fault information in the second cache block pointed to by the second pointer, wherein the fault number corresponding to the fault information stored in the third cache block is smaller than the fault number corresponding to the target fault information;
[0130] The second pointing submodule is used to point the backward cursor of the second cache block to the fourth cache block, wherein the fault number corresponding to the fault information stored in the fourth cache block is greater than the fault number corresponding to the target fault information.
[0131] In some embodiments, the storage module 340 may further include:
[0132] A first determination submodule is used to determine the replacement priority corresponding to the fault information stored in the cache space after obtaining the value of the second pointer and when the value of the second pointer is empty;
[0133] A second determination submodule is used to determine, from the cache blocks in the cache space that have stored the fault information, the fifth cache block where the fault information with the highest replacement priority is located;
[0134] The replacement submodule is used to replace the fault information stored in the fifth cache block with the target fault information.
[0135] In some embodiments, the fault information storage device 300 may further include:
[0136] The second arrangement module is used to arrange all cache blocks that have stored fault information in the cache space according to the replacement priority before receiving the target fault information to be stored, so as to obtain the cache space arranged according to the replacement priority.
[0137] In some embodiments, the second determining submodule may specifically include:
[0138] The determination unit is used to determine the last cache block from the cache blocks that have stored fault information in the cache space as the fifth cache block when all cache blocks that have stored fault information in the cache space are arranged in ascending order of replacement priority.
[0139] Thus, since two pointers are set, namely the first pointer and the second pointer, wherein the first pointer is used to point to the first cache block in the cache space where fault information has been stored, therefore, by starting from the cache block pointed to by the first pointer in the cache space when the target fault information is received, traversing at least one cache block where fault information has been stored, without traversing the free cache blocks in the cache space, the search efficiency of the cache blocks can be improved. Based on this, by directly updating the fault information stored in the first cache block according to the target fault information when the fault number corresponding to the fault information stored in the first cache block is the same as the fault number corresponding to the target fault information, the storage efficiency of the fault information can be improved. In addition, since the second pointer is used to point to the first free cache block in the cache space, therefore, by storing the target fault information in the second cache block pointed to by the second pointer when the first cache block does not exist, that is, by storing the target fault information in the first free cache block in the cache space, without traversing the cache space where the cache information has been stored to find the free cache block, the search efficiency of the cache block can be improved, and thus the storage efficiency of the fault information can be improved. In summary, through the embodiments of the present application, the storage efficiency of fault information can be improved.
[0140] Figure 4 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application.
[0141] The electronic device 400 may include a processor 401 and a memory 402 storing computer program instructions.
[0142] Specifically, the processor 401 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0143] Memory 402 may include a large capacity memory for data or instructions. By way of example and not limitation, memory 402 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, memory 402 may include a removable or non-removable (or fixed) medium. In appropriate cases, memory 402 may be inside or outside of an integrated gateway disaster recovery device. In a specific embodiment, memory 402 is a non-volatile solid-state memory.
[0144] In certain embodiments, the memory may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical or other physical / tangible memory storage device. Thus, typically, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to one aspect of the present application.
[0145] The processor 401 implements any one of the fault information storage methods in the above embodiments by reading and executing computer program instructions stored in the memory 402 .
[0146] In some examples, the electronic device 400 may further include a communication interface 403 and a bus 410. Figure 4 As shown, the processor 401, the memory 402, and the communication interface 403 are connected via a bus 410 and communicate with each other.
[0147] The communication interface 403 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.
[0148] Bus 410 includes hardware, software or both, and the components of online data flow billing equipment are coupled to each other. For example, but not limitation, bus 410 may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front-end bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 410 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the present application considers any suitable bus or interconnection.
[0149] Exemplarily, the electronic device 400 may be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA).
[0150] The electronic device 400 can execute the fault information storage method in the embodiment of the present application, thereby realizing the combination Figures 1 to 3 Described is a method and device for storing fault information.
[0151] In addition, in combination with the fault information storage method in the above embodiment, the embodiment of the present application may provide a computer-readable storage medium for implementation. The computer-readable storage medium stores computer program instructions; when the computer program instructions are executed by the processor, any one of the fault information storage methods in the above embodiment is implemented. Examples of computer-readable storage media include non-transitory computer-readable storage media, such as portable disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, etc.
[0152] An embodiment of the present application also provides a computer program product. When instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the fault information storage method provided in the embodiment of the present application.
[0153] A vehicle is also provided in an embodiment of the present application, which may include at least one of a power battery charging device, an electronic device, and a computer storage medium. The specific fault information storage device, electronic device, and computer storage medium involved are consistent with the above description and will not be repeated here.
[0154] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.
[0155] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.
[0156] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.
[0157] The above reference is according to the method of the embodiment of the present application, the flow chart of the device (system) and the computer program product and / or the block diagram described various aspects of the present application.It should be understood that each square box in the flow chart and / or the block diagram and the combination of each square box in the flow chart and / or the block diagram can be realized by computer program instructions.These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the realization of the function / action specified in one or more square boxes of the flow chart and / or the block diagram.Such a processor can be but is not limited to a general-purpose processor, a special-purpose processor, a special application processor or a field programmable logic circuit.It can also be understood that each square box in the block diagram and / or the flow chart and the combination of the square boxes in the block diagram and / or the flow chart can also be realized by the dedicated hardware that performs the specified function or action, or can be realized by the combination of dedicated hardware and computer instructions.
[0158] The above is only a specific implementation of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.
Claims
1. A method for storing fault information, characterized in that: include: receiving target fault information to be stored; Starting from the cache block pointed to by the first pointer in the cache space, traverse at least one cache block that has stored fault information, and compare the fault number corresponding to the target fault information with the fault number corresponding to the fault information stored in the at least one cache block, wherein the first pointer is used to point to the first cache block that has stored fault information in the cache space; In the case where the first cache block exists, updating the fault information stored in the first cache block according to the target fault information, wherein the fault number corresponding to the fault information stored in the first cache block is the same as the fault number corresponding to the target fault information; In the case that the first cache block does not exist, the target fault information is stored in a second cache block pointed to by a second pointer, wherein the second pointer is used to point to a first free cache block in the cache space.
2. The method according to claim 1, characterized in that The step of storing the target fault information in the second cache block pointed to by the second pointer includes: Get the value of the second pointer; When the value of the second pointer is not empty, the target fault information is stored in the second cache block pointed to by the second pointer according to the value of the second pointer.
3. The method according to claim 2, characterized in that After obtaining the value of the second pointer, the method further includes: When the value of the second pointer is empty, determining the replacement priority corresponding to the fault information stored in the cache space; Determine, from the cache blocks in the cache space that have stored the fault information, a fifth cache block where the fault information with the highest replacement priority is located; The fault information stored in the fifth cache block is replaced with the target fault information.
4. The method according to claim 1 or 2, characterized in that: Before receiving the target fault information to be stored, the method further includes: Obtaining the fault number corresponding to the fault information stored in the cache space; According to the fault numbers, all cache blocks in the cache space that have stored fault information are arranged to obtain the cache space arranged according to the fault numbers.
5. The method according to claim 4, characterized in that After storing the target fault information in the second cache block pointed to by the second pointer, the method further includes: Pointing the forward cursor of the second cache block to the third cache block, wherein the fault number corresponding to the fault information stored in the third cache block is smaller than the fault number corresponding to the target fault information; The backward cursor of the second cache block is pointed to the fourth cache block, wherein the fault number corresponding to the fault information stored in the fourth cache block is greater than the fault number corresponding to the target fault information.
6. The method according to claim 5, characterized in that Before receiving the target fault information to be stored, the method further includes: According to the replacement priority, all cache blocks in the cache space that have stored fault information are arranged to obtain the cache space arranged according to the replacement priority.
7. The method according to claim 6, characterized in that The step of determining, from the cache blocks in the cache space that have stored the fault information, the fifth cache block where the fault information with the highest replacement priority is located comprises: When all cache blocks having stored fault information in the cache space are arranged in ascending order according to the replacement priority, the last cache block among the cache blocks having stored fault information in the cache space is determined to be the fifth cache block.
8. A fault information storage device, characterized in that: include: A receiving module, used for receiving target fault information to be stored; a traversal module, configured to traverse at least one cache block having stored fault information, starting from a cache block pointed to by a first pointer in the cache space, and compare a fault number corresponding to the target fault information with a fault number corresponding to the fault information stored in the at least one cache block, wherein the first pointer is used to point to the first cache block having stored fault information in the cache space; an updating module, configured to update the fault information stored in the first cache block according to the target fault information if the first cache block exists, wherein the fault number corresponding to the fault information stored in the first cache block is the same as the fault number corresponding to the target fault information; A storage module is used to store the target fault information in a second cache block pointed to by a second pointer when the first cache block does not exist, wherein the second pointer is used to point to a first free cache block in the cache space.
9. An electronic device, characterized in that: The electronic device comprises: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, the steps of the fault information storage method according to any one of claims 1 to 7 are implemented.
10. A vehicle, characterized in that: Include at least one of the following: The fault information storage device according to claim 8; The electronic device as claimed in claim 9.