Data storage method and device, equipment, medium and program product

By selecting the appropriate storage space based on the data acquisition method and data volume of the electronic measurement instrument, and combining the use of memory and disk, the problem of inefficient data storage management of electronic measurement instruments is solved, and flexible and efficient data access and management are achieved.

CN120386493AActive Publication Date: 2025-07-29深圳市万里眼技术有限公司

Patent Information

Application Number
CN202510889671.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-30
Publication Date
2025-07-29
Estimated Expiration
2045-06-30

AI Technical Summary

Technical Problem

Existing data storage methods are difficult to meet the need for flexibility and efficiency of electronic measurement instruments, especially when processing different data types, the storage capacity is limited and the data is constantly updated, resulting in inefficient management.

Method used

By obtaining the data acquisition method and data amount of electronic measurement instruments, selecting the appropriate storage space for storage, combining the use of memory and disk, using a double buffering mechanism with direct memory access and a file mapping mechanism to optimize the data storage and migration process.

Benefits of technology

It realizes flexible data storage management, improves the data access efficiency of electronic measurement instruments, ensures the continuity of data acquisition and reading, and optimizes the overall data management efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120386493A_ABST
    Figure CN120386493A_ABST
Patent Text Reader

Abstract

The invention discloses a data storage method and device, equipment, a medium and a program product, and relates to the technical field of data storage, and the method comprises the steps: obtaining to-be-stored data of an electronic measuring instrument; determining a data acquisition mode and a data volume of the to-be-stored data; the data acquisition mode is any one of a first acquisition mode in which the electronic measuring instrument acquires data through local hardware, a second acquisition mode in which the data is generated through operation and a third acquisition mode in which the data is imported through the outside; and storing the to-be-stored data in a target storage space in a plurality of storage spaces of the electronic measuring instrument based on at least one characteristic of the data acquisition mode and the data volume. Therefore, different storage spaces can be selected for storage according to the data acquisition mode and the data volume of the electronic measuring instrument, the data can be flexibly stored, the efficiency requirement of the electronic measuring instrument for data access can be met, and the data management efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data storage, and particularly relates to a data storage method, apparatus, device, medium and program product. Background Art

[0002] With the continuous improvement of the data acquisition and processing capabilities of measuring instruments, the demand for data storage is also increasing day by day. Taking a digital oscilloscope as an example, there are various types of data involved in such instruments; due to its limited storage capacity and the continuous update of data over time, how to efficiently manage this data has become a challenge. Currently, the commonly used data storage method is to use solid-state drives and mechanical hard drives as storage media. However, such a storage method still has room for improvement in the field of electronic measuring instruments, especially when dealing with different data types, it is difficult to meet the requirements for flexibility and efficiency.

[0003] Therefore, how to efficiently manage the relevant data of electronic measuring instruments is a problem to be solved in this field. Summary of the Invention

[0004] In view of this, the purpose of the present invention is to provide a data storage method, apparatus, device, medium and program product for solving the data storage management problem of electronic measuring instruments, and its specific solutions are as follows:

[0005] In a first aspect, the present application provides a data storage method, including: obtaining the data to be stored of an electronic measuring instrument; determining the data acquisition method and data volume of the data to be stored; the data acquisition method is any one of a first acquisition method in which the electronic measuring instrument acquires data through local hardware, a second acquisition method in which data is generated through operation, and a third acquisition method in which data is imported from the outside; based on at least one characteristic of the acquisition method and the data volume, storing the data to be stored in a target storage space among multiple storage spaces of the electronic measuring instrument. In this solution, based on the data acquisition method and the different data volumes of the electronic measuring instrument, for different data to be stored, different storage spaces can be selected for storage. Through the combination of multiple storage spaces, flexible data storage can be realized, and the demand for different data access and storage efficiencies of the electronic measuring instrument can be met as much as possible, and the data management efficiency of the electronic measuring instrument can be improved.

[0006] In a possible embodiment, the multiple storage spaces include the memory space and the disk space of the electronic measuring instrument. In this solution, the storage spaces in the electronic measuring instrument can include memory and disk. The memory usually has a small capacity but a fast access speed, while the disk has a slow access speed but a large capacity. Combining the memory and the disk can flexibly store the data of the electronic measuring instrument.

[0007] In a possible embodiment, storing the data to be stored into a target storage space among multiple storage spaces of the electronic measuring instrument based on at least one characteristic of the acquisition method and the data volume includes:

[0008] If the data acquisition method is the first acquisition method, store the data to be stored into the memory space. In this solution, considering the data acquisition method, the memory access requirements of the data to be stored corresponding to different data acquisition methods are different. Relevant data can be stored in the memory space to improve the memory access efficiency of the relevant data.

[0009] In a possible embodiment, storing the data to be stored into a target storage space among multiple storage spaces of the electronic measuring instrument based on at least one characteristic of the acquisition method and the data volume includes: If the data acquisition method is the second acquisition method or the third acquisition method, determine a first magnitude relationship between the data volume and a first data volume threshold; based on the first magnitude relationship, store the data to be stored into a target storage space among multiple storage spaces of the electronic measuring instrument. In this solution, when storing data, the data acquisition method and the data volume are considered. For data with different data volumes, the impact on memory access performance can be considered, and they can be selectively stored in a suitable memory space or disk space to adapt to the memory access requirements of different data by the electronic measuring instrument.

[0010] In a possible embodiment, storing the data to be stored into a target storage space among multiple storage spaces of the electronic measuring instrument based on the first magnitude relationship includes: If the data volume is less than the first data volume threshold, store the data to be stored into the memory space; if the data volume is not less than the first data volume threshold, store the data to be stored into the disk space. In this solution, it is possible to determine whether to store the data to be stored in the memory or the disk according to the first data volume threshold. Data with a smaller data volume can be stored in the memory space, which will not occupy too much memory capacity while improving the memory access efficiency; while data with a large data volume can be directly stored in the disk space to avoid the impact of large amounts of data on the overall data memory access speed; this way of determining the storage space in combination with the data volume can improve the overall memory access efficiency of the electronic measuring instrument for data.

[0011] In a possible embodiment, if the target storage space is the memory space, storing the data to be stored into the memory space includes: storing the data to be stored into the memory space based on a double-buffer mechanism of direct memory access. In this solution, when storing data into the memory space, the double-buffer mechanism of direct memory access technology can be used to ensure seamless connection between data acquisition and reading, and to ensure the high efficiency and continuity of the electronic measuring instrument in data memory access.

[0012] In a possible embodiment, the method may further include: determining the amount of data of the target written data in the memory space; determining a second magnitude relationship between the amount of data of the target written data and a second data volume threshold; determining whether to perform a data migration operation on the target written data based on the second magnitude relationship; wherein the target written data is data obtained through the second acquisition method and the third acquisition method. In this solution, a certain data volume threshold is reserved for the data of the second acquisition method and the third acquisition method in the memory space. According to the relationship between the amount of data written in the memory space and the data volume threshold, it can be judged whether to perform a data migration operation. Through the data migration operation, the storage state of the data in the memory space can be adjusted, which is convenient for grasping the impact of the data volume on the overall memory access efficiency.

[0013] In a possible embodiment, the determining whether to perform a data migration operation on the target written data based on the second magnitude relationship includes: if the amount of data of the target written data is not less than the second data volume threshold, performing a data migration operation on the target written data; wherein the data migration operation is an operation of migrating data to the disk space. In this solution, when the amount of data written in the memory space is not less than the second data volume threshold, the relevant data in the memory space can be migrated to the disk space through the data migration operation, so as to avoid data accumulation in the memory space and affect the overall memory access efficiency.

[0014] In a possible embodiment, the performing a data migration operation on the target written data includes: determining the memory occupation amount of each data in the target written data; performing a data migration operation on the target written data in the order from largest to smallest based on the memory occupation amount. In this solution, during the data migration process, according to the size of the memory occupation amount, the data with a large occupation amount can be migrated preferentially, so as to perform data migration efficiently and reduce the memory occupation amount at the fastest speed, avoiding affecting the memory access performance of the electronic measuring instrument.

[0015] In a possible embodiment, the method may further include: determining the current system load of the electronic measuring instrument; adjusting the second data volume threshold based on the current system load. In this solution, according to the current system load of the electronic measuring instrument, the second data volume threshold in the memory space can be adjusted to timely adjust the data volume threshold, and the overall data memory access efficiency can be ensured through this data volume threshold.

[0016] In a possible embodiment, if the data acquisition method is the first acquisition method and the memory space does not support dynamic expansion, then in the process of storing the data to be stored in a target storage space among multiple storage spaces of the electronic measuring instrument, it further includes: determining the first space adequacy of the current memory space; determining whether to perform a first data clearing operation based on the first space adequacy; wherein, the first data clearing operation is an operation of clearing data from the memory space based on the chronological order of storage times of the written data in the memory space. In this solution, for the case where the memory space does not support expansion, when storing data, considering the space adequacy of the memory space, it is determined whether to perform a data clearing operation according to the chronological order of data storage, so that some data can be cleared in a timely manner through the data clearing operation in the case of a fixed space size, and the available space can be expanded to adapt to diverse storage requirements.

[0017] In a possible embodiment, if the target storage space supports dynamic expansion, then in the process of storing the data to be stored in a target storage space among multiple storage spaces of the electronic measuring instrument, it further includes: determining the second space adequacy of the current target storage space; determining whether to apply for a new storage space for the target storage space based on the second space adequacy. In this solution, in the case where the storage space supports dynamic expansion, it can be determined whether to expand the storage space according to the space adequacy of the storage space during the data storage process, so that the available space can be expanded in a timely manner by applying for a new storage space to adapt to diverse storage requirements.

[0018] In a possible embodiment, after applying for a new storage space for the target storage space, it further includes: determining the current space size of the target storage space; if the current space size reaches a preset capacity upper limit threshold, then determining the third space adequacy of the current target storage space; determining whether to perform a second data clearing operation based on the third space adequacy; wherein, the second data clearing operation is an operation of clearing data from the target storage space based on the chronological order of storage times of the written data in the target storage space. In this solution, in the case where the storage space can be expanded, if the expansion reaches the upper limit, then in the case of a constant space, some data can be cleared through the data clearing operation to expand the available space, so that the space can be flexibly adjusted to adapt to diverse storage requirements.

[0019] In a possible embodiment, the method may further include: determining data to be mapped from the written data in the target storage space; mapping the data to be mapped to a data buffer in the user space through a file mapping mechanism; and when an access request for the data to be mapped is obtained, using the data buffer to respond to the access request. In this solution, a mapping relationship can be constructed to map data to a data buffer in the user space, facilitating the efficient implementation of reading and writing of relevant data based on the mapping relationship of the data buffer.

[0020] In a second aspect, the present application provides a data storage device, including:

[0021] A data acquisition module, configured to acquire data to be stored of an electronic measuring instrument;

[0022] A data characteristic determination module, configured to determine the data acquisition method and the data volume of the data to be stored; the data acquisition method is any one of a first acquisition method in which the electronic measuring instrument acquires data through local hardware, a second acquisition method in which data is generated through calculation, and a third acquisition method in which data is imported from the outside;

[0023] A storage module, configured to store the data to be stored in a target storage space among multiple storage spaces of the electronic measuring instrument based on at least one characteristic of the data acquisition method and the data volume.

[0024] In a third aspect, the present application provides an electronic device, including:

[0025] A memory, configured to store a computer program;

[0026] A processor, configured to execute the computer program to implement the data storage method as described above.

[0027] In a fourth aspect, the present application provides a computer-readable storage medium, configured to store a computer program, and when the computer program is executed by a processor, the data storage method as described above is implemented.

[0028] In a fifth aspect, the present application provides a computer program product, including computer programs / instructions, and when the computer programs / instructions are executed by a processor, the data storage method as described above is implemented.

[0029] It can be seen that in this application, the data to be stored in the electronic measuring instrument is first obtained; then the data acquisition method and the data volume of the data to be stored are determined; the data acquisition method is any one of the first acquisition method in which the electronic measuring instrument acquires data through local hardware, the second acquisition method in which data is generated through operation, and the third acquisition method in which data is imported from the outside; then, based on at least one characteristic of the data acquisition method and the data volume, the data to be stored is stored in a target storage space among multiple storage spaces of the electronic measuring instrument. In this way, this application can select different storage spaces for storage according to at least one characteristic of the data acquisition method and the data volume of the electronic measuring instrument. By combining multiple storage spaces, flexible data storage can be achieved, which can meet the efficiency requirements of different data access and storage of the electronic measuring instrument and improve the data management efficiency of the electronic measuring instrument. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only the embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained according to the provided drawings.

[0031] Figure 1 It is a flowchart of a data storage method disclosed in this application;

[0032] Figure 2 It is a flowchart of a specific memory space management method disclosed in this application;

[0033] Figure 3 It is a schematic structural diagram of an electronic measuring instrument system disclosed in this application;

[0034] Figure 4 It is a flowchart of another specific data storage method disclosed in this application;

[0035] Figure 5 It is a flowchart of a specific high-frequency data storage method disclosed in this application;

[0036] Figure 6 It is a flowchart of a specific low-frequency data storage method disclosed in this application;

[0037] Figure 7 It is a schematic structural diagram of a data storage device disclosed in this application;

[0038] Figure 8 It is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0039] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without making creative efforts shall fall within the protection scope of the present invention.

[0040] See Figure 1 As shown, an embodiment of the present invention discloses a data storage method, including:

[0041] Step S11: Obtain the data to be stored of the electronic measuring instrument.

[0042] It can be understood that the data that needs to be stored during the operation of the electronic measuring instrument can include various types, such as actively collected data or passively received data. In this application, first, the data to be stored needs to be obtained, and then the data to be stored is analyzed and processed to perform corresponding storage operations.

[0043] Step S12: Determine the data acquisition method and data volume of the data to be stored; the data acquisition method is any one of a first acquisition method in which the electronic measuring instrument acquires data through local hardware, a second acquisition method in which data is generated through calculation, and a third acquisition method in which data is imported from the outside.

[0044] Furthermore, in combination with the characteristics of the electronic measuring instrument, the method of acquiring data through local hardware can be recorded as the first acquisition method, the method of generating data through calculation can be recorded as the second acquisition method, and the method of importing data from the outside can be recorded as the third acquisition method; the data to be stored involved here can be data acquired by any one of these three data acquisition methods. Correspondingly, according to the different data acquisition methods and the different data volumes of the acquired data to be stored, the data characteristics of the corresponding data to be stored can be determined. In a specific implementation, the data acquired through the local hardware of the electronic measuring instrument, that is, the data obtained through the first data acquisition method, can be recorded as high-frequency data (with a higher subsequent access frequency), and the data obtained through the second data acquisition method and the third data acquisition method can be recorded as low-frequency data (with a lower subsequent access frequency); for example, in a digital oscilloscope, the waveform data directly collected by the oscilloscope is likely to be queried or modified by the user and is recorded as high-frequency data, and the data imported from the outside and the data obtained by performing mathematical operations on the existing waveform data can be recorded as low-frequency data. In this application, considering the different data acquisition methods and the different data volumes of the acquired data, the data characteristics of the data to be stored are determined.

[0045] Step S13: Based on at least one characteristic of the data acquisition method and the data amount, the data to be stored is stored in a target storage space among the multiple storage spaces of the electronic measuring instrument.

[0046] In the present application, the above steps can be used to obtain the current data to be stored in the electronic measuring instrument, and determine the data acquisition method and data volume corresponding to the current data to be stored; further, based on at least one data characteristic of the data acquisition method and data volume, a target storage space suitable for the current data to be stored can be selected from a variety of storage spaces. It should be noted that the multiple storage spaces in the present application may include the memory space and disk space of the electronic measuring instrument; in a specific embodiment, the storage space may also include non-local storage space such as an external storage device and the cloud. On this basis, the data acquisition method and data volume can be combined to flexibly store the relevant data, which can improve the efficiency of data access.

[0047] In a specific embodiment, storing the data to be stored in a target storage space among the multiple storage spaces of the electronic measuring instrument based on at least one characteristic of the data acquisition method and the data volume may include: if the data acquisition method is the first acquisition method, storing the data to be stored in the memory space. Specifically, the first acquisition method involves directly acquiring data using the electronic measuring instrument's own hardware, which is likely to be subsequently queried or modified by a user. Therefore, this type of data can be recorded as high-frequency data, and in combination with memory space, efficient memory access can be ensured. In other words, to ensure efficient memory access for high-frequency data, the corresponding data can be stored in memory space.

[0048] In another specific embodiment, storing the data to be stored into a target storage space among multiple storage spaces of the electronic measuring instrument based on at least one characteristic of the data acquisition method and the data volume may include: if the data acquisition method is the second acquisition method or the third acquisition method, determining a first magnitude relationship between the data volume and a first data volume threshold; and storing the data to be stored into a target storage space among multiple storage spaces of the electronic measuring instrument based on the first magnitude relationship. Specifically, the second acquisition method and the third acquisition method are data obtained through operations and external imports. Compared with the data directly acquired by the hardware, the subsequent access probability of these data is relatively low, which can be recorded as low-frequency data. Considering the overall memory access efficiency of the electronic measuring instrument, small-volume low-frequency data can also be stored in the memory space to optimize the overall memory access efficiency. On this basis, a first data volume threshold can be set, and according to the first magnitude relationship between the data volume of the data to be stored obtained and the first data volume threshold, a target storage space is determined from multiple storage spaces inside the electronic measuring instrument to store the corresponding low-frequency data into the target storage space.

[0049] Further, in a specific embodiment, storing the data to be stored into a target storage space among multiple storage spaces of the electronic measuring instrument based on the first magnitude relationship may include: if the data volume is less than the first data volume threshold, storing the data to be stored into the target storage space; if the data volume is not less than the first data volume threshold, storing the data to be stored into the target storage space. It can be understood that when the data volume of the data to be stored is not less than the first data volume threshold, it means that storing these data in the memory will affect the overall data memory access efficiency. The target storage space corresponding to the data to be stored can be recorded as the disk space, that is, the current data to be stored is stored in the disk space; when the data volume is less than the first data volume threshold, it means that even if the corresponding data is placed in the memory, it will not have a great impact on the overall data memory access efficiency. The target storage space corresponding to the current data to be stored can be recorded as the memory space, that is, the corresponding data is stored in the memory space. In this way, by judging the data volume of the data to be stored through the first data volume threshold, small-volume data can be stored in the memory space, and large-volume data can be stored in the disk space to optimize the overall memory access efficiency.

[0050] It can be understood that the target storage space can be a memory space or a disk space, and the space pre-allocated in the memory or disk for data storage is used to perform a storage operation on the data to be stored. In a specific embodiment, if the target storage space is the memory space, storing the data to be stored into the memory space may include: storing the data to be stored into the memory space based on a double-buffer mechanism of direct memory access. It can be understood that, in order to ensure the continuity of the electronic measuring instrument, during the process of storing data using the memory space, based on the double-buffer mechanism of direct memory access technology, the double buffers are alternately used to ensure seamless connection of the data acquisition and reading processes, avoid data interruption, and ensure system continuity and efficiency.

[0051] In a specific embodiment, it may further include: determining the data to be mapped from the data already written in the target storage space; mapping the data to be mapped to a data buffer in the user space through a file mapping mechanism; when an access request for the data to be mapped is obtained, using the data buffer to respond to the access request. Specifically, to efficiently implement data reading and writing, the data already written in the storage space can be mapped to the data buffer in the user space through a mapping mechanism, and then the corresponding access request can be responded to through the data buffer; for example, when writing an operation to the virtual address of the data buffer, the dirty page can be synchronized to the storage space through a write-back mechanism to ensure data consistency and integrity.

[0052] It can be seen that the present application can determine the corresponding data characteristics according to the data acquisition method and data volume of the electronic measuring instrument; for the data to be stored with different characteristics, different storage spaces can be selected for storage, and flexible data storage is achieved through the combination of multiple storage spaces, which can meet the efficiency requirements of the electronic measuring instrument for different data memory access, and can improve the data management efficiency of the electronic measuring instrument; and the high-frequency data and small-volume low-frequency data can be stored in the memory space, which can efficiently utilize the storage space and enable the system to have the ability of fast response; combined with the double-buffer technology, the continuity of the data acquisition and reading processes can be ensured.

[0053] As Figure 2 shown, in this embodiment, during the process of writing the data obtained by the second acquisition method and the third acquisition method into the memory space, the management method of the memory space will be introduced in detail, which involves system load and data migration. Specifically,

[0054] Step 21, determining the data volume of the target data already written in the memory space; wherein, the target data already written is the data obtained by the second acquisition method and the third acquisition method.

[0055] In this embodiment, for the data to be stored obtained by the second acquisition method and the third acquisition method, it is determined whether to store it in the memory space according to the first data volume threshold; in order to optimize the overall memory access efficiency, this type of data can be stored in the memory space, but there should be a limit on the data volume of this type of data stored in the memory space to ensure the overall memory access performance. Further, in the process of storing this type of data in the memory space, it is necessary to consider the data volume of the target written data in the memory space, and this data volume can affect the response ability of the electronic measuring instrument to other types of data to a certain extent.

[0056] Step 22: Determine the second magnitude relationship between the data volume of the target written data and the second data volume threshold.

[0057] Further, by setting the second data volume threshold, the data volume of the target written data in the memory space is restricted. The second data volume threshold is a threshold set considering the overall memory access efficiency of the electronic measuring instrument. There is a magnitude relationship between the data volume of the target written data and the second data volume threshold, which is denoted as the second magnitude relationship here.

[0058] In a specific embodiment, it may further include: determining the current system load of the electronic measuring instrument; based on the current system load, adjusting the second data volume threshold. Specifically, the real-time system load state of the electronic measuring instrument may affect the actual data memory access efficiency. Combining the real-time system load, the set second data volume threshold can be dynamically adjusted to optimize the data management efficiency and memory access efficiency of the electronic measuring instrument in real time. It can be understood that if the load is high, the second data volume threshold can be reduced to reduce the memory occupancy to optimize the memory access efficiency.

[0059] Step 23: Based on the second magnitude relationship, determine whether to perform a data migration operation on the target written data.

[0060] In this embodiment, through the above steps, the second magnitude relationship between the data volume of the target written data in the memory space and the second data volume threshold can be obtained. According to this second magnitude relationship, it can be determined whether the data volume of the target written data in the memory space is appropriate; if it is not appropriate, the data volume of the target written data in the memory space can be optimized by performing a data migration operation on the target written data.

[0061] In a specific embodiment, determining whether to perform a data migration operation on the target written data based on the second size relationship may include: if the data volume of the target written data is not less than the second data volume threshold, performing a data migration operation on the target written data; wherein, the data migration operation is an operation of migrating data to the disk space. It can be understood that if the data volume of the target written data is not less than the second data volume threshold, it means that the data volume of the target written data in the memory space is inappropriate at this time, and a data migration operation on the target written data needs to be performed to migrate some or all of the data to the disk space to balance memory release and access performance. Correspondingly, if during the migration process, the remaining data volume of the target written data is less than the second data volume threshold, the migration can be stopped to avoid affecting the access of other data due to excessive data migration.

[0062] Further, in a specific embodiment, performing the data migration operation on the target written data may include: determining the memory occupancy of each data in the target written data; performing the data migration operation on the target written data based on the order from largest to smallest of the memory occupancy. Specifically, during the data migration process, in combination with the memory occupancy of each data in the target written data, in the order from largest to smallest, the data with a large memory occupancy is preferentially migrated to quickly reduce the storage pressure of the memory space. And during the migration process, the total memory occupancy of the remaining low-frequency data can be continuously calculated. Once it is lower than the corresponding second data volume threshold, the migration is stopped, and the remaining relatively small-volume data can be retained in the memory, and the original memory space occupied by the migrated data can be released; in this way, on the premise of quickly reducing the storage pressure of the memory space, the data with a small occupancy can be retained as much as possible to reduce the overhead generated by data migration.

[0063] It can be seen that the present application can set a second data volume threshold in the memory space to manage the data volume of low-frequency data in the memory space, and can dynamically adjust the second data volume threshold in combination with the system load to avoid migrating the data in the memory too early or too late, improve the adaptability to different scenarios, and optimize the overall memory access efficiency. And the large-volume data can be preferentially migrated, and the large-capacity data can be released to quickly reduce the memory pressure. At the same time, the small-volume data can be retained as much as possible to reduce the migration overhead; when the total data volume of the remaining target written data is lower than the second data volume threshold, the migration can be stopped to balance memory release and access performance and avoid affecting the data access efficiency due to excessive migration.

[0064] It can be understood that multiple storage spaces of the electronic measurement instrument can be set to support dynamic expansion or not support dynamic expansion (fixed empty size); the following embodiments will introduce in detail the influence of different management methods of the storage space on the data storage process, including specifically:

[0065] First, for the data acquisition method being the first acquisition method, that is, the high-frequency data collected by the electronic measuring instrument through its own hardware, if the memory space does not support dynamic expansion, during the process of storing the data to be stored, the first space adequacy of the current memory space can be determined in real time; then, based on the first space adequacy, it can be determined whether to perform the first data clearing operation; here, the first data clearing operation is to perform a data clearing operation on the memory space based on the storage time sequence of each written data in the memory space. It can be understood that since the size of the memory space is fixed, when the first space adequacy corresponding to the memory space indicates that it is not sufficient to continue data storage, the clearing operation can be selected for each written data in the memory space; specifically, the clearing can be performed in sequence according to the writing time sequence of the data to ensure that the current data to be stored can be successfully written into the memory space.

[0066] Correspondingly, if the target storage space supports dynamic expansion, during the process of using the target storage space to store the data to be stored, the second space adequacy of the current target storage space can be determined in real time; then, based on the second space adequacy, it can be determined whether to apply for a new storage space for the target storage space. It can be understood that the size of the storage space is dynamically variable, so when the corresponding second space adequacy indicates that it is not sufficient to perform data storage, an expansion operation can be performed on the storage space; during the process of performing data storage, it can be judged whether a new storage space needs to be applied for through the real-time space adequacy. Further, in a specific embodiment, after applying for a new storage space for the target storage space, it may further include: determining the current space size of the target storage space; if the current space size reaches the preset capacity upper limit threshold, determining the third space adequacy of the current target storage space; based on the third space adequacy, determining whether to perform the second data clearing operation; where the second data clearing operation is to perform a data clearing operation on the target storage space based on the storage time sequence of each written data in the target storage space. Specifically, after expanding the storage space, it is necessary to consider whether the size of the expanded space reaches the preset capacity upper limit threshold and whether it can continue to be expanded; if it reaches this capacity upper limit threshold and cannot continue to be expanded, and the corresponding third space adequacy indicates that it is not sufficient to perform data storage, it is necessary to clear some data in the storage space through a data clearing operation to adjust the available space size of the storage space; specifically, the storage time sequence of each written data in the storage space can be considered to clear each data; so as to use the storage space to achieve data storage.

[0067] It can be seen from this that the storage space of the electronic measuring instrument in this application can be set to support dynamic expansion or not support dynamic expansion in two management modes; choosing to set the space to change dynamically can flexibly adapt to storage needs, avoid performance degradation caused by insufficient space, and achieve a dynamic balance between performance and storage capacity; for fixed space size, dynamic expansion is not supported, which can avoid the loss caused by space application, reduce memory fragmentation, and improve system stability and storage efficiency.

[0068] The following embodiment will be combined with a structural block diagram of a specific electronic measuring instrument to provide a detailed description of the data storage method of the present application, including:

[0069] like Figure 3The figure shows a schematic diagram of the system software structure of an electronic measurement instrument. Among them, the data transmission module realizes the data transmission between the data acquisition hardware and the memory. Specifically, it can combine the direct memory access technology (DMA, Direct Memory Access) to achieve zero-copy data transmission from the hardware to the memory without the intervention of the CPU (Central Processing Unit), further reducing the system overhead. The data storage module provides two storage media: memory and disk. Memory is suitable for high-frequency data that requires fast response, and the read and write performance is improved through direct memory storage. The disk is for low-frequency data, and disk storage is used to maximize the expansion of the system's storage capacity and reduce the occupation of physical memory. The memory mapping module is used to directly map the data in the disk and memory to the user space through the file mapping mechanism, avoiding multiple copy operations of traditional file I / O (Input / Output), and greatly improving the access speed. The data import module is responsible for obtaining data from the external file system and importing it into its own system. The function area module provides users with further processing and visualization functions for the stored data, and supports user-defined expansion. Read and write requests can be initiated to the data management module through a unified interface. The data management module will automatically select an appropriate storage path and read and write method (memory or disk) according to the data type. The data management module is responsible for the unified storage and management of multiple data types, including the dynamic construction of data objects, multi-level data organizational structures, and data operation interfaces. Further, in the process of dynamic construction of data objects, data objects with different characteristics can be dynamically created according to different data sources (such as acquisition generation, external import, mathematical operations). The characteristics of data objects include data type (high-frequency data or low-frequency data) and storage medium (memory or disk). For low-frequency data, an appropriate storage medium can be selected with reference to its data volume. The data management module selects an appropriate storage medium according to the characteristics of the data object to meet the data management requirements of different access frequencies. Correspondingly, there is a multi-level data organizational structure. Specifically, at the global level, a global data directory is maintained to achieve unified management and fast search of the index information of all data objects. At the object level, refined management of each data object is carried out, responsible for functions such as data format definition, storage status tracking, and interaction between memory and disk. And the data operation interfaces include data read and write interfaces, data migration interfaces, and data maintenance interfaces. The data read and write interfaces shield the underlying storage differences, and users do not need to perceive whether the data is stored in memory or disk. The data migration interface supports the dynamic migration of low-frequency data from memory to disk to optimize resource utilization. The data maintenance interface can provide operations such as add, delete, modify, query, batch import and export, comprehensively improving the flexibility and efficiency of data management.

[0070] It's important to note that the memory management strategies for low-frequency and high-frequency data differ depending on application requirements and scenarios. Low-frequency data supports dynamic capacity expansion, while high-frequency data supports dynamic capacity expansion and fixed memory space settings. It's important to note that both high-frequency and low-frequency data objects contain one or more child data objects, whose data types and memory management policies are consistent with their respective objects. Thresholds directly affect high- and low-frequency data objects, while capacity expansion directly affects the child data objects of high- and low-frequency data objects. Using high- and low-frequency data objects as management units avoids the overhead of individually tracking large numbers of small objects, improving overall system memory management efficiency and controllability. Data reading and writing adhere to two basic principles: 1. Memory priority: High-frequency data and small-volume low-frequency data are prioritized in memory to ensure rapid system response. 2. Dynamic adjustment: When the memory usage of low-frequency data reaches the threshold, the system automatically migrates the low-frequency data to disk, freeing up memory resources. By default, the upper limit of storage capacity expansion for low-frequency data is greater than the data volume threshold (equivalent to the memory usage) for low-frequency data.

[0071] In specific embodiments, the first data volume threshold described in the above embodiments may be used only during the creation of a data object to determine the target storage space when storing the corresponding data. After a data object has been created, if new data is acquired, a target storage space matching the new data may be determined based on the storage mode of the corresponding data object (memory storage or disk storage). Furthermore, the second data volume threshold described in the above embodiments is used during the storage of new data after the data object is created. The relationship between the total data volume of the data object and the second data volume threshold can be determined to facilitate space expansion or data migration. Furthermore, the first data volume threshold and the second data volume threshold can be the same, referred to as the target data volume threshold. That is, only the target data volume threshold is used to control the total data volume of the data object. During the initial data object creation and initial data storage, as well as subsequent additional data storage, only the relationship between the total data volume of the data object and the target data volume threshold is considered. In other words, when creating a data object, if the total data volume of the newly created data object exceeds the target data volume threshold, the relevant data is stored on disk, i.e., the storage mode is disk storage. If the total data volume of the newly created data object does not exceed the target data volume threshold, the relevant data is stored in memory, i.e., the storage mode is memory storage. When new data is added subsequently, the relationship between the new data and the existing data objects is determined to determine the corresponding storage mode; for example, if the target data object that matches the new data is memory storage, the new data will be stored in the memory space. At the same time, the relationship between the total data volume of the target data object and the target data volume threshold needs to be considered to expand the memory space or perform data migration operations on related sub-data objects.

[0072] Furthermore, the memory management strategy is as follows: 1. Fixed memory space setting: To avoid the efficiency loss caused by frequent data copy migrations during storage space expansion, a fixed-size memory space can be reserved for high-frequency data. This approach helps reduce memory fragmentation and improve system stability. The size of the fixed memory space can be pre-configured to ensure efficient memory allocation during high-frequency data storage. If the fixed memory space cannot meet the storage requirements of new data, old data is cleared in the order of data collection time (or other rules set by the user), and the space is released to store new data. 2. Dynamic expansion mechanism. It includes three actions: judging new data storage, expanding the space when it is insufficient, and migrating low-frequency data. Specifically, judging new data storage: If the data is stored in memory, check whether the current memory is sufficient to store the new data; if the data is stored on disk, check whether the disk space needs to be expanded. If the current space meets the storage requirements of the new data, store it directly; if not, perform the expansion operation. Expanding the space when it is insufficient: If the storage space is insufficient, dynamically apply for new storage space according to the expansion strategy preset by the user until it meets the storage requirements of the new data. The size of the expanded space is defined by the user, and the growth ratio or fixed increment can be flexibly set; after the new storage space is created, the system can automatically copy the data in the old space to the new space and release the resources of the old space to complete the mapping update; when the storage space reaches the expansion limit, old data is cleared in the order of data collection time (or other rules set by the user), and the space is released to store new data.

[0073] Correspondingly, during the migration of low-frequency data, when the total memory occupancy of the low-frequency data object to which the newly added sub-object of the new data belongs exceeds the set threshold after the sub-object expansion, the data migration process is triggered: First, a new storage area is dynamically allocated on the disk, and the sub-objects inside the low-frequency data object are sorted in descending order of memory occupancy. The sub-objects with larger memory occupancy are preferentially migrated to the disk storage area. During the migration process, the total memory occupancy of the remaining sub-objects is continuously calculated. Once it is lower than the current threshold, the migration stops, the remaining small-capacity sub-objects are retained in memory, and the original memory space occupied by the migrated data is released. And the mapping relationship between memory and disk is updated. When a sub-object is migrated to the disk, the corresponding mapping table entry points to the disk address, and the entry in memory only retains the information of the non-migrated sub-objects. The entire process is transparent to the upper-layer application to ensure no perception. At the same time, if all sub-objects are migrated to the disk, the storage method of the low-frequency data object is updated to disk storage; if there are still sub-objects retained in memory, the low-frequency data object is updated to a memory + disk hybrid storage mode. At the same time, the storage mode of the migrated sub-objects is switched to disk storage, and the storage mode of the non-migrated sub-objects remains memory storage. In a specific embodiment, in the load adaptive threshold mode, when the system automatically lowers the threshold due to increased load, the following rules can be followed: The written low-frequency data objects still follow the previous set threshold; the newly created low-frequency data objects follow the new set threshold.

[0074] It should be noted that low-frequency data supports a dynamic expansion mechanism, while high-frequency data supports a dynamic expansion mechanism and a fixed memory space setting. It should be explained that both high-frequency data objects and low-frequency data objects contain one or more sub-data objects inside. The data type of their sub-objects, the memory management strategy followed, is consistent with the object to which they belong. Through the data migration operation of each sub-data object of the low-frequency data object, some sub-data objects can be stored in the memory space, and some sub-data objects can be migrated to the disk space. In other words, the storage mode of high-frequency data is memory storage. While the storage mode of low-frequency data can be memory storage + disk storage. When the memory storage reaches a certain threshold condition, a data migration operation can be triggered to migrate the sub-data objects of the low-frequency data object in memory to disk storage; at the same time, the storage modes of the relevant low-frequency data objects and the migrated sub-objects can be updated, so that the storage mode of some sub-data objects (the data migrated to the disk) is disk storage, and the storage mode of the remaining sub-data objects in memory (the non-migrated low-frequency data) is memory storage.

[0075] Further, in a specific embodiment, during the process of creating a low-frequency data object, it is possible to determine whether to store the corresponding low-frequency data in the memory space according to a pre-set first data volume threshold. Further, for the newly added data of the low-frequency data after the data object is created, the storage location of the newly added data can be determined according to the storage modes (memory storage or disk storage) of the data object and sub-data objects corresponding to the newly added data; and when the newly added data is for memory storage, it is possible to determine whether to expand the memory space or perform a data migration operation according to the relationship between the memory occupancy of all the sub-data objects of the low-frequency data object stored in the memory and the second data volume threshold. It should be noted that the direct subject of action of the threshold is the high / low-frequency data object, and the direct subject of action for expansion is the sub-data object of the high / low-frequency data object.

[0076] In a specific embodiment, as Figure 4 shown, after the electronic measuring instrument obtains the newly added data, it can judge the newly added data as high-frequency data or low-frequency data by using a pre-set data object type. Further, for high-frequency data, it needs to be stored in the memory space, and the memory management strategy can be a fixed memory space or a dynamic expansion mechanism. For the case of a fixed memory space, it can be determined whether to clear the old data according to whether the storage capacity of the high-frequency data object exceeds the limit, and specifically, the data can be cleared according to the rules predefined by the user; then the newly added high-frequency data is stored using the memory space. Correspondingly, for the case of a dynamic expansion mechanism, if the current memory space meets the space condition for storing the newly added high-frequency data, it can be directly stored; if the space is insufficient, a new large memory space needs to be applied for according to the expansion strategy until the space condition for storing the high-frequency data is met; further, if the memory space reaches the expansion upper limit, the old data can be cleared according to the rules defined by the user to store the newly added high-frequency data; correspondingly, if the memory space after applying for the space does not reach the expansion upper limit, the data in the old space can be selected to be copied over and the newly added high-frequency data can be stored.

[0077] Correspondingly, for newly added low-frequency data, the storage mode of the newly added low-frequency data can be determined according to the storage mode (in-memory storage or disk storage) of the relevant sub-data objects. If the data sub-object corresponding to the newly added data is in-memory storage, it is necessary to consider whether the current memory space meets the space condition for storing the newly added low-frequency data, that is, to consider whether the sum of the data volumes of the sub-data objects related to the low-frequency data objects stored in the current memory space and the data volume of the newly added low-frequency data is less than the corresponding second data volume threshold. If it is satisfied, it can be directly stored; if not, a new large memory space can be applied according to the expansion strategy until the space condition for storing the newly added low-frequency data is met. Further, when the expansion reaches the set expansion upper limit threshold, consider the relationship between the total memory occupancy of the low-frequency data objects in the memory space and the second data volume threshold. If it exceeds the set second data volume threshold, data migration operations can be performed on the relevant data. Data migration specifically means migrating the relevant low-frequency data in the memory space to the disk space. It is necessary to open up an area in the disk space to sort and migrate the sub-objects of the low-frequency data objects to which they belong. It can be understood that after migrating the low-frequency data in the memory space to the disk space, the mapping relationship is updated at the same time, and the storage modes of the relevant low-frequency data objects and the migrated sub-objects are updated. When adding newly added low-frequency data subsequently, the target storage mode corresponding to the current newly added low-frequency data can be determined according to the storage modes of the relevant low-frequency data objects and sub-data objects, so as to store the current newly added low-frequency data using the memory space or disk space based on the target storage mode.

[0078] If the storage mode corresponding to the newly added low-frequency data is disk storage, it is necessary to consider whether the disk space meets the space condition for storing the newly added low-frequency data. If so, it can be directly stored; if not, it is necessary to expand the disk space. Specifically, a new large disk space is applied according to the expansion strategy until the space condition for storing the newly added low-frequency data is met. Correspondingly, if the disk space reaches the upper limit threshold during expansion, the old data in the disk space can be cleared according to the user-defined rules to store the newly added low-frequency data.

[0079] Further, in a specific embodiment, the second data volume threshold judges the data volume of the low-frequency data objects in the memory space, not for the sub-data objects; and multiple low-frequency data objects can be created in the memory space; if the data volume of a certain low-frequency data object is not less than the second data volume threshold, data migration operations can be performed on the sub-data objects related to the low-frequency data object, and at the same time, according to the execution situation of the data migration operation, the storage mode of the low-frequency data object is updated. For example, if some sub-data objects of a low-frequency data object are migrated to the disk, the storage mode of the low-frequency data object is memory + disk; among them, the storage mode of the sub-data objects migrated to the disk is disk storage, and the storage mode of the sub-data objects not migrated to the disk is memory storage.

[0080] In a specific embodiment, as Figure 5 shown, in the initialization stage of the electronic measurement instrument, the memory mapping configuration can be completed first, and then data reading and writing can be performed. Specifically, in the initialization stage, the system can apply for memory spaces for DMA buffers A and B in the physical memory of the data storage module according to the memory management policy; in order to efficiently use the high-frequency data in the two DMA buffers, two data buffers are also correspondingly opened in the user buffer of the data management module. The system maps the virtual memory addresses of data buffers A and B to DMA buffers A and B respectively through MMap (memory map) calls. Data acquisition writing and reading processing. The data acquisition module alternately writes the high-frequency data collected from the hardware into DMA buffers A and B through the PCIe bus. At any moment, while the data acquisition module writes data to one of the DMA buffers, the data management module can read data from the data buffer mapped from the other DMA buffer through the virtual memory address. The DMA controller notifies the system buffer status through the flag bit, and the system switches the data acquisition and reading tasks in real time according to the status to ensure that the two buffers always work alternately. In this way, by applying the DMA technology, zero-copy data transfer from the hardware to the memory can be realized without CPU intervention, significantly improving the data transfer efficiency and reducing the CPU burden. At the same time, the double-buffer mechanism avoids the gap between data acquisition and reading through the seamless switching of acquisition and reading, thereby preventing data interruption and ensuring the continuity and efficiency of the system. In addition, the data management module performs read and write operations on the mapped virtual memory address, which completes the read and write operations on the high-frequency data in the memory, eliminating the two-way copy operation between the user buffer and the kernel buffer and further accelerating the data transfer efficiency.

[0081] In a specific embodiment, as Figure 6 shown, the memory mapping configuration is completed in the system initialization stage, and then data reading and writing are performed. Specifically, the system can map the virtual address of the data buffer in the data management module to the physical memory area of the data storage module through MMap calls. For the processing process of low-frequency data objects, when the memory occupancy of the low-frequency data object reaches the set threshold (i.e., the second data volume threshold), the system automatically triggers the migration process; there are various setting methods for the memory occupancy threshold of low-frequency data, such as user-defined threshold, manual setting; static threshold preset by the system, that is, the default threshold; threshold adaptively adjusted by the electronic measurement instrument according to the system load; and the priority of this threshold is user-defined > load adaptive > default threshold. The calculation formula of the load adaptive threshold is as follows: , where is a custom coefficient, is the total system memory, is the current system load rate. Further, during the data migration process, the data management module dynamically allocates a new storage area on the disk, sorts the sub-objects of the low-frequency data objects in descending order according to the memory occupancy, and preferentially selects the sub-objects with larger occupancy for migration. The data storage module sequentially copies the selected sub-objects from the memory to the disk storage area and releases the original memory space after the migration is completed. During the migration process, the data management module continuously calculates the total memory occupancy of the remaining un-migrated sub-objects. Once it is lower than the currently set threshold, the migration stops, and these small-capacity sub-objects are retained in the memory to ensure the efficient use of storage resources. And the memory mapping module updates the mapping relationship between the memory and the disk. When a sub-object is migrated to the disk, the corresponding entry in the mapping table points to the disk address, while the entry in the memory only retains the information of the un-migrated sub-objects. The whole process is transparent to the upper-layer applications to ensure no perception. The data management module can update the storage mode of the data object in a timely manner. If all sub-objects are migrated to the disk, the storage mode of the low-frequency data object is updated to disk storage; if there are still sub-objects retained in the memory, the low-frequency data object is updated to a memory + disk hybrid storage mode. At the same time, the storage mode of the migrated sub-objects is switched to disk storage, and the storage mode of the un-migrated sub-objects remains memory storage. It can be understood that when the data management module performs a write operation on the virtual memory address, the system can synchronize the dirty pages to the disk file through the write-back mechanism to ensure data consistency and integrity. Through the memory mapping technology, the system reduces file I / O operations while achieving efficient memory management and data persistence, greatly improving the overall performance.

[0082] In a specific embodiment, taking a digital oscilloscope as an example, the waveform data input through the data transmission module of the digital oscilloscope belongs to high-frequency data, while the waveform data imported through the data import module and the waveform data generated after the functional area module performs mathematical operations on the existing waveform data belong to low-frequency data. An MMap mapping configuration is established in advance before storing the new data. The steps for storing the new data are as follows:

[0083] 001. The system obtains the new data through the data transmission module, the data import module, and the functional area module, calls the data management module to create a data object or find an existing data object, and the subsequent operation entity is the specific sub-object to which the new data belongs. The data management module determines the data object type. If it is low-frequency data, it executes 002; if it is high-frequency data, it executes 003.

[0084] 002. The data management module determines the storage mode of the data object. If it is memory storage, it executes 004; if it is disk storage, it executes 005.

[0085] 003. The data management module judges the memory management strategy of the data object. If it is a fixed memory space, it executes 011. If it is a dynamic expansion mechanism, it executes 012.

[0086] 004. The data management module judges whether the current memory space can store the newly added data. If it can, it executes 006. If it cannot, it applies for a new large memory space according to the expansion strategy until it can store the newly added data. It judges whether the total memory occupancy of the low-frequency data objects to which it belongs exceeds the set threshold. If not, it executes 007. If so, it executes 008.

[0087] 005. The data management module judges whether the current disk space can store the newly added data. If it can, it executes 006. If not, it applies for a new large disk space according to the expansion strategy until it can store the newly added data and then executes 010.

[0088] 006. The data management module performs a write operation on the mapped virtual memory address, and the newly added data is stored in the corresponding area of the data storage module.

[0089] 007. The data storage module performs data copying, copies the data in the old space to the new space and then releases the resources of the old space. The memory mapping module completes the mapping update and then executes 006.

[0090] 008. The data management module dynamically allocates a new large space on the disk, sorts the sub-objects of the low-frequency data objects to which it belongs in descending order of memory occupancy, and determines the list of sub-objects to be migrated first. Then, the data storage module performs specific data migration operations, copying the sub-objects with larger occupancy from memory to the disk storage area. During the migration process, the data management module continuously calculates the total memory occupancy of the un-migrated sub-objects. Once it is lower than the set threshold, it instructs the data storage module to stop the migration and retains these small-capacity sub-objects in memory. At the same time, the data storage module releases the original memory space occupied by the migrated data to reduce the memory pressure. The internal mapping module completes the mapping update. After executing 006, the data management module updates the storage modes of the low-frequency data objects to which it belongs and the migrated sub-objects.

[0091] 009. The data management module clears the old data in the corresponding area of the data storage module according to the user-defined rules, releases the space and then executes 006.

[0092] 010. The data management module judges whether the space occupancy of the high / low-frequency data objects to which it belongs reaches the expansion upper limit. If not, it executes 007. If so, it executes 009.

[0093] 011. The data management module judges whether the storage capacity of the high-frequency data objects to which it belongs reaches the limit. If so, it executes 009. If not, it executes 006.

[0094] 012. The data management module determines whether the current memory space is sufficient to store the newly added data. If so, it executes 006. If not, it applies for a new large memory space according to the expansion policy until the memory space is sufficient to store the newly added data, and then executes 010.

[0095] It can be seen that this application can implement the reading and writing of high-frequency data based on DMA and MMap, achieving zero-copy data transfer and seamless data stream processing; implement the reading and writing of low-frequency data based on MMap, achieving efficient data access. Moreover, high-frequency data and low-frequency data are preferentially stored in the memory space. When the occupation of low-frequency data in the memory space reaches the corresponding threshold, the low-frequency data can be migrated to the disk space, and the threshold can be dynamically adjusted to achieve efficient utilization of memory and disk and expand the storage capacity. In addition, the memory space and disk space can be dynamically expanded, optimizing resource utilization and achieving the balance between memory access performance and storage capacity. Further, during the data migration process, large-capacity data is preferentially released, which can quickly reduce the memory pressure and optimize the overall data access performance through the threshold.

[0096] As Figure 7 shown, an embodiment of this application discloses a data storage device, including:

[0097] A data acquisition module 11, configured to acquire the data to be stored of the electronic measuring instrument;

[0098] A data characteristic determination module 12, configured to determine the target data characteristics of the data to be stored, including the data acquisition method and the data volume; the data acquisition method is any one of a first acquisition method in which the electronic measuring instrument acquires data through local hardware, a second acquisition method in which data is generated through calculation, and a third acquisition method in which data is imported from the outside.

[0099] A storage module 13, configured to store the data to be stored in a target storage space among multiple storage spaces of the electronic measuring instrument based on at least one of the data acquisition method and the data volume.

[0100] It can be seen that this application can determine the corresponding data characteristics according to the data acquisition method and the data volume of the electronic measuring instrument; for the data to be stored with different characteristics, different storage spaces can be selected for storage, and flexible data storage is achieved through the combination of multiple storage spaces, which can meet the requirements of the electronic measuring instrument for different data access efficiencies as much as possible and improve the data management efficiency of the electronic measuring instrument.

[0101] In a specific embodiment, the storage module 13 may include:

[0102] A first storage space determination unit, configured to store the data to be stored in the memory space when the data acquisition method is the first acquisition method.

[0103] In a specific embodiment, the storage module 13 may include:

[0104] A first data volume relationship determination unit, configured to determine a first magnitude relationship between the data volume and a first data volume threshold when the data acquisition method is the second acquisition method or the third acquisition method;

[0105] A storage space determination sub-module, configured to store the data to be stored in a target storage space among multiple storage spaces of the electronic measuring instrument based on the first magnitude relationship.

[0106] In another specific embodiment, the storage space determination sub-module may include:

[0107] A second storage space determination unit, configured to store the data to be stored in the memory space when the data volume is less than the first data volume threshold;

[0108] A third storage space determination unit, configured to store the data to be stored in the disk space when the data volume is not less than the first data volume threshold.

[0109] In a specific embodiment, the storage module 13 may include:

[0110] A storage unit, configured to store the data to be stored in the memory space based on a double-buffer mechanism of direct memory access.

[0111] In a specific embodiment, the device may further include:

[0112] A data volume determination module, configured to determine the data volume of the target written data in the memory space;

[0113] A second data volume relationship determination module, configured to determine a second magnitude relationship between the data volume of the target written data and a second data volume threshold;

[0114] A data migration operation execution determination module, configured to determine whether to execute a data migration operation on the target written data based on the second magnitude relationship; wherein, the target written data is data acquired by the second acquisition method and the third acquisition method.

[0115] In another specific embodiment, the data migration operation execution determination module may include:

[0116] A data migration operation execution sub-module, which is used to execute a data migration operation for the data already written to the target when the amount of data already written to the target is not less than the second data volume threshold; wherein, the data migration operation is an operation of migrating data to the disk space.

[0117] In another specific embodiment, the data migration operation execution sub-module may include:

[0118] A memory occupancy determination unit, which is used to determine the memory occupancy of each piece of data in the data already written to the target;

[0119] A data migration unit, which is used to execute a data migration operation for the data already written to the target based on the order of the memory occupancy from large to small.

[0120] In one specific embodiment, the device may further include:

[0121] A load determination module, which is used to determine the current system load of the electronic measuring instrument;

[0122] A data volume threshold adjustment module, which is used to adjust the second data volume threshold based on the current system load.

[0123] In one specific embodiment, the device may further include:

[0124] A first space adequacy determination module, which is used to determine the first space adequacy of the current memory space;

[0125] A first data clearing operation execution determination module, which is used to determine whether to execute a first data clearing operation based on the first space adequacy; wherein, the first data clearing operation is an operation of clearing data from the memory space based on the chronological order of storage time of each piece of data already written in the memory space.

[0126] In one specific embodiment, the device may further include:

[0127] A second space adequacy determination module, which is used to determine the second space adequacy of the current target storage space;

[0128] A space application determination module, which is used to determine whether to apply for a new storage space for the target storage space based on the second space adequacy.

[0129] In another specific embodiment, the device may further include:

[0130] A space size determination module, which is used to determine the current space size of the target storage space;

[0131] A second space sufficiency determination module, configured to determine a third space sufficiency of the current target storage space when the current space size reaches a preset capacity upper limit threshold;

[0132] A second data clearing operation execution determination module, configured to determine whether to execute a second data clearing operation based on the third space sufficiency; wherein, the second data clearing operation is an operation of performing data clearing on the target storage space based on the storage time sequence of each written data in the target storage space.

[0133] In a specific embodiment, the apparatus may further include:

[0134] A to-be-mapped data determination module, configured to determine to-be-mapped data from the written data in the target storage space;

[0135] A data mapping module, configured to map the to-be-mapped data to a data buffer in the user space through a file mapping mechanism;

[0136] An access request response module, configured to, when an access request for the to-be-mapped data is obtained, respond to the access request by using the data buffer.

[0137] Furthermore, an embodiment of the present application also discloses an electronic device, Figure 8 is a structural diagram of an electronic device 20 shown according to an exemplary embodiment, and the content in the figure cannot be considered as any limitation to the usage scope of the present application.

[0138] Figure 8 is a structural schematic diagram of an electronic device 20 provided by an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. Wherein, the memory 22 is used to store a computer program, and the computer program is loaded and executed by the processor 21 to implement relevant steps in the data storage method disclosed in any of the foregoing embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.

[0139] In this embodiment, the power supply 23 is used to provide a working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows is any communication protocol applicable to the technical solution of the present application, and specific limitations are not imposed on it here; the input / output interface 25 is used to obtain external input data or output data to the outside, and its specific interface type can be selected according to specific application requirements, and specific limitations are not imposed here.

[0140] In addition, as a carrier for storing resources, the memory 22 can be a read-only memory, a random access memory, a magnetic disk, an optical disc, etc. The resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.

[0141] Among them, the operating system 221 is used to manage and control each hardware device and the computer program 222 on the electronic device 20, and it can be Windows Server, Netware, Unix, Linux, etc. In addition to the computer program capable of implementing the data storage method executed by the electronic device 20 disclosed in any of the foregoing embodiments, the computer program 222 can further include a computer program capable of performing other specific tasks.

[0142] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the foregoing disclosed data storage method is implemented. For the specific steps of this method, reference can be made to the corresponding content disclosed in the foregoing embodiments, and details will not be repeated here.

[0143] Furthermore, the present application also discloses a computer program product, including a computer program / instructions, and when the computer program / instructions are executed by a processor, the data storage method as described above is implemented.

[0144] In this specification, the various embodiments are described in a progressive manner. Each embodiment focuses on the differences from other embodiments, and the same or similar parts among the various embodiments can be referred to each other. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the method part.

[0145] Those skilled in the art can further realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed in this article can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the composition and steps of the examples have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.

[0146] The steps of the methods or algorithms described in connection with the embodiments disclosed herein may be implemented directly in hardware, in software modules executed by a processor, or in a combination thereof. The software modules may be placed in a random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium well-known in the art.

[0147] Finally, it should also be noted that in this document, 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 actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover a non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the phrase "comprising a..." does not exclude the presence of additional identical elements in the process, method, article or device comprising the element.

[0148] The technical solutions provided in this application have been introduced in detail above. Specific examples are used herein to illustrate the principles and implementation manners of this application. The description of the above embodiments is only used to help understand the method and its core idea of this application; at the same time, for those of ordinary skill in the art, according to the idea of this application, there will be changes in the specific implementation manners and application scopes. In summary, the content of this specification should not be construed as a limitation to this application.

Claims

1. A data storage method, characterized in that, Including: Obtaining the data to be stored in an electronic measuring instrument; Determining the data acquisition method and data volume of the data to be stored; the data acquisition method is any one of a first acquisition method in which the electronic measuring instrument acquires data through local hardware, a second acquisition method in which data is generated through operation, and a third acquisition method in which data is imported from the outside; Based on at least one characteristic of the data acquisition method and the data volume, storing the data to be stored in a target storage space among multiple storage spaces of the electronic measuring instrument.

2. The data storage method according to claim 1, wherein: The multiple storage spaces include the memory space and the disk space of the electronic measuring instrument.

3. The data storage method according to claim 2, characterized in that, The storing the data to be stored in a target storage space among multiple storage spaces of the electronic measuring instrument based on at least one characteristic of the data acquisition method and the data volume includes: If the data acquisition method is the first acquisition method, storing the data to be stored in the memory space.

4. The data storage method according to claim 2, wherein The storing the data to be stored in a target storage space among multiple storage spaces of the electronic measuring instrument based on at least one characteristic of the data acquisition method and the data volume includes: If the data acquisition method is the second acquisition method or the third acquisition method, determining a first magnitude relationship between the data volume and a first data volume threshold; Based on the first magnitude relationship, storing the data to be stored in a target storage space among multiple storage spaces of the electronic measuring instrument.

5. The data storage method according to claim 4, wherein The storing the data to be stored in a target storage space among multiple storage spaces of the electronic measuring instrument based on the first magnitude relationship includes: If the data volume is less than the first data volume threshold, storing the data to be stored in the memory space; If the data volume is not less than the first data volume threshold, storing the data to be stored in the disk space.

6. The data storage method according to any one of claims 2 to 5, characterized in that If the target storage space is the memory space, the storing the data to be stored in the memory space includes: Based on a double-buffer mechanism of direct memory access, storing the data to be stored in the memory space.

7. The data storage method according to any one of claims 2 to 6, characterized in that: Also including: Determining the data volume of the target written data in the memory space; Determining a second magnitude relationship between the data volume of the target written data and a second data volume threshold; Based on the second magnitude relationship, determining whether to perform a data migration operation on the target written data; Wherein, the target written data is data obtained through the second acquisition method and the third acquisition method.

8. The data storage method according to claim 7, wherein The determining whether to perform a data migration operation on the target written data based on the second magnitude relationship includes: If the data volume of the target written data is not less than the second data volume threshold, performing a data migration operation on the target written data; Wherein, the data migration operation is an operation of migrating data to the disk space.

9. The data storage method according to claim 8, wherein The performing a data migration operation on the target written data includes: Determining the memory occupancy of each data in the target written data; Perform a data migration operation on the target written data in descending order based on the memory occupancy.

10. The data storage method according to any one of claims 7 to 9, characterized in that, Further included: Determine the current system load of the electronic measuring instrument; Adjust the second data volume threshold based on the current system load.

11. The data storage method according to any one of claims 2 to 10, characterized in that, If the data acquisition method is the first acquisition method and the memory space does not support dynamic expansion, then during the process of storing the data to be stored in a target storage space among multiple storage spaces of the electronic measuring instrument, it further includes: Determine the first space adequacy of the current memory space; Determine whether to perform a first data clearing operation based on the first space adequacy; Wherein, the first data clearing operation is an operation of clearing data from the memory space based on the chronological order of storage times of the written data in the memory space.

12. The data storage method according to any one of claims 1 to 10, characterized in that, If the target storage space supports dynamic expansion, then during the process of storing the data to be stored in a target storage space among multiple storage spaces of the electronic measuring instrument, it further includes: Determine the second space adequacy of the current target storage space; Determine whether to apply for a new storage space for the target storage space based on the second space adequacy.

13. The data storage method according to claim 12, wherein After applying for a new storage space for the target storage space, it further includes: Determine the current space size of the target storage space; If the current space size reaches a preset capacity upper limit threshold, then determine the third space adequacy of the current target storage space; Determine whether to perform a second data clearing operation based on the third space adequacy; Wherein, the second data clearing operation is an operation of clearing data from the target storage space based on the chronological order of storage times of the written data in the target storage space.

14. The data storage method according to any one of claims 1 to 13, characterized in that: Further included: Determine the data to be mapped from the written data in the target storage space; Map the data to be mapped to a data buffer in the user space through a file mapping mechanism; When an access request for the data to be mapped is obtained, use the data buffer to respond to the access request.

15. A data storage device, characterized in that, Included: A data acquisition module for acquiring data to be stored in the electronic measuring instrument; A data characteristic determination module for determining the data acquisition method and data volume of the data to be stored; the data acquisition method is any one of a first acquisition method in which the electronic measuring instrument acquires data through local hardware, a second acquisition method in which data is generated through calculation, and a third acquisition method in which data is imported from the outside; A storage module for storing the data to be stored in a target storage space among multiple storage spaces of the electronic measuring instrument based on at least one characteristic of the data acquisition method and the data volume.

16. An electronic device, characterized in that, Included: A memory for storing a computer program; A processor for executing the computer program to implement the data storage method according to any one of claims 1 to 14.

17. A computer-readable storage medium, characterized in that, For storing a computer program, the computer program, when executed by a processor, implements the data storage method according to any one of claims 1 to 14.

18. A computer program product, comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by a processor, the data storage method according to any one of claims 1 to 14 is implemented.

Citation Information

Patent Citations

  • Data dynamic storage method and device, electronic equipment and storage medium

    CN114528231A

  • Data storage method and device, electronic equipment and storage medium

    CN116166187A

  • Local data time sequence storage method

    CN117076523A

  • Vehicle end data storage and export method, device and equipment and storage medium

    CN118467797A

  • File storage method and device, equipment and medium

    CN119620952A

Cited By

  • Data storage method, storage medium, electronic device and program product

    CN120723174A