WO2021043212A1 - Log data storage method, electronic device and storage medium - Google Patents

Log data storage method, electronic device and storage medium Download PDF

Info

Publication number
WO2021043212A1
WO2021043212A1 PCT/CN2020/113253 CN2020113253W WO2021043212A1 WO 2021043212 A1 WO2021043212 A1 WO 2021043212A1 CN 2020113253 W CN2020113253 W CN 2020113253W WO 2021043212 A1 WO2021043212 A1 WO 2021043212A1
Authority
WO
WIPO (PCT)
Prior art keywords
log data
data
storage
address
block
Prior art date
Application number
PCT/CN2020/113253
Other languages
French (fr)
Chinese (zh)
Inventor
邹佳池
Original Assignee
深圳市道通智能航空技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市道通智能航空技术有限公司 filed Critical 深圳市道通智能航空技术有限公司
Publication of WO2021043212A1 publication Critical patent/WO2021043212A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/06Addressing a physical block of locations, e.g. base addressing, module addressing, memory dedication
    • GPHYSICS
    • G07CHECKING-DEVICES
    • G07CTIME OR ATTENDANCE REGISTERS; REGISTERING OR INDICATING THE WORKING OF MACHINES; GENERATING RANDOM NUMBERS; VOTING OR LOTTERY APPARATUS; ARRANGEMENTS, SYSTEMS OR APPARATUS FOR CHECKING NOT PROVIDED FOR ELSEWHERE
    • G07C5/00Registering or indicating the working of vehicles
    • G07C5/08Registering or indicating performance data other than driving, working, idle, or waiting time, with or without registering driving, working, idle or waiting time
    • G07C5/0841Registering performance data

Definitions

  • This application relates to the field of data processing, and in particular to a storage method, electronic equipment and storage medium of log data.
  • the flight log is an indispensable part of the flight control system. It not only provides developers with means of debugging and simulation during the development phase, but also provides functions similar to the aircraft "black box" for the future productization phase. In the event of an accident, you can understand the cause of the accident by viewing the flight log data.
  • the flight control system needs to have a fairly high control accuracy.
  • the execution cycle of the system is relatively fast (usually in the microsecond level), and a large amount of flight data will be generated in a short time.
  • a common method for recording flight logs is to periodically write all log data that needs to be recorded into a memory, such as an SD card, Fash, etc. And this will cause two problems:
  • the purpose of the present invention is to provide a log data storage method, electronic equipment and storage medium.
  • the present invention provides a log data storage method, including:
  • Acquiring log data and a write identifier in a preset cache area where the preset cache area includes a plurality of storage blocks, and the write identifier includes a write block address and a write start address;
  • the data in the storage block corresponding to the read block address is stored in the memory.
  • the method before storing the data in the storage block corresponding to the read block address into the memory, the method further includes:
  • the data in the storage block corresponding to the read block address is stored in the memory.
  • the judging whether there is a data block to be read specifically includes:
  • the method further includes:
  • the read block address is updated to the address of the next storage block according to the preset arrangement sequence.
  • the method further includes:
  • the write end address after the log data is written and the address of the memory block where the write end address is located are assigned to the write start address and the write block address, respectively.
  • the method further includes:
  • the writing of the log data into the preset buffer area starting from the storage block corresponding to the writing block address and the writing start address specifically includes:
  • the content of the log data includes a log header and a data packet
  • the log data is a log header
  • the data packet is written into the preset buffer area according to a preset cycle according to the writing identifier.
  • the method further includes:
  • the preset cache area is allocated, the preset cache area includes a plurality of storage blocks, and the size of the storage block is the same as the storage block size of the memory.
  • the present invention also provides an electronic device that includes a processor and a memory, the memory stores a log data storage program, the computer-readable program is configured to be executed by the processor, and the log data storage program When executed by the processor, the above-mentioned method is realized.
  • the present invention also provides a computer-readable storage medium on which a storage program of log data is stored, characterized in that the storage program of log data is executed by a processor to implement the above-mentioned method.
  • the present invention has the beneficial effect that by acquiring the log data and the write identifier of the preset cache area, the log data is first written into the pre-recorded data from the storage block corresponding to the write block address and the write start address.
  • the data in the storage block corresponding to the read block address is stored in the memory according to the read block address, so that the log data is written into the cache area in real time, and then the entire block is read into the memory to improve the log
  • the efficiency of data storage to the memory ensures that the address written by the memory is block-aligned and improves the throughput of data writing.
  • FIG. 1 is a flowchart of a method for storing log data provided by the first embodiment of the present invention
  • FIG. 2 is a schematic diagram of log data provided by an embodiment of the present invention.
  • FIG. 3 is a schematic diagram of a cache area provided by an embodiment of the present invention.
  • Fig. 5 is an internal structure diagram of an electronic device provided by an embodiment of the present invention.
  • the log data storage method provided by the embodiment of the present invention is applied to a drone, and the method includes:
  • Step S101 Obtain log data and a write identifier in a preset cache area, where the preset cache area includes a number of storage blocks, and the write identifier includes a write block address and a write start address.
  • log data is generated during the flight of the drone.
  • the log data includes a log header and at least one data packet.
  • the log header contains data packet information corresponding to each data packet, and each data packet corresponds to a unique Packet ID.
  • the data package information includes the data package ID of the corresponding data package, the data package name and the item list.
  • the item list includes the item name, data type, and data dimension corresponding to each item.
  • the preset cache area is a storage area in the memory. Before log data is recorded, the preset cache area is first allocated in the memory. As shown in FIG. 3, the preset cache area includes a number of storage blocks 10, and the size of the storage block 10 is the same as the size of the storage block of the memory. For example, the size of the storage block of the memory is 4K, the size of the storage block in the preset cache area is also 4K, and the preset cache area includes 5 storage blocks with a size of 20K.
  • Each storage block corresponds to an address
  • the writing block address is the address of the storage block in the preset cache area
  • the writing start position is the address of the writing position in the storage block.
  • Step S102 starting from the storage block corresponding to the writing block address and the writing start address, writing the log data into the preset buffer area.
  • the drone when the drone generates log data, it first writes the log data into the preset buffer area in the form of data packets from the write start address according to the storage block corresponding to the write block address and the write start address.
  • the data packet information further includes a log data update frequency.
  • the user obtains the update frequency of the log data by analyzing the log header, and the write cycle of the data packet can be set by the update frequency. Since the traditional log writing method is generally written in a fixed period, for example, the set period is 1ms, but the update frequency of some data is low, for example, 1s. If data is written in the set period, redundancy will occur. I data. In this application, by acquiring the data update frequency in the log header, and setting the data writing period according to the update frequency, different writing periods can be set for log data with different update frequencies, thereby reducing redundant log information.
  • the write cycle can also be set to a fixed cycle according to the update frequency of the log data.
  • the shaded area in the figure is the area where data has been stored, and the blank area is the area where data is not stored.
  • the write block address as head and the write start address as index.
  • the initial values of head and index are both If it is 0, the processor calculates the corresponding storage block according to the obtained head value, and writes the log data from the position corresponding to the index.
  • the write end address after the log data is written and the address of the memory block where the write end address is located are respectively assigned to the write start Address and write block address. For example, after the current storage block is full, the head is updated to the address of the next storage block. After the current data packet is written, head is the address of the storage block where the write end address is located. After the writing of the current data packet is completed, the current writing end position is assigned to index for the next call. When the last storage block is full, write data again from the first storage block.
  • Step S103 Obtain the read block address in the preset cache area.
  • the read block address is the address of the storage block in the preset cache area.
  • Step S104 Store the data in the storage block corresponding to the read block address in the memory.
  • judging whether there is a data block to be read specifically includes: judging whether the read block address and the write block address are the same, if the read block address and the write block address are different, then there is a data block to be read, if the block is read If the address is the same as the write block address, there is no data block to be read. For example, it is judged whether the head and tail are the same. If they are different, there is a data block to be read. If they are the same, there is no data block to be read. That is, if the current storage block in the preset cache area is not full, it cannot The log data of the current storage block is stored in the memory. After the current storage block is full, the data of the storage block corresponding to the read block address is stored in the memory, and the corresponding storage block is cleared at the same time. Therefore, the data is always Stored in units of storage blocks.
  • the read block address is updated to the address of the next storage block according to the preset arrangement sequence.
  • the preset arrangement order is the arrangement order of the storage blocks.
  • the read block address is updated to the address of the next adjacent storage block for the next call. Because the process of writing log data into the preset buffer area is circular writing, the process of storing log data in the memory is also circular storage, that is, after the data in the last storage block is fully stored in the memory, it starts to store in the first storage block The data.
  • the writing task has been waiting for the response from the storage device, and the response is received to indicate that the writing is complete, and this period of time is the longest time in the data writing process of.
  • the traditional log writing method generally writes data directly in the current thread that needs to write data. If the current thread is a high-priority task, while waiting for the memory response, the lower-priority tasks cannot be executed. Destroy the real-time nature of the system.
  • the log data writing task is set as a low-priority task, and the processor's task processing adopts a multithreading mechanism. While waiting for the memory response, the writing task is suspended so that it can be High-priority tasks preempt, thereby ensuring the real-time performance of the system.
  • step S104 before storing the data block in the memory, it is determined whether the current log data is all written into the preset cache area, if not, step S104 is executed; if so, the data in the preset cache area All unstored data is stored in the memory, that is, if logging data is stopped, all data remaining in the preset buffer area is stored in the memory at once.
  • the current log data are all written into the preset buffer area.
  • the current log data is all written into the preset cache area, there are one or more storage blocks currently to be read, and the data in all read storage blocks in the preset cache area are stored in the memory at one time. Waiting to read the next log data.
  • the log data storage method provided in the above embodiment first writes log data into a preset buffer area according to the write block address and the write start address, and then reads the corresponding block address in the buffer area according to the read block address.
  • the data in the storage block is stored in the memory, thereby realizing the whole block storage of log data, improving data storage efficiency, increasing the throughput of data writing, and ensuring the real-time nature of system processing tasks.
  • the log data storage method provided by the second embodiment of the present invention differs from the first embodiment in that the method further includes:
  • Step S201 Determine the content of the log data.
  • the content of the log data includes a log header and a data packet; if the log data is a log header, step S202 is executed; if the log data is a data packet, step S203 is executed.
  • Step S202 Write the log header into the preset buffer area according to the write identifier.
  • Step S203 Write the data packet into the preset buffer area according to the preset cycle according to the write identifier.
  • a log header is first generated. If the acquired data is a log header, when the complete log header is obtained, the log header is written into the preset cache area. By parsing the log header, the information update frequency is obtained, and the write cycle of the data packet is set according to the information update frequency.
  • the data packet is written into the preset buffer area according to the set write cycle . For example, the time when the write function is called is set by the information update frequency, and the write function writes data according to the set calling time.
  • the log header is written into the preset buffer area, and if the acquired data is a data packet, the data packet is written into the preset buffer area according to the set period , which can reduce redundant log information.
  • FIG. 5 is an internal structure diagram of the electronic device provided by the present invention.
  • the electronic device may be a PC (Personal Computer, personal computer), or a terminal device such as a smart phone, a tablet computer, or a portable computer.
  • the electronic device includes at least a memory 11, a processor 12, a communication bus 13, and a network interface 14.
  • the memory 11 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, and the like.
  • the memory 11 may be an internal storage unit of an electronic device, such as a hard disk of the electronic device.
  • the memory 11 may also be an external storage device of the electronic device, such as a plug-in hard disk, a smart media card (SMC), and a secure digital (SD) card equipped on the electronic device. Flash Card, etc.
  • the memory 11 may also include both an internal storage unit of an electronic device and an external storage device.
  • the memory 11 can be used not only to store application software and various data installed in the electronic device, such as the code of the log data storage method program 01, etc., but also to temporarily store data that has been output or will be output.
  • the processor 12 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip, for running program codes or processing stored in the memory 11 Data, such as the storage method program 01 of the execution log data, etc.
  • CPU central processing unit
  • controller microcontroller
  • microprocessor or other data processing chip, for running program codes or processing stored in the memory 11 Data, such as the storage method program 01 of the execution log data, etc.
  • the bus 13 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus.
  • PCI peripheral component interconnect
  • EISA extended industry standard architecture
  • the bus can be divided into address bus, data bus, control bus and so on. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
  • the electronic device may also include a network interface 14.
  • the network interface 14 may optionally include a wired interface and/or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is usually used to connect the electronic device to other electronic devices. Establish a communication connection between.
  • Figure 5 only shows an electronic device with components 11-14 and log data storage method program 01. Those skilled in the art can understand that the structure shown in Figure 5 does not constitute a limitation on the electronic device, and may include comparisons. Fewer or more parts are shown, or some parts are combined, or different parts are arranged.
  • the present invention can be implemented by means of software plus a necessary general hardware platform. Based on this understanding, the technical solution of the present invention can be embodied in the form of a software product in essence or a part that contributes to the existing technology.
  • the present invention also relates to a computer-readable storage medium, such as ROM/RAM, magnetic disk, optical disc, etc., on which a computer program is stored, and the method for storing log data is realized when the computer program is executed by a processor.
  • sequence numbers of the above-mentioned embodiments of the present invention are only for description, and do not represent the superiority of the embodiments.
  • the terms “include”, “include” or any other variants thereof in this article are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements not only includes those elements, but also includes those elements that are not explicitly included.
  • the other elements listed may also include elements inherent to the process, device, article, or method. If there are no more restrictions, the element defined by the sentence "including a" does not exclude the existence of other identical elements in the process, device, article, or method that includes the element.
  • the present invention can be implemented by means of software plus a necessary general hardware platform. Based on this understanding, the technical solution of the present invention can be embodied in the form of a software product in essence or a part that contributes to the existing technology.
  • the present invention also relates to a computer-readable storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., on which a computer program is stored, and the computer program is executed by a processor to realize the above method.

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Debugging And Monitoring (AREA)

Abstract

Disclosed is a log data storage method. The method comprises: acquiring log data and a write identifier in a preset cache region, wherein the preset cache region comprises a plurality of storage blocks, and the write identifier comprises a write block address and a write start address; starting from the write start address, writing the log data from the storage block corresponding to the write block address into the preset cache region; acquiring a read block address in the preset cache region; and storing, in a memory, data in the storage block corresponding to the read block address. Further disclosed are an electronic device and a storage medium. In the present invention, log data is written into a cache region in real time, and is then read, as a whole block, into a memory, thereby improving the efficiency of storing the log data in the memory and increasing the throughput of data writing.

Description

一种日志数据的存储方法、电子设备及存储介质Log data storage method, electronic equipment and storage medium
本申请要求于2019年9月3日提交中国专利局、申请号为201910829352.0、申请名称为“一种日志数据的存储方法、电子设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office on September 3, 2019, the application number is 201910829352.0, and the application name is "a method for storing log data, electronic equipment and storage medium", and the entire content of the application is approved The reference is incorporated in this application.
技术领域Technical field
本申请涉及数据处理领域,尤其涉及一种日志数据的存储方法、电子设备及存储介质。This application relates to the field of data processing, and in particular to a storage method, electronic equipment and storage medium of log data.
背景技术Background technique
飞行日志是飞控系统里面不可或缺的一部分,其不仅在开发阶段为开发人员提供了调试和仿真的手段,也为日后产品化阶段提供了类似飞机“黑盒子”的功能,在发生重大安全事故时,可以通过查看飞行日志数据了解事故原因。The flight log is an indispensable part of the flight control system. It not only provides developers with means of debugging and simulation during the development phase, but also provides functions similar to the aircraft "black box" for the future productization phase. In the event of an accident, you can understand the cause of the accident by viewing the flight log data.
飞控系统需要有相当高的控制精度,系统的执行周期一都比较快(一般为微秒级),短时间内就会产生大量的飞行数据。目前普遍的记录飞行日志的方法是将所有需要记录的日志数据周期性地写入存储器,如SD卡,F l ash等。而这将导致两个问题:The flight control system needs to have a fairly high control accuracy. The execution cycle of the system is relatively fast (usually in the microsecond level), and a large amount of flight data will be generated in a short time. Currently, a common method for recording flight logs is to periodically write all log data that needs to be recorded into a memory, such as an SD card, Fash, etc. And this will cause two problems:
由于日志数据是零碎地写入,而不是整块写入,将导致数据写入存储器的速度大大降低,从而降低了总的日志记录数据的吞吐量。Since the log data is written in pieces, rather than in a whole block, the speed at which the data is written into the memory is greatly reduced, thereby reducing the throughput of the total log record data.
发明内容Summary of the invention
为了克服现有技术中日志数据记录方法写入存储器的速度低、影响系统实时性的问题,本发明的目的在于提供一种日志数据的存储方法、电子设备及存储介质。In order to overcome the problem that the log data recording method in the prior art has a low writing speed to the memory and affects the real-time performance of the system, the purpose of the present invention is to provide a log data storage method, electronic equipment and storage medium.
为了实现上述目的,本发明提供一种日志数据的存储方法,包括:In order to achieve the above objective, the present invention provides a log data storage method, including:
获取日志数据和预设缓存区域中的写入标识,所述预设缓存区域包括若干存储块,所述写入标识包括写入块地址和写入起始地址;Acquiring log data and a write identifier in a preset cache area, where the preset cache area includes a plurality of storage blocks, and the write identifier includes a write block address and a write start address;
从所述写入块地址对应的存储块、所述写入起始地址开始将所述日志数据写入所述预设缓存区域中;Writing the log data into the preset buffer area starting from the storage block corresponding to the writing block address and the writing start address;
获取所述预设缓存区域中的读取块地址;Acquiring the read block address in the preset cache area;
将所述读取块地址对应的存储块内的数据存储至存储器中。The data in the storage block corresponding to the read block address is stored in the memory.
进一步地,所述将所述读取块地址对应的存储块内的数据存储至存储器中之前,所述方法还包括:Further, before storing the data in the storage block corresponding to the read block address into the memory, the method further includes:
判断是否存在待存储的存储块;Determine whether there is a storage block to be stored;
若存在待存储的存储块,将所述读取块地址对应的存储块内的数据存储至存储器中。If there is a storage block to be stored, the data in the storage block corresponding to the read block address is stored in the memory.
进一步地,所述判断是否存在待读取数据块,具体包括:Further, the judging whether there is a data block to be read specifically includes:
判断所述读取块地址和所述写入块地址是否相同;Judging whether the read block address and the write block address are the same;
若所述读取块地址和所述写入块地址不同,则存在待读取数据块。If the read block address and the write block address are different, there is a data block to be read.
进一步地,所述将所述读取块地址对应的存储块内的数据存储至存储器中之后,所述方法还包括:Further, after storing the data in the storage block corresponding to the read block address in the memory, the method further includes:
按照预设排列顺序将所述读取块地址更新为下一个所述存储块的地址。The read block address is updated to the address of the next storage block according to the preset arrangement sequence.
进一步地,从所述写入块地址对应的存储块、所述写入起始地址开始将所述日志数据写入所述预设缓存区域中之后,所述方法还包括:Further, after the log data is written into the preset buffer area from the storage block corresponding to the write block address and the write start address, the method further includes:
将日志数据写入后的写入结束地址和所述写入结束地址所在的存储块的地址分别赋值给所述写入起始地址和写入块地址。The write end address after the log data is written and the address of the memory block where the write end address is located are assigned to the write start address and the write block address, respectively.
进一步地,所述方法还包括:Further, the method further includes:
判断当前日志数据是否全部写入所述预设缓存区域中;Judging whether the current log data is all written into the preset buffer area;
若否,将所述读取块地址对应的存储块内的数据存储至存储器中;If not, store the data in the storage block corresponding to the read block address in the memory;
若是,将所述预设缓存区域中的所有未存储的数据存储至所述存储器中。If yes, store all unstored data in the preset cache area into the memory.
进一步地,所述从所述写入块地址对应的存储块、所述写入起始地址开始将所述日志数据写入所述预设缓存区域中,具体包括:Further, the writing of the log data into the preset buffer area starting from the storage block corresponding to the writing block address and the writing start address specifically includes:
判断所述日志数据的内容,所述日志数据的内容包括日志头和数据包;Judging the content of the log data, the content of the log data includes a log header and a data packet;
若所述日志数据为日志头,根据所述写入标识将所述日志头写入所述预设缓存区域中;If the log data is a log header, write the log header into the preset buffer area according to the write identifier;
若所述日志数据为数据包,根据所述写入标识将所述数据包按照预设周期写入所述预设缓存区域中。If the log data is a data packet, the data packet is written into the preset buffer area according to a preset cycle according to the writing identifier.
进一步地,所述获取日志数据和预设缓存区域中的写入标识之前,所述方法还包括:Further, before the obtaining the log data and the writing identifier in the preset cache area, the method further includes:
分配所述预设缓存区域,所述预设缓存区域包括若干存储块,所述存储块的大小与所述存储器的存储块大小相同。The preset cache area is allocated, the preset cache area includes a plurality of storage blocks, and the size of the storage block is the same as the storage block size of the memory.
本发明还提供一种电子设备,包括处理器和存储器,所述存储器中存储有日志数据的存储程序,所述计算机可读程序被配置成由所述处理器执行,所述日志数据的存储程序被所述处理器执行时实现上述的方法。The present invention also provides an electronic device that includes a processor and a memory, the memory stores a log data storage program, the computer-readable program is configured to be executed by the processor, and the log data storage program When executed by the processor, the above-mentioned method is realized.
本发明还提供一种计算机可读存储介质,其上存储有日志数据的存储程序,其特征在于,所述日志数据的存储程序被处理器执行时实现上述的方法。The present invention also provides a computer-readable storage medium on which a storage program of log data is stored, characterized in that the storage program of log data is executed by a processor to implement the above-mentioned method.
相比现有技术,本发明的有益效果在于:通过获取日志数据和预设缓存区域的写入标识,从写入块地址对应的存储块、写入起始地址开始将日志数据先写入预设缓存区域中,再根据读取块地址将读取块地址对应的存储块内的数据存储至存储器中,从而将日志数据实时写入缓存区域中,再整块读取到存储器中,提高日志数据存储至存储器的效率,保证存储器写入的地址为块对齐,提高数据写入的吞吐量。Compared with the prior art, the present invention has the beneficial effect that by acquiring the log data and the write identifier of the preset cache area, the log data is first written into the pre-recorded data from the storage block corresponding to the write block address and the write start address. In the cache area, the data in the storage block corresponding to the read block address is stored in the memory according to the read block address, so that the log data is written into the cache area in real time, and then the entire block is read into the memory to improve the log The efficiency of data storage to the memory ensures that the address written by the memory is block-aligned and improves the throughput of data writing.
附图说明Description of the drawings
图1为本发明第一实施例提供的日志数据的存储方法流程图;FIG. 1 is a flowchart of a method for storing log data provided by the first embodiment of the present invention;
图2为本发明实施例提供的日志数据示意图;2 is a schematic diagram of log data provided by an embodiment of the present invention;
图3为本发明实施例提供的缓存区域的示意图;FIG. 3 is a schematic diagram of a cache area provided by an embodiment of the present invention;
图4为本发明第二实施例提供的日志数据的存储方法流程图;4 is a flowchart of a method for storing log data provided by the second embodiment of the present invention;
图5为本发明实施例提供的电子设备的内部结构图。Fig. 5 is an internal structure diagram of an electronic device provided by an embodiment of the present invention.
具体实施方式detailed description
下面,结合附图以及具体实施方式,对本发明做进一步描述,需要说明的是,在不相冲突的前提下,以下描述的各实施例之间或各技术特征之间可以任意组合形成新的实施例。In the following, the present invention will be further described with reference to the drawings and specific implementations. It should be noted that, provided that there is no conflict, the following embodiments or technical features can be combined to form new embodiments. .
如图1所示,本发明实施例提供的日志数据的存储方法,应用于无人机中,方法包括:As shown in Figure 1, the log data storage method provided by the embodiment of the present invention is applied to a drone, and the method includes:
步骤S101:获取日志数据和预设缓存区域中的写入标识,所述预设缓存区域包括若干存储块,所述写入标识包括写入块地址和写入起始地址。Step S101: Obtain log data and a write identifier in a preset cache area, where the preset cache area includes a number of storage blocks, and the write identifier includes a write block address and a write start address.
其中,无人机飞行过程中产生日志数据,如图2所示,日志数据包括日志头和至少一数据包,日志头包含了每一数据包对应的数据包信息,每一数据包对应一唯一数据包ID。数据包信息包括对应数据包的数据包ID,数据包名称和条目列表。条目列表包括每一条目对应的条目名称、数据类型和数据维度。通过解析日志头,就能得出飞行日志中的数据包,及各个数据包中包含的条目列表。即通过读取日志头的数据包信息,就可以完整解析每个数据包的信息。Among them, log data is generated during the flight of the drone. As shown in Figure 2, the log data includes a log header and at least one data packet. The log header contains data packet information corresponding to each data packet, and each data packet corresponds to a unique Packet ID. The data package information includes the data package ID of the corresponding data package, the data package name and the item list. The item list includes the item name, data type, and data dimension corresponding to each item. By parsing the log header, the data packets in the flight log and the list of entries contained in each data packet can be obtained. That is, by reading the packet information in the log header, the information of each packet can be completely analyzed.
预设缓存区域是内存中的存储区域,在日志数据记录之前,首先在内存中分配出预设缓存区域。如图3所示,预设缓存区域包括若干存储块10,存储块10的大小与存储器的存储块的大小相同。例如,存储器的存储块的大小为4K,预设缓存区域中的存储块的大小也为4K,预设缓存区域包括5个存储块,大小为20K。每个存储块对应一个地址,写入块地址为预设缓存区域中存储块的地址,写入起始位置为存储块中写入位置的地址。The preset cache area is a storage area in the memory. Before log data is recorded, the preset cache area is first allocated in the memory. As shown in FIG. 3, the preset cache area includes a number of storage blocks 10, and the size of the storage block 10 is the same as the size of the storage block of the memory. For example, the size of the storage block of the memory is 4K, the size of the storage block in the preset cache area is also 4K, and the preset cache area includes 5 storage blocks with a size of 20K. Each storage block corresponds to an address, the writing block address is the address of the storage block in the preset cache area, and the writing start position is the address of the writing position in the storage block.
步骤S102:从所述写入块地址对应的存储块、所述写入起始地址开始将所述日志数据写入所述预设缓存区域中。Step S102: starting from the storage block corresponding to the writing block address and the writing start address, writing the log data into the preset buffer area.
具体的,无人机产生日志数据时,首先根据写入块地址对应的存储块和写入起始地址将日志数据从写入起始地址开始以数据包的形式写入预设缓存区域中。Specifically, when the drone generates log data, it first writes the log data into the preset buffer area in the form of data packets from the write start address according to the storage block corresponding to the write block address and the write start address.
在一种实施方式中,数据包信息还包括日志数据更新频率,用户通过解析日志头,获取日志数据的更新频率,通过更新频率可以设定数据包的写入周期。由于传统的日志写入方式一般是固定周期写入,例如,设定周期为1ms,但有些数据的更新频率较低,例如为1s,若仍然按照设定周期进行数据写入,就 会产生冗余数据。本申请中,通过获取日志头中的数据更新频率,根据更新频率设定数据写入周期,从而可以为不同更新频率的日志数据设定不同的写入周期,从而可以减少冗余日志信息。In an embodiment, the data packet information further includes a log data update frequency. The user obtains the update frequency of the log data by analyzing the log header, and the write cycle of the data packet can be set by the update frequency. Since the traditional log writing method is generally written in a fixed period, for example, the set period is 1ms, but the update frequency of some data is low, for example, 1s. If data is written in the set period, redundancy will occur. I data. In this application, by acquiring the data update frequency in the log header, and setting the data writing period according to the update frequency, different writing periods can be set for log data with different update frequencies, thereby reducing redundant log information.
需要说明的是,也可以根据日志数据的更新频率将写入周期设定为固定周期。It should be noted that the write cycle can also be set to a fixed cycle according to the update frequency of the log data.
例如,请参照图3,图中阴影区域为已经存储数据的区域,空白区域为未存储数据的区域,定义写入块地址为head,写入起始地址为index,head和index的初始值均为0,处理器根据获取到的head的数值计算出对应的存储块,将日志数据从index对应的位置处开始写入。For example, please refer to Figure 3. The shaded area in the figure is the area where data has been stored, and the blank area is the area where data is not stored. Define the write block address as head and the write start address as index. The initial values of head and index are both If it is 0, the processor calculates the corresponding storage block according to the obtained head value, and writes the log data from the position corresponding to the index.
在一种实施方式中,日志数据写入预设缓存区域后,将日志数据写入后的写入结束地址和所述写入结束地址所在的存储块的地址分别赋值给所述写入起始地址和写入块地址。例如,当前存储块写满后,将head更新为下一个存储块的地址,当前数据包写入完成后,head为写入结束地址所在的存储块的地址。当前数据包写入完成后,将当前的写入结束位置赋值给index,以供下一次调用。当最后一个存储块写满后,再次将数据从第一个存储块开始写入。In one embodiment, after the log data is written into the preset buffer area, the write end address after the log data is written and the address of the memory block where the write end address is located are respectively assigned to the write start Address and write block address. For example, after the current storage block is full, the head is updated to the address of the next storage block. After the current data packet is written, head is the address of the storage block where the write end address is located. After the writing of the current data packet is completed, the current writing end position is assigned to index for the next call. When the last storage block is full, write data again from the first storage block.
步骤S103:获取所述预设缓存区域中的读取块地址。Step S103: Obtain the read block address in the preset cache area.
其中,读取块地址为预设缓存区域中存储块的地址。Wherein, the read block address is the address of the storage block in the preset cache area.
步骤S104:将所述读取块地址对应的存储块内的数据存储至存储器中。Step S104: Store the data in the storage block corresponding to the read block address in the memory.
在一种实施方式中,首先判断是否存在待存储的存储块,若存在待存储的存储块,则将读取块地址对应的存储块内的数据存储至存储器中,若不存在待存储的存储块,则不进行数据读取。In one embodiment, it is first determined whether there is a storage block to be stored. If there is a storage block to be stored, the data in the storage block corresponding to the read block address is stored in the memory. If there is no storage block to be stored, Block, no data is read.
其中,判断是否存在待读取数据块具体包括:判断读取块地址和写入块地址是否相同,若读取块地址和写入块地址不同,则存在待读取数据块,若读取块地址和写入块地址相同,则不存在待读取数据块。例如,判断head和tail是否相同,若不同,则存在待读取数据块,若相同,则不存在待读取数据块,即若预设缓存区域中的当前存储块还没有写满,则不能将当前存储块的日志数据存储至存储器中,待当前存储块写满后,将所述读取块地址对应的存储块的数据存储至存储器中,同时清空对应的存储块,因而,数据始终是以存储块为单位进行存储的。Among them, judging whether there is a data block to be read specifically includes: judging whether the read block address and the write block address are the same, if the read block address and the write block address are different, then there is a data block to be read, if the block is read If the address is the same as the write block address, there is no data block to be read. For example, it is judged whether the head and tail are the same. If they are different, there is a data block to be read. If they are the same, there is no data block to be read. That is, if the current storage block in the preset cache area is not full, it cannot The log data of the current storage block is stored in the memory. After the current storage block is full, the data of the storage block corresponding to the read block address is stored in the memory, and the corresponding storage block is cleared at the same time. Therefore, the data is always Stored in units of storage blocks.
在一种实施方式中,当前数据块内的数据存储至存储器后,按照预设排列顺序将读取块地址更新为下一个存储块的地址。其中,预设排列顺序为存储块的排列次序,当前数据块内的数据存储至存储器后,将读取块地址更新为下一个相邻的存储块的地址,以供下一次调用。由于日志数据写入预设缓存区域的过程为循环写入,日志数据存储至存储器的过程也为循环存储,即最后一个存储块内的数据全面存储至存储器后,开始存储第一个存储块内的数据。In one embodiment, after the data in the current data block is stored in the memory, the read block address is updated to the address of the next storage block according to the preset arrangement sequence. The preset arrangement order is the arrangement order of the storage blocks. After the data in the current data block is stored in the memory, the read block address is updated to the address of the next adjacent storage block for the next call. Because the process of writing log data into the preset buffer area is circular writing, the process of storing log data in the memory is also circular storage, that is, after the data in the last storage block is fully stored in the memory, it starts to store in the first storage block The data.
日志数据写入过程中,当日志数据写入到存储器中后,写入任务一直等待存储设备的应答,收到应答则表示写入完成,而这段时间是数据写入过程中耗时最长的。传统的日志写入方法一般是在需要写入数据的当前线程直接写入数 据,若当前线程是高优先级任务,在等待存储器应答的过程中,较低优先级的任务都无法执行,就会破坏系统的实时性。在一种实施方式中,将日志数据的写入任务设定为低优先级任务,处理器的任务处理采用多线程机制,在等待存储器应答的过程中,将写入任务挂起,从而可以被高优先级的任务抢占,从而保证了系统的实时性。During the log data writing process, when the log data is written into the memory, the writing task has been waiting for the response from the storage device, and the response is received to indicate that the writing is complete, and this period of time is the longest time in the data writing process of. The traditional log writing method generally writes data directly in the current thread that needs to write data. If the current thread is a high-priority task, while waiting for the memory response, the lower-priority tasks cannot be executed. Destroy the real-time nature of the system. In one embodiment, the log data writing task is set as a low-priority task, and the processor's task processing adopts a multithreading mechanism. While waiting for the memory response, the writing task is suspended so that it can be High-priority tasks preempt, thereby ensuring the real-time performance of the system.
在另一实施方式中,在将数据块存储至存储器之前,判断当前日志数据是否全部写入所述预设缓存区域中,若否,执行步骤S104;若是,将所述预设缓存区域中的所有未存储的数据存储至所述存储器中,即若停止记录日志数据,将预设缓存区域中剩余的所有数据一次全部存储至所述存储器中。In another embodiment, before storing the data block in the memory, it is determined whether the current log data is all written into the preset cache area, if not, step S104 is executed; if so, the data in the preset cache area All unstored data is stored in the memory, that is, if logging data is stopped, all data remaining in the preset buffer area is stored in the memory at once.
其中,日志头所对应的数据包全部写入预设区域时,当前日志数据全部写入预设缓存区域中。当前日志数据全部写入预设缓存区域中时,当前待读取的存储块存在一个或者多个,一次性将预设缓存区域中的所有读取的存储块中的数据存储至存储器中,以等待读取下一个日志数据。Wherein, when the data packets corresponding to the log header are all written into the preset area, the current log data are all written into the preset buffer area. When the current log data is all written into the preset cache area, there are one or more storage blocks currently to be read, and the data in all read storage blocks in the preset cache area are stored in the memory at one time. Waiting to read the next log data.
上述实施例提供的日志数据的存储方法,根据写入块地址和写入起始地址将日志数据先写入预设缓存区域中,再根据读取块地址将缓存区域中读取块地址对应的存储块内的数据存储至存储器中,从而实现日志数据的整块存储,提高数据存储效率,提高数据写入的吞吐量,保证系统处理任务的实时性。The log data storage method provided in the above embodiment first writes log data into a preset buffer area according to the write block address and the write start address, and then reads the corresponding block address in the buffer area according to the read block address. The data in the storage block is stored in the memory, thereby realizing the whole block storage of log data, improving data storage efficiency, increasing the throughput of data writing, and ensuring the real-time nature of system processing tasks.
如图4所示,本发明第二实施例提供的日志数据的存储方法,其与第一实施例的区别在于,方法还包括:As shown in Figure 4, the log data storage method provided by the second embodiment of the present invention differs from the first embodiment in that the method further includes:
步骤S201:判断所述日志数据的内容,所述日志数据的内容包括日志头和数据包;若所述日志数据为日志头,执行步骤S202;若所述日志数据为数据包,执行步骤S203。Step S201: Determine the content of the log data. The content of the log data includes a log header and a data packet; if the log data is a log header, step S202 is executed; if the log data is a data packet, step S203 is executed.
步骤S202:根据所述写入标识将所述日志头写入所述预设缓存区域中。Step S202: Write the log header into the preset buffer area according to the write identifier.
步骤S203:根据所述写入标识将所述数据包按照预设周期写入所述预设缓存区域中。Step S203: Write the data packet into the preset buffer area according to the preset cycle according to the write identifier.
具体的,日志数据开始写入预设缓存区域时,首先产生日志头,若获取到的数据为日志头,则当获取到完整的日志头时,即将日志头写入预设缓存区域中。通过解析日志头,获取信息更新频率,根据信息更新频率设定数据包的写入周期,当获取到的数据为数据包时,根据设定的写入周期将数据包写入预设缓存区域中。例如,通过信息更新频率设定写入函数被调用的时间,写入函数按照设定的调用时间写入数据。Specifically, when log data starts to be written into the preset cache area, a log header is first generated. If the acquired data is a log header, when the complete log header is obtained, the log header is written into the preset cache area. By parsing the log header, the information update frequency is obtained, and the write cycle of the data packet is set according to the information update frequency. When the acquired data is a data packet, the data packet is written into the preset buffer area according to the set write cycle . For example, the time when the write function is called is set by the information update frequency, and the write function writes data according to the set calling time.
上述实施例中,若获取到的数据为日志头,将日志头写入预设缓存区域中,若获取到的数据为数据包,则根据设定的周期将数据包写入预设缓存区域中,从而可以减少冗余日志信息。In the above embodiment, if the acquired data is a log header, the log header is written into the preset buffer area, and if the acquired data is a data packet, the data packet is written into the preset buffer area according to the set period , Which can reduce redundant log information.
本发明还提供一种电子设备,图5为本发明提供的电子设备的内部结构图。The present invention also provides an electronic device. FIG. 5 is an internal structure diagram of the electronic device provided by the present invention.
在本实施例中,电子设备可以是PC(Personal Computer,个人电脑),也可以是智能手机、平板电脑、便携计算机等终端设备。该电子设备至少包括 存储器11、处理器12、通信总线13以及网络接口14。In this embodiment, the electronic device may be a PC (Personal Computer, personal computer), or a terminal device such as a smart phone, a tablet computer, or a portable computer. The electronic device includes at least a memory 11, a processor 12, a communication bus 13, and a network interface 14.
其中,存储器11至少包括一种类型的可读存储介质,所述可读存储介质包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、磁性存储器、磁盘、光盘等。存储器11在一些实施例中可以是电子设备的内部存储单元,例如该电子设备的硬盘。存储器11在另一些实施例中也可以是电子设备的外部存储设备,例如电子设备上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,存储器11还可以既包括电子设备的内部存储单元也包括外部存储设备。存储器11不仅可以用于存储安装于电子设备的应用软件及各类数据,例如日志数据的存储方法程序01的代码等,还可以用于暂时地存储已经输出或者将要输出的数据。The memory 11 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, and the like. In some embodiments, the memory 11 may be an internal storage unit of an electronic device, such as a hard disk of the electronic device. In other embodiments, the memory 11 may also be an external storage device of the electronic device, such as a plug-in hard disk, a smart media card (SMC), and a secure digital (SD) card equipped on the electronic device. Flash Card, etc. Further, the memory 11 may also include both an internal storage unit of an electronic device and an external storage device. The memory 11 can be used not only to store application software and various data installed in the electronic device, such as the code of the log data storage method program 01, etc., but also to temporarily store data that has been output or will be output.
处理器12在一些实施例中可以是一中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器或其他数据处理芯片,用于运行存储器11中存储的程序代码或处理数据,例如执行日志数据的存储方法程序01等。In some embodiments, the processor 12 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip, for running program codes or processing stored in the memory 11 Data, such as the storage method program 01 of the execution log data, etc.
该总线13可以是外设部件互连标准(peripheral component interconnect,简称PCI)总线或扩展工业标准结构(extended industry standard architecture,简称EISA)总线等。该总线可以分为地址总线、数据总线、控制总线等。为便于表示,图中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The bus 13 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus can be divided into address bus, data bus, control bus and so on. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
进一步地,电子设备还可以包括网络接口14,网络接口14可选的可以包括有线接口和/或无线接口(如WI-FI接口、蓝牙接口等),通常用于在该电子设备与其他电子设备之间建立通信连接。Further, the electronic device may also include a network interface 14. The network interface 14 may optionally include a wired interface and/or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is usually used to connect the electronic device to other electronic devices. Establish a communication connection between.
图5仅示出了具有组件11-14以及日志数据的存储方法程序01的电子设备,本领域技术人员可以理解的是,图5示出的结构并不构成对电子设备的限定,可以包括比图示更少或者更多的部件,或者组合某些部件,或者不同的部件布置。Figure 5 only shows an electronic device with components 11-14 and log data storage method program 01. Those skilled in the art can understand that the structure shown in Figure 5 does not constitute a limitation on the electronic device, and may include comparisons. Fewer or more parts are shown, or some parts are combined, or different parts are arranged.
通过以上的实施方式的描述可知,本领域的技术人员可以清楚地了解到本发明可借助软件加必需的通用硬件平台的方式来实现。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来。本发明还涉及一种计算机可读存储介质,如ROM/RAM、磁碟、光盘等,其上存储有计算机程序,计算机程序被处理器执行时实现日志数据的存储方法。It can be known from the description of the above embodiments that those skilled in the art can clearly understand that the present invention can be implemented by means of software plus a necessary general hardware platform. Based on this understanding, the technical solution of the present invention can be embodied in the form of a software product in essence or a part that contributes to the existing technology. The present invention also relates to a computer-readable storage medium, such as ROM/RAM, magnetic disk, optical disc, etc., on which a computer program is stored, and the method for storing log data is realized when the computer program is executed by a processor.
需要说明的是,上述本发明实施例序号仅仅为了描述,不代表实施例的优劣。并且本文中的术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、装置、物品或者方法不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、装置、物品或者方法所固有的要素。在没有更多限制的情况下,由语句“包括一 个……”限定的要素,并不排除在包括该要素的过程、装置、物品或者方法中还存在另外的相同要素。It should be noted that the sequence numbers of the above-mentioned embodiments of the present invention are only for description, and do not represent the superiority of the embodiments. And the terms "include", "include" or any other variants thereof in this article are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements not only includes those elements, but also includes those elements that are not explicitly included. The other elements listed may also include elements inherent to the process, device, article, or method. If there are no more restrictions, the element defined by the sentence "including a..." does not exclude the existence of other identical elements in the process, device, article, or method that includes the element.
通过以上的实施方式的描述可知,本领域的技术人员可以清楚地了解到本发明可借助软件加必需的通用硬件平台的方式来实现。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来。本发明还涉及一种计算机可读存储介质,如ROM/RAM、磁碟、光盘等,其上存储有计算机程序,计算机程序被处理器执行时实现上述的方法。It can be known from the description of the above embodiments that those skilled in the art can clearly understand that the present invention can be implemented by means of software plus a necessary general hardware platform. Based on this understanding, the technical solution of the present invention can be embodied in the form of a software product in essence or a part that contributes to the existing technology. The present invention also relates to a computer-readable storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., on which a computer program is stored, and the computer program is executed by a processor to realize the above method.
上述实施方式仅为本发明的优选实施方式,不能以此来限定本发明保护的范围,本领域的技术人员在本发明的基础上所做的任何非实质性的变化及替换均属于本发明所要求保护的范围。The foregoing embodiments are only preferred embodiments of the present invention, and cannot be used to limit the scope of protection of the present invention. Any insubstantial changes and substitutions made by those skilled in the art on the basis of the present invention belong to the present invention. The scope of protection required.

Claims (10)

  1. 一种日志数据的存储方法,其特征在于,包括:A method for storing log data, which is characterized in that it includes:
    获取日志数据和预设缓存区域中的写入标识,所述预设缓存区域包括若干存储块,所述写入标识包括写入块地址和写入起始地址;Acquiring log data and a write identifier in a preset cache area, where the preset cache area includes a plurality of storage blocks, and the write identifier includes a write block address and a write start address;
    从所述写入块地址对应的存储块、所述写入起始地址开始将所述日志数据写入所述预设缓存区域中;Writing the log data into the preset buffer area starting from the storage block corresponding to the writing block address and the writing start address;
    获取所述预设缓存区域中的读取块地址;Acquiring the read block address in the preset cache area;
    将所述读取块地址对应的存储块内的数据存储至存储器中。The data in the storage block corresponding to the read block address is stored in the memory.
  2. 如权利要求1所述的日志数据的存储方法,其特征在于,所述将所述读取块地址对应的存储块内的数据存储至存储器中之前,所述方法还包括:5. The log data storage method according to claim 1, wherein before storing the data in the storage block corresponding to the read block address in the memory, the method further comprises:
    判断是否存在待存储的存储块;Determine whether there is a storage block to be stored;
    若存在待存储的存储块,将所述读取块地址对应的存储块内的数据存储至存储器中。If there is a storage block to be stored, the data in the storage block corresponding to the read block address is stored in the memory.
  3. 如权利要求2所述的日志数据的存储方法,其特征在于,所述判断是否存在待读取数据块,具体包括:3. The log data storage method according to claim 2, wherein said determining whether there is a data block to be read specifically comprises:
    判断所述读取块地址和所述写入块地址是否相同;Judging whether the read block address and the write block address are the same;
    若所述读取块地址和所述写入块地址不同,则存在待读取数据块。If the read block address and the write block address are different, there is a data block to be read.
  4. 如权利要求1所述的日志数据的存储方法,其特征在于,所述将所述读取块地址对应的存储块内的数据存储至存储器中之后,所述方法还包括:5. The log data storage method according to claim 1, wherein after storing the data in the storage block corresponding to the read block address in the memory, the method further comprises:
    按照预设排列顺序将所述读取块地址更新为下一个所述存储块的地址。The read block address is updated to the address of the next storage block according to the preset arrangement sequence.
  5. 如权利要求1所述的日志数据的存储方法,其特征在于,从所述写入块地址对应的存储块、所述写入起始地址开始将所述日志数据写入所述预设缓存区域中之后,所述方法还包括:The method for storing log data according to claim 1, wherein the log data is written into the preset buffer area starting from the storage block corresponding to the writing block address and the writing start address After the middle, the method further includes:
    将日志数据写入后的写入结束地址和所述写入结束地址所在的存储块的地址分别赋值给所述写入起始地址和写入块地址。The write end address after the log data is written and the address of the memory block where the write end address is located are assigned to the write start address and the write block address, respectively.
  6. 如权利要求1所述的日志数据的存储方法,其特征在于,所述方法还包括:5. The log data storage method according to claim 1, wherein the method further comprises:
    判断当前日志数据是否全部写入所述预设缓存区域中;Judging whether the current log data is all written into the preset buffer area;
    若否,将所述读取块地址对应的存储块内的数据存储至存储器中;If not, store the data in the storage block corresponding to the read block address in the memory;
    若是,将所述预设缓存区域中的所有未存储的数据存储至所述存储器中。If yes, store all unstored data in the preset cache area into the memory.
  7. 如权利要求1所述的日志数据的存储方法,其特征在于,所述从所述写入块地址对应的存储块、所述写入起始地址开始将所述日志数据写入所述预设缓存区域中,具体包括:The log data storage method according to claim 1, wherein the log data is written into the preset starting address from the storage block corresponding to the writing block address and the writing start address. The cache area includes:
    判断所述日志数据的内容,所述日志数据的内容包括日志头和数据包;Judging the content of the log data, the content of the log data includes a log header and a data packet;
    若所述日志数据为日志头,根据所述写入标识将所述日志头写入所述预设缓存区域中;If the log data is a log header, write the log header into the preset buffer area according to the write identifier;
    若所述日志数据为数据包,根据所述写入标识将所述数据包按照预设周期 写入所述预设缓存区域中。If the log data is a data packet, the data packet is written into the preset buffer area according to a preset cycle according to the write identifier.
  8. 如权利要求1所述的日志数据的存储方法,其特征在于,所述获取日志数据和预设缓存区域中的写入标识之前,所述方法还包括:5. The log data storage method according to claim 1, wherein before said obtaining the log data and the write identifier in the preset cache area, the method further comprises:
    分配所述预设缓存区域,所述预设缓存区域包括若干存储块,所述存储块的大小与所述存储器的存储块大小相同。The preset cache area is allocated, the preset cache area includes a plurality of storage blocks, and the size of the storage block is the same as the storage block size of the memory.
  9. 一种电子设备,其特征在于,包括处理器和存储器,所述存储器中存储有日志数据的存储程序,所述计算机可读程序被配置成由所述处理器执行,所述日志数据的存储程序被所述处理器执行时实现如权利要求1-8任意一项所述的方法。An electronic device, comprising a processor and a memory, the memory storing a log data storage program, the computer-readable program is configured to be executed by the processor, and the log data storage program When executed by the processor, the method according to any one of claims 1-8 is implemented.
  10. 一种计算机可读存储介质,其上存储有日志数据的存储程序,其特征在于,所述日志数据的存储程序被处理器执行时实现如权利要求1-8任意一项所述的方法。A computer-readable storage medium with a log data storage program stored thereon, wherein the log data storage program is executed by a processor to implement the method according to any one of claims 1-8.
PCT/CN2020/113253 2019-09-03 2020-09-03 Log data storage method, electronic device and storage medium WO2021043212A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910829352.0 2019-09-03
CN201910829352.0A CN110727608B (en) 2019-09-03 2019-09-03 Log data storage method, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
WO2021043212A1 true WO2021043212A1 (en) 2021-03-11

Family

ID=69217816

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/113253 WO2021043212A1 (en) 2019-09-03 2020-09-03 Log data storage method, electronic device and storage medium

Country Status (2)

Country Link
CN (1) CN110727608B (en)
WO (1) WO2021043212A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114020710A (en) * 2021-10-09 2022-02-08 苏州浪潮智能科技有限公司 Log storage method and device and electronic equipment
CN115639971A (en) * 2022-12-12 2023-01-24 北京集度科技有限公司 Data writing method, data writing device, electronic device, storage medium, and program product

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110727608B (en) * 2019-09-03 2022-07-12 深圳市道通智能航空技术股份有限公司 Log data storage method, electronic equipment and storage medium
CN112702418A (en) * 2020-12-21 2021-04-23 潍柴动力股份有限公司 Double-cache data downloading control method and device and vehicle
CN112988618B (en) * 2021-02-20 2023-02-28 山东英信计算机技术有限公司 Garbage recycling method, device and equipment for solid state disk and storage medium
CN114356219A (en) * 2021-12-08 2022-04-15 阿里巴巴(中国)有限公司 Data processing method, storage medium and processor
CN116340214B (en) * 2023-02-28 2024-01-02 中科驭数(北京)科技有限公司 Cache data storage and reading method, device, equipment and medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180357173A1 (en) * 2014-03-11 2018-12-13 Amazon Technologies, Inc. Page cache write logging at block-based storage
CN109118609A (en) * 2017-06-26 2019-01-01 深圳市道通智能航空技术有限公司 Unmanned plane during flying log recording method, device, storage medium and computer equipment
CN109542329A (en) * 2017-09-21 2019-03-29 阿里巴巴集团控股有限公司 Method, apparatus and system is written in log
CN110008142A (en) * 2019-04-16 2019-07-12 苏州浪潮智能科技有限公司 Storing data management method, device, equipment and computer readable storage medium
CN110727608A (en) * 2019-09-03 2020-01-24 深圳市道通智能航空技术有限公司 Log data storage method, electronic equipment and storage medium

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9582222B2 (en) * 2009-04-30 2017-02-28 Western Digital Technologies, Inc. Pre-cache similarity-based delta compression for use in a data storage system
CN101788948B (en) * 2010-02-05 2013-08-21 瑞斯康达科技发展股份有限公司 Dynamic storage system of journal information and method
CN101834801B (en) * 2010-05-20 2012-11-21 哈尔滨工业大学 Data caching and sequencing on-line processing method based on cache pool
JP6056211B2 (en) * 2012-06-22 2017-01-11 富士通株式会社 Information management apparatus, information management program, and information management method
CN104536908B (en) * 2014-11-05 2017-12-29 中安威士(北京)科技有限公司 A kind of magnanimity small records efficient storage management method towards unit
CN106933491B (en) * 2015-12-29 2020-05-22 伊姆西Ip控股有限责任公司 Method and apparatus for managing data access

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180357173A1 (en) * 2014-03-11 2018-12-13 Amazon Technologies, Inc. Page cache write logging at block-based storage
CN109118609A (en) * 2017-06-26 2019-01-01 深圳市道通智能航空技术有限公司 Unmanned plane during flying log recording method, device, storage medium and computer equipment
CN109542329A (en) * 2017-09-21 2019-03-29 阿里巴巴集团控股有限公司 Method, apparatus and system is written in log
CN110008142A (en) * 2019-04-16 2019-07-12 苏州浪潮智能科技有限公司 Storing data management method, device, equipment and computer readable storage medium
CN110727608A (en) * 2019-09-03 2020-01-24 深圳市道通智能航空技术有限公司 Log data storage method, electronic equipment and storage medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114020710A (en) * 2021-10-09 2022-02-08 苏州浪潮智能科技有限公司 Log storage method and device and electronic equipment
CN114020710B (en) * 2021-10-09 2024-01-16 苏州浪潮智能科技有限公司 Log storage method and device and electronic equipment
CN115639971A (en) * 2022-12-12 2023-01-24 北京集度科技有限公司 Data writing method, data writing device, electronic device, storage medium, and program product
CN115639971B (en) * 2022-12-12 2023-04-07 北京集度科技有限公司 Data writing method, data writing device, electronic device, storage medium, and program product

Also Published As

Publication number Publication date
CN110727608A (en) 2020-01-24
CN110727608B (en) 2022-07-12

Similar Documents

Publication Publication Date Title
WO2021043212A1 (en) Log data storage method, electronic device and storage medium
CN110865888A (en) Resource loading method and device, server and storage medium
US9489328B2 (en) System on chip and method for accessing device on bus
US20150253992A1 (en) Memory system and control method
JP2000330859A (en) Optimization of usage of bus having read/write coherency
WO2021047120A1 (en) Resource allocation method in fpga heterogeneous accelerator card cluster, device, and medium
EP2919120A1 (en) Memory monitoring method and related device
CN108874324B (en) Access request processing method, device, equipment and readable storage medium
US11010094B2 (en) Task management method and host for electronic storage device
CN114168271B (en) Task scheduling method, electronic device and storage medium
CN112506823A (en) FPGA data reading and writing method, device, equipment and readable storage medium
US9785551B2 (en) Memory access method, buffer scheduler and memory module
KR101281480B1 (en) Inserting a gap in information sent from a drive to a host device
WO2024119930A1 (en) Scheduling method and apparatus, and computer device and storage medium
US9851941B2 (en) Method and apparatus for handling incoming data frames
CN110941605B (en) Method and device for deleting repeated data on line and readable storage medium
US11360702B2 (en) Controller event queues
CN108763421B (en) Data searching method and system based on logic circuit
CN106776393B (en) uninterrupted serial port data receiving method and device
CN115970295A (en) Request processing method and device and electronic equipment
US8214448B2 (en) Optimized utilization of DMA buffers for incoming data packets in a network protocol
CN114936189A (en) Application program operation method and device, computer equipment and readable storage medium
CN111143418A (en) Data reading method, device and equipment for database and storage medium
US10942875B2 (en) System and method for regulating host IOs and internal background operations in a storage system
CN111324280B (en) Data writing method and device based on Raid5

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20860397

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20860397

Country of ref document: EP

Kind code of ref document: A1