WO2020062985A1 - Block device access tracking method and apparatus, storage medium and terminal - Google Patents

Block device access tracking method and apparatus, storage medium and terminal Download PDF

Info

Publication number
WO2020062985A1
WO2020062985A1 PCT/CN2019/093718 CN2019093718W WO2020062985A1 WO 2020062985 A1 WO2020062985 A1 WO 2020062985A1 CN 2019093718 W CN2019093718 W CN 2019093718W WO 2020062985 A1 WO2020062985 A1 WO 2020062985A1
Authority
WO
WIPO (PCT)
Prior art keywords
preset
block device
device access
called
function
Prior art date
Application number
PCT/CN2019/093718
Other languages
French (fr)
Chinese (zh)
Inventor
周明君
方攀
陈岩
Original Assignee
Oppo广东移动通信有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Publication of WO2020062985A1 publication Critical patent/WO2020062985A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3466Performance evaluation by tracing or monitoring
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment

Definitions

  • the embodiments of the present application relate to the technical field of terminals, for example, to a method and device for tracking access to a block device, a storage medium, and a terminal.
  • the embodiments of the present application provide a method, an apparatus, a storage medium, and a terminal for tracking access to a block device, which can optimize a block device access tracking solution.
  • an embodiment of the present application provides a method for tracking access to a block device, including:
  • the block device access information is stored in a storage format corresponding to the preset virtual machine for user space reading.
  • an embodiment of the present application provides a block device access tracking apparatus, including:
  • a judging module configured to determine, when a preset block device access event is triggered, whether a preset program code written based on a preset virtual machine exists in a kernel space before a function to be called corresponding to the preset block device access event;
  • the access information acquisition module is configured to acquire, when the judgment result of the judgment module is present, the access information of the block device corresponding to the function to be called through the preset program code;
  • the access information storage module is configured to store the block device access information in a storage format corresponding to the preset virtual machine for user space to read.
  • an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored.
  • the program is executed by a processor, the block device access tracking method according to the embodiment of the present application is implemented.
  • an embodiment of the present application provides a terminal, including a memory, a processor, and a computer program stored in the memory and executable by the processor.
  • the processor executes the computer program, the implementation is implemented as in the embodiment of the present application.
  • the block device access tracking method is implemented as in the embodiment of the present application.
  • FIG. 1 is a schematic flowchart of a method for tracking access to a block device according to an embodiment of the present application
  • FIG. 2 is a schematic flowchart of another block device access tracking method according to an embodiment of the present application.
  • FIG. 3 is a schematic flowchart of still another block device access tracking method according to an embodiment of the present application.
  • FIG. 4 is a structural block diagram of a block device access tracking apparatus according to an embodiment of the present application.
  • FIG. 5 is a schematic structural diagram of a terminal according to an embodiment of the present application.
  • FIG. 6 is a schematic structural diagram of still another terminal provided by an embodiment of the present application.
  • FIG. 1 is a schematic flowchart of a block device access tracking method according to an embodiment of the present application.
  • the method may be executed by a block device access tracking device, where the device may be implemented by software and / or hardware, and may generally be integrated in a terminal. As shown in FIG. 1, the method includes steps 101, 102 and 103.
  • step 101 when a preset block device access event is triggered, it is determined whether there is a preset program code written based on a preset virtual machine in a kernel space before a function to be called corresponding to the preset block device access event.
  • the terminal in the embodiment of the present application may include a device provided with an operating system, such as a mobile phone, a tablet computer, a notebook computer, a computer, and a smart home appliance.
  • an operating system such as a mobile phone, a tablet computer, a notebook computer, a computer, and a smart home appliance.
  • the type of the operating system is not limited in the embodiments of the present application, and may include, for example, an Android operating system, a Windows operating system, and an Apple operating system.
  • the kernel is generally implemented based on Linux.
  • Input / output (I / O) devices in Linux are mainly divided into two types, character devices and block devices. The two devices themselves are not strictly limited, but are based on different functions. Classification. Character devices can provide a continuous data stream, and applications can read them sequentially. Usually, random access is not supported. On the contrary, such devices support byte / character reading and writing of data. For example, keyboards, serial ports, and modems are all Typical character device.
  • For block devices information is stored in fixed-size blocks. Each block has its own address.
  • Block device the application can address any location on the disk and read data from it.
  • data can only be read and written in multiples of blocks (usually 512B).
  • block devices do not support character-based addressing.
  • a block is a basic unit of data processing such as a kernel or a file system, and a block is composed of one or more sectors.
  • the embodiments of this application will take the Android operating system as an example for subsequent description.
  • the terminal's Android operating system access to various types of files is very frequent, and access to files also generates access to block devices. How to optimize access to block devices is an important part of the system optimization topic.
  • a Linux kernel-level tracing framework similar to ftrace or blktrace may be used to implement block device access tracking.
  • the earliest ftrace is a function tracer, which can only record the function call process of the kernel.
  • Now ftrace has developed into a framework, which can be used to support developers to add more kinds of traces (plugin).
  • the trace) function helps developers understand the runtime behavior of the Linux kernel for fault debugging or performance analysis. Therefore, it can be used to trace block device access.
  • a tracing framework such as ftrace to perform block device access tracking
  • the collected information is written into a ring buffer (ring buffer), and operations such as filtering or statistics cannot be performed during the collection process, and kernel information is collected.
  • the user space program will continuously read the content in the ring buffer, and then User space performs operations such as filtering, calculation, or statistics on the read information. In this way, a large number of kernel space and user space interactions will be generated, and user space programs will occupy a large number of processors, such as central processing unit (CPU) resources.
  • CPU central processing unit
  • blktrace is a tracing framework for the block device layer.
  • the specific working method is similar to ftrace, so it also has the same problems as above.
  • block device access tracking may be implemented based on a preset virtual machine implemented in a kernel space.
  • the preset block device access event may include synchronous read, synchronous write, asynchronous read, asynchronous write, and the like.
  • other block device access events may also be included.
  • the types or names of the block device access events may be different in different operating systems, and those skilled in the art may make adaptive selections according to the actual operating system used.
  • the bottom layer of the system is generally Linux Kernel.
  • the system divides kernel space and user space. Different operating systems may have different division methods or results.
  • User space generally refers to the memory area where the user process is located.
  • Application programs run in user space, and user process data is stored in user space.
  • Kernel space is the memory area occupied by the operating system.
  • the operating system and drivers run in kernel space.
  • the data is stored in the system space. In this way, user data and system data can be isolated to ensure system stability.
  • System calls can be understood as a set of all system calls provided by the operating system implementation, that is, a program interface or application programming interface (Application Programming Interface, API).
  • the main function of the operating system is to manage hardware resources and provide a good environment for application developers to make applications more compatible.
  • the kernel provides a series of multi-kernel functions with predetermined functions. Groups of interfaces called system calls are presented to the user. The system call passes the application's request to the kernel, calls the corresponding kernel function to complete the required processing, and returns the processing result to the application.
  • the kernel space needs to be accessed through a system call, that is, the corresponding system call interface needs to be called to access the kernel space. Therefore, events can be accessed according to a preset block device Whether the corresponding system call interface is called to determine whether the preset block device access event is triggered. If it is called, it can be considered that the preset block device access event is triggered.
  • each preset block device access event corresponds to a corresponding function to be called, and is used to implement synchronous read, synchronous write, asynchronous read, and asynchronous write.
  • the specific implementation form of the function may be different in different operating systems, which are not limited in the embodiments of the present application.
  • a preset program code writing method based on a preset virtual machine may be used in advance, and a preset program code is inserted before a function to be called in the kernel space, and the preset program code is used to obtain block device access information.
  • the preset block device access event when the preset block device access event is triggered, it can be determined whether there is a preset program code written based on the preset virtual machine, and then it is determined whether the preset program code is executed first or the code corresponding to the function to be called is directly executed. Inserting the preset program code based on the preset virtual machine can ensure the stability of the system.
  • step 102 if there is, the block device access information corresponding to the function to be called is obtained through the preset program code.
  • the preset program code when it is determined that a preset program code exists, the preset program code may be executed first, and then the function to be called is executed.
  • the preset program code is used to perform information related to block device access when executing the function to be called. This information is acquired in the embodiments of the present application as block device access information.
  • the block device access information may include detailed information reflecting the block device access process, such as which block device is accessed, which file is accessed in the block device, and the specific access method, etc.
  • the block device access information includes a size of a transmission data amount and a transmission delay when a data transmission process corresponding to the preset block device access event ends.
  • the transmission delay may represent a time interval between the initiation of the access request and the completion of the access request (that is, the end of the data transmission process for the access request).
  • step 103 the block device access information is stored in a storage format corresponding to the preset virtual machine for user space reading.
  • the acquired block device access information is stored by using a preset storage format corresponding to a virtual machine, instead of storing in a kernel standard format, which can save storage space.
  • User space does not need to constantly read the block device access information, but can read the required block device access information periodically or when needed, which can effectively reduce the number of interactions between kernel space and user space.
  • Adopting a preset virtual machine storage format the amount of read information is less, and the amount of transmission is small, so the amount of interactive data is also reduced, thereby reducing the burden of block device access tracking on the system and improving system stability.
  • the preset program code obtains the block device access information corresponding to the function to be called through the preset program code, and stores the block device access information by using a preset storage format corresponding to the virtual machine for user space reading.
  • a preset program code can be inserted before a function to be called corresponding to a preset block device access event in the kernel space, and the preset program code can be used to obtain And store block device access information for user space reading, which can reduce the interaction between kernel space and user space, reduce the burden of block device access tracking on the system, and improve system stability.
  • before the determining whether there is a preset program code written based on a preset virtual machine in a kernel space to be called corresponding to the preset block device access event includes: determining a block in the kernel space In the device layer, whether a preset program code written based on a preset virtual machine exists at a start position of a function to be called corresponding to the preset block device access event.
  • the advantage of this setting is that it does not destroy related code in kernel space.
  • the block device layer is also called the general block layer.
  • the function to be called for implementing block device access is generally in this layer.
  • a program based on a preset virtual machine can be written at the starting position of the function to be called, and used to obtain
  • the block device access information makes the timing and location of the preset program code more clear when it is determined whether the preset program code exists, and ensures that the preset program code can be successfully executed.
  • the access method which generally includes memory access and physical device access. If it is determined that the physical device access is made, continue to determine the block in the kernel space In the device layer, whether a preset program code written based on a preset virtual machine exists at a start position of a function to be called corresponding to the preset block device access event.
  • obtaining the block device access information corresponding to the function to be called through the preset program code includes: obtaining the standby device information through the preset program code.
  • the advantage of this setting is that it can successfully and accurately obtain the size of the amount of transmitted data in the block device access information.
  • the amount of data transferred may exist in the function parameters; it may also exist in the corresponding kernel data structure, and the kernel data structure may also exist in the function parameters.
  • the existing form is not limited. After obtaining the content of the function parameters or the content of the kernel data structure, it may need to be converted to obtain the finally required block device access information.
  • the functions to be called include a first to-be-called function corresponding to a block device request initiation event and a second to-be-called function corresponding to a block device request completion event.
  • obtaining the block device access information corresponding to the function to be called through the preset program code includes: obtaining the first time when the first to be called function is called through the preset program code. A time, and a second time when the second function to be called is called; and a corresponding transmission delay is determined according to a difference between the second time and the first time.
  • the driver's input / output (I / O) operations on the block device that is, when the block device is accessed, a request is made to the block device, which is described by the request structure in the driver, and the corresponding called function is recorded Is the first function to be called.
  • the request speed is very slow.
  • the kernel provides a queue mechanism to add these I / O requests to the queue (which can be called a request queue), which is described by the request_queue structure in the driver.
  • the access to the block device is completed, that is, when the request is completed, it is necessary to return to indicate whether the requested data has been transmitted, and the corresponding called function is recorded as the second function to be called. Therefore, the transmission delay corresponding to the preset block device access event can be determined according to the time difference between calling the two functions to be called.
  • the preset virtual machine includes an extended Berkeley Packet Filter (eBPF), and a storage format corresponding to the preset virtual machine includes a hash table.
  • eBPF is a set of virtual machines implemented in the kernel. It was originally designed to filter network packets. Now it has the ability to insert and execute virtual machine code anywhere in the kernel, and generally inserts virtual machine code. A large number of tests will be performed before to ensure that the stability of the system will not be affected.
  • the storage format specified in eBPF includes a hash table (hash table), which is also called a hash table. It is a data structure that is directly accessed according to a key value (Key value, referred to as a key value). Map to a location in the table to access records to speed up lookups. The advantage of this setting is that it can further ensure system stability and reduce interaction between kernel space and user space.
  • storing the block device access information in a storage format corresponding to the preset virtual machine includes: using a process identifier corresponding to the preset block device access event and the block device access
  • the information serves as a key value of the hash table, and the number of occurrences of a preset block device access event that matches the key value is stored in a hash table corresponding to the preset block device access event.
  • the process identifier may be a process identification (ID), and the process identifier corresponding to the preset block device access event may be understood as the ID of the process that triggered the preset block device access event.
  • the number of occurrences of the preset block device access event matching the key value can be understood as the number of occurrences of the preset block device access event with the same block device access information for the same process ID.
  • the block device access information including the size of transmission data and transmission delay as an example
  • process A triggers a preset block device access event 4 times
  • the size of the first transmission data amount is 2pages (assuming that the unit is memory pages), and the transmission delay 2ms
  • the size of the second transfer of data is 3pages (assuming memory pages as a unit)
  • the transfer delay is 2ms
  • the size of the third transfer of data is 2pages (assuming memory pages)
  • the transfer delay is 2ms
  • the size of the 4th transmission data amount is 3pages (assuming memory pages as a unit)
  • the transmission delay is 1ms.
  • A22 can be used as the first key value
  • a means process A the first 2 means the amount of data transmitted is 2pages, the second 2 means the transmission delay is 2ms, and the storage content corresponding to the first key value is 2 times;
  • A32 is the second key value and the corresponding storage content is 1 time;
  • A31 is the second key value and the corresponding storage content is 1 time. It can be understood that the arrangement order of the process identifier and the block device access information in the key value is not limited.
  • a separate hash table may be allocated respectively.
  • synchronous read corresponds to hash table 1
  • synchronous write corresponds to hash table 2
  • other requests correspond to hash table 3.
  • the advantage of this setting is that the access information corresponding to different preset block device access events can be stored independently, which is convenient for subsequent query and analysis.
  • there may be multiple block devices in the terminal which can be further subdivided according to block devices. Each block device can contain multiple hash tables, and these multiple hash tables correspond to synchronous read, synchronous write, and other requests respectively.
  • the method before the storing the block device access information by using the storage format corresponding to the preset virtual machine, the method further includes: obtaining a preset hash table, wherein the preset hash table Passed from the user space to the kernel space, filter condition information is stored in the preset hash table; and the block device access information is filtered according to the filter condition information in the preset hash table.
  • storing the block device access information by using the storage format corresponding to the preset virtual machine includes storing the filtered block device access information by using the storage format corresponding to the preset virtual machine.
  • filtering can be forward filtering or reverse filtering.
  • the preset hash table is passed from the user space to the kernel space, which can support the user to set the preset hash table by himself, such as selecting an application that he cares about (can be represented by a user ID, that is, each application There is a corresponding user ID) or a process (which can be represented by the process ID) as the filtering condition information, instructing the kernel space to filter out block access information corresponding to these applications or processes for storage.
  • the user ID or process ID can be used as the key value
  • the filtering method can be used as the corresponding storage content (such as reserved or filtered out).
  • the filtering mode can be used as the key value, and the user ID or process ID can be used as the key value.
  • Corresponding storage content and so on. it may further include: receiving a filtering condition setting operation through user space, generating a preset hash table according to the filtering condition setting operation, and passing the preset hash table from the user space to The kernel space.
  • the method further includes: receiving the user space in the kernel space.
  • a hash table corresponding to the preset block device access event is queried according to the preset read request, and the query result is fed back to the user space.
  • further operations such as analysis or statistics may be performed on the query result in the user space. For example, count the number of occurrences of access events with the same transmission delay; for example, count the number of occurrences of access events with the same transmission data size; for another example, the correspondence between the amount of transmission data and the transmission delay, and so on. Exemplarily, it may be displayed in the form of a histogram or a heat map.
  • a histogram of transmission delay obtained according to the query result statistics is displayed on the terminal display screen (for example, the horizontal axis is the transmission delay and the unit is ms; the vertical axis is the number of occurrences ), Transmission size histogram (such as the horizontal axis is the amount of transmitted data, the unit is pages; the vertical axis is the number of occurrences) and the transmission size vs. the transmission delay heat map (the horizontal axis is the amount of transmitted data, the unit is pages; the vertical axis is Transmission delay in ms; shades of color indicate the number of occurrences).
  • three graphs may be corresponding to the synchronous read, synchronous write, and other requests.
  • FIG. 2 is a schematic flowchart of another block device access tracking method according to an embodiment of the present application. Taking a preset virtual machine as an eBPF as an example, the method includes the following steps 201 to 207.
  • step 201 it is detected that a preset block device access event is triggered.
  • whether a preset block device access event is triggered may be determined according to whether a system call interface corresponding to the preset block device access event is called. If it is called, the preset block device access event may be considered to be triggered. Preset block device access events can include synchronous read, synchronous write, asynchronous read, asynchronous write, and so on.
  • step 202 it is determined whether there is a preset program code written based on eBPF in the block device layer in the kernel space at the starting position of the first function to be called corresponding to the preset block device access event. Go to step 203; otherwise, go to step 207.
  • the functions to be called include a first to-be-called function corresponding to the block device request initiation event and a second to-be-called function corresponding to the block device request completion event.
  • the first function to be called is called first, so it can be directly determined whether an eBPF program exists at the starting position of the first function to be called.
  • step 203 the contents of the function parameters corresponding to the first to-be-called function and the second to-be-called function are obtained through preset program code, and the first moment when the first to-be-called function is called, and the second to-be-called function is called. The second moment when called.
  • the preset program code can be executed first, and then the function to be called is executed.
  • the block device access information generally exists in the function parameters. Therefore, the preset program code can be used to treat the content of the function parameters involved in the execution of the called function. Obtain. In addition, you need to record the moment when the function to be called is called.
  • the kernel space generally allocates a memory address for each request, and the allocated memory address can be used as the request ID for this request.
  • step 204 the size of the amount of transmission data corresponding to the function to be called is determined according to the content of the function parameters, and the corresponding transmission delay is determined according to the difference between the second time and the first time.
  • the kernel parameter structure may be included in the function parameter content, and the kernel data structure may be further converted to obtain the size of the final required transmission data amount. Query the second time and the first time corresponding to the same request ID from the hash table, and then calculate the transmission delay.
  • step 205 the process identifier corresponding to the preset block device access event, the size of the transmission data amount, and the transmission delay are used as key values of the hash table, and the number of occurrences of the preset block device access event matching the key value is stored.
  • a hash table corresponding to the preset block device access event In a hash table corresponding to the preset block device access event.
  • step 206 when a preset read request in user space is received in the kernel space, a hash table corresponding to the preset block device access event is queried according to the preset read request, and the query result is fed back to the User space.
  • step 207 the first function to be called is executed.
  • the preset program code may indicate that the current block device access event is not concerned, and there is no need to track the current block device access. It is not necessary to obtain corresponding block device access information, and the first function to be called can be directly executed.
  • the block device access tracking method provided in the embodiment of the present application uses the eBPF framework to implement real-time block device access statistics in the kernel, and inserts the eBPF program at the starting position of the function to be called to implement the block device access information acquisition. It is stored in the hash table.
  • the kernel space queries the hash table according to the preset read request and feeds back the query result to the user space.
  • Practice has proved that the amount of each transmission can be reduced to tens of KB. It can be seen that by adopting the solution provided in the embodiment of the present application, the interaction between the kernel space and the user space can be effectively reduced, the burden of the block device access tracking on the system, and the system stability can be improved Sex.
  • FIG. 3 is a schematic flowchart of another block device access tracking method according to an embodiment of the present application. The method includes steps 301 to 310.
  • step 301 a filtering condition setting operation is received through user space, and a first hash table is generated according to the filtering condition setting operation.
  • the terminal device access tracking setting interface may be displayed to the user in the terminal, and the user may enter a filtering condition setting operation based on the setting interface, such as selecting an application or process that he or she cares about as a target application or target process.
  • the user space generates a first hash table according to the filtering condition setting operation input by the user, and is used to instruct the kernel space to track the block device access initiated by the target application or target process in real time.
  • step 302 the first hash table is passed from user space to kernel space.
  • step 303 it is detected that the preset block device access event is triggered.
  • step 304 in the virtual file system layer in the kernel space, a preset program code written based on eBPF is detected at a start position of a first function to be called corresponding to a preset block device access event.
  • step 305 the contents of the function parameters corresponding to the first to-be-called function and the second to-be-called function are obtained through preset program code, and the first moment when the first to-be-called function is called, and the second to-be-called function is called. The second moment when called.
  • step 306 the size of the amount of transmission data corresponding to the function to be called is determined according to the content of the function parameters, and the corresponding transmission delay is determined according to the difference between the second time and the first time.
  • step 307 the size of the transmission data amount and the transmission delay are filtered according to the filtering condition information in the first hash table.
  • the target application it can be judged whether the size of the current transmission data amount and the transmission target corresponding to the transmission delay belong to the target application (or whether it is a target process). If yes, it means that the block device access that needs to be tracked can be used to transfer the amount of data The size and transmission delay are retained; if not, it means that the block device access that does not need to be tracked, and the size of the current transmission data amount and transmission delay can be ignored, that is, filtering is performed.
  • step 308 the process identifier, the size of the filtered transmission data amount, and the transmission delay are used as key values of the hash table, and the number of occurrences of a preset block device access event matching the key values is stored to obtain the first Two hash tables.
  • the process identifier, the size of the filtered transmission data amount, and the transmission delay can be combined into a continuous string to form the key value of the second hash table.
  • step 309 when the kernel space receives a preset read request from the user space, the second hash table is queried according to the preset read request, and the query result is fed back to the user space.
  • step 310 the query results are counted through user space, and a transmission delay histogram, a transmission size histogram, and a transmission size vs. transmission delay heat map are displayed.
  • the block device access tracking method provided in the embodiments of the present application can be set in advance by a user on an initiating object that needs to be tracked for access, and after the block device access information is obtained through the eBPF program in the kernel space, corresponding filtering is performed according to the user's settings.
  • Re-storing in the hash table can not only further reduce the storage amount, but also enhance the targeting and personalization of block device access tracking.
  • user space needs to read block device access information, it can further reduce kernel space and user space.
  • the interaction enables lightweight file tracking, which is beneficial for deployment to mass production systems.
  • the read access information of the block device is counted and displayed in the form of charts, which is convenient for the analysis and optimization of the block device access.
  • FIG. 4 is a structural block diagram of a block device access tracking device according to an embodiment of the present application.
  • the device may be implemented by software and / or hardware, and is generally integrated in a terminal.
  • Block device access may be performed by executing a block device access tracking method. track.
  • the device includes a judgment module 401, an access information acquisition module 402, and an access information storage module 403.
  • the judging module 401 is configured to judge whether a preset program code written based on a preset virtual machine exists in a kernel space before a function to be called corresponding to the preset block device access event is triggered when a preset block device access event is triggered. .
  • the access information acquisition module 402 is configured to acquire the block device access information corresponding to the function to be called through the preset program code when the judgment result of the judgment module is present.
  • the access information storage module 403 is configured to store the block device access information in a storage format corresponding to the preset virtual machine for reading by user space.
  • the block device access tracking device when a preset block device access event is triggered, if it is determined that a function to be called corresponding to the preset block device access event exists in the kernel space and is written based on a preset virtual machine, The preset program code obtains the block device access information corresponding to the function to be called through the preset program code, and stores the block device access information by using a preset storage format corresponding to the virtual machine for user space reading.
  • a preset program code can be inserted before a function to be called corresponding to a preset block device access event in the kernel space, and the preset program code can be used to obtain And store block device access information for user space reading, which can reduce the interaction between kernel space and user space, reduce the burden of block device access tracking on the system, and improve system stability.
  • the judgment module is further configured to:
  • the block device access information includes a size of a transmission data amount and a transmission delay when a data transmission process corresponding to the preset block device access event ends.
  • the access information acquisition module is further configured to:
  • the size of the amount of data transmitted corresponding to the function to be called is determined according to the function parameter content and / or the kernel data structure content.
  • the functions to be called include a first to-be-called function corresponding to a block device request initiation event and a second to-be-called function corresponding to a block device request completion event;
  • the access information acquisition module is set to:
  • a corresponding transmission delay is determined according to a difference between the second time and the first time.
  • the preset virtual machine includes an extended Berkeley packet filter eBPF, and the storage format corresponding to the preset virtual machine includes a hash table.
  • the access information storage module is further configured to:
  • the process identifier corresponding to the preset block device access event and the block device access information are used as key values of the hash table, and the number of occurrences of the preset block device access event matching the key value is stored in the
  • the preset block access event corresponds to a hash table.
  • the device further includes: a preset hash table acquisition module and a filtering module.
  • the preset hash table obtaining module is configured to obtain a preset hash table, wherein the preset hash table is passed from the user space to the kernel space, and the preset hash table stores filtering conditions. information;
  • a filtering module configured to filter the block device access information according to the filtering condition information in the preset hash table
  • the access information storage module is further configured to:
  • the filtered block device access information is stored in a storage format corresponding to the preset virtual machine.
  • the apparatus further includes a query result feedback module.
  • the query result feedback module is configured to store the block device access information in a storage format corresponding to the preset virtual machine for user space reading, and then receive a user space preview in the kernel space.
  • a hash table corresponding to the preset block device access event is queried according to the preset read request, and the query result is fed back to the user space.
  • the apparatus may further include a preset hash table generation module and a preset hash table transfer module.
  • a preset hash table generating module configured to receive a filtering condition setting operation through user space, and generate a preset hash table according to the filtering condition setting operation;
  • the preset hash table transfer module is configured to transfer the preset hash table from the user space to the kernel space.
  • An embodiment of the present application further provides a storage medium containing computer-executable instructions, where the computer-executable instructions are used to execute a block device access tracking method when executed by a computer processor, the method includes:
  • the block device access information is stored in a storage format corresponding to the preset virtual machine for user space reading.
  • Storage medium any type of memory device or storage device.
  • the term "storage medium” is intended to include: installation media, such as CD-ROM, floppy disks, or magnetic tape devices; computer system memory or random access memory, such as Dynamic Random Access Memory (DRAM), double-rate synchronization Dynamic Random Access Memory (Double Date, Synchronous and Dynamic Access Memory, DDRRAM), Static Random Access Memory (Static Random Access Memory, SRAM), Extended Data Output Random Access Memory (Extended Data Output Random Access Memory, EDORAM), Lan Rambus RAM, etc .; non-volatile memory such as flash memory, magnetic media (such as hard disk or optical storage); registers or other similar types of memory elements, etc.
  • the storage medium may further include other types of memory or a combination thereof.
  • the storage medium may be located in a first computer system in which the program is executed, or may be located in a different second computer system connected to the first computer system through a network such as the Internet.
  • the second computer system may provide program instructions to the first computer for execution.
  • the term "storage medium" may include two or more storage media that may reside in different locations, such as in different computer systems connected through a network.
  • the storage medium may store program instructions (for example, embodied as a computer program) executable by one or more processors.
  • a storage medium including computer-executable instructions provided in the embodiments of the present application is not limited to the block device access tracking operation described above, and may also execute the block device provided by any embodiment of the application. Relevant operations in access tracking methods.
  • FIG. 5 is a schematic structural diagram of a terminal according to an embodiment of the present application.
  • the terminal 500 may include: a memory 501, a processor 502, and a computer program stored on the memory 501 and executable on the processor 502.
  • the processor 502 executes the computer program, the block device according to the embodiment of the present application is implemented Access tracking method.
  • the terminal provided in the embodiment of the present application may be based on a preset virtual machine implemented in the kernel space, insert a preset program code before a function to be called corresponding to a preset block device access event in the kernel space, and use the preset program.
  • the code acquires and stores block device access information for user space reading, which can reduce the interaction between kernel space and user space, reduce the burden of block device access tracking on the system, and improve system stability.
  • FIG. 6 is a schematic structural diagram of another terminal provided by an embodiment of the present application.
  • the terminal may include: a housing (not shown in the figure), a memory 601, a central processing unit (CPU) 602 (also referred to as processing). (Hereinafter referred to as CPU), a circuit board (not shown in the figure) and a power supply circuit (not shown in the figure).
  • CPU central processing unit
  • FIG. 6 is a schematic structural diagram of another terminal provided by an embodiment of the present application.
  • the terminal may include: a housing (not shown in the figure), a memory 601, a central processing unit (CPU) 602 (also referred to as processing). (Hereinafter referred to as CPU), a circuit board (not shown in the figure) and a power supply circuit (not shown in the figure).
  • CPU central processing unit
  • the circuit board is disposed in a space surrounded by the housing; the CPU 602 and the memory 601 are disposed on the circuit board; and the power supply circuit is configured to supply power to various circuits or devices of the terminal;
  • the memory 601 is configured to store executable preset program code; the CPU 602 runs a computer program corresponding to the executable preset program code by reading the executable preset program code stored in the memory 601, To achieve the following steps:
  • the block device access information is stored in a storage format corresponding to the preset virtual machine for user space reading.
  • the terminal further includes: a peripheral interface 603, a radio frequency (RF) circuit 605, an audio circuit 606, a speaker 611, a power management chip 608, an input / output (I / O) subsystem 609, and other input / control devices 610, a touch screen 612, other input / control devices 610, and an external port 604. These components communicate through one or more communication buses or signal lines 607.
  • RF radio frequency
  • the illustrated terminal 600 is only an example of the terminal, and the terminal 600 may have more or fewer components than those shown in the figure, may combine two or more components, or may have Different component configurations.
  • the various components shown in the figures can be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application specific integrated circuits.
  • the terminal for block device access tracking provided in this embodiment is described in detail below.
  • the terminal uses a mobile phone as an example.
  • Memory 601 which can be accessed by CPU602, peripheral interface 603, etc.
  • the memory 601 can include high-speed random access memory, and can also include non-volatile memory, such as one or more disk storage devices, flash memory devices , Or other volatile solid-state storage devices.
  • Peripheral interface 603, which can connect the input and output peripherals of the device to the CPU 602 and the memory 601.
  • the I / O subsystem 609 which can connect input / output peripherals on the device, such as touch screen 612 and other input / control devices 610, to peripheral interface 603.
  • the I / O subsystem 609 may include a display controller 6091 and one or more input controllers 6092 for controlling other input / control devices 610.
  • one or more input controllers 6092 receive electrical signals from or send electrical signals to other input / control devices 610.
  • Other input / control devices 610 may include physical buttons (press buttons, rocker buttons, etc.) ), Dial, slide switch, joystick, click wheel.
  • the input controller 6092 can be connected to any of the following: a keyboard, an infrared port, a USB interface, and a pointing device such as a mouse.
  • a touch screen 612 which is an input interface and an output interface between a user terminal and a user, and displays a visual output to the user.
  • the visual output may include graphics, text, icons, videos, and the like.
  • the display controller 6091 in the I / O subsystem 609 receives electrical signals from the touch screen 612 or sends electrical signals to the touch screen 612.
  • the touch screen 612 detects a contact on the touch screen, and the display controller 6091 converts the detected contact into interaction with a user interface object displayed on the touch screen 612, that is, realizes human-computer interaction.
  • the user interface object displayed on the touch screen 612 may be an operation Icons for games, icons connected to the appropriate network, etc.
  • the device may also include a light mouse, which is a touch-sensitive surface that does not display visual output, or an extension of the touch-sensitive surface formed by a touch screen.
  • the RF circuit 605 is mainly configured to establish communication between a mobile phone and a wireless network (that is, a network side), and realize data reception and transmission of the mobile phone and the wireless network. For example, send and receive text messages, e-mail, and so on. Specifically, the RF circuit 605 receives and sends an RF signal.
  • the RF signal is also referred to as an electromagnetic signal.
  • the RF circuit 605 converts an electrical signal into an electromagnetic signal or converts an electromagnetic signal into an electrical signal, and communicates with the communication network and other devices through the electromagnetic signal. For communication.
  • RF circuit 605 may include known circuits for performing these functions, including but not limited to antenna systems, RF transceivers, one or more amplifiers, tuners, one or more oscillators, digital signal processors, codec (COder-DECoder, CODEC) chipset, Subscriber Identity Module (SIM), and so on.
  • codec COder-DECoder
  • CODEC CODEC
  • SIM Subscriber Identity Module
  • the audio circuit 606 is mainly configured to receive audio data from the peripheral interface 603, convert the audio data into an electrical signal, and send the electrical signal to the speaker 611.
  • the speaker 611 is configured to restore a voice signal received by the mobile phone from the wireless network through the RF circuit 605 to a sound and play the sound to a user.
  • the power management chip 608 is configured to provide power and power management for the hardware connected to the CPU 602, the I / O subsystem, and peripheral interfaces.
  • the block device access tracking device, storage medium, and terminal provided in the foregoing embodiments can execute the block device access tracking method provided by any embodiment of the present application, and have corresponding function modules and beneficial effects for executing the method.
  • the block device access tracking method provided in any embodiment of the present application.

Abstract

Disclosed are a block device access tracking method and apparatus, a storage medium and a terminal. Said method comprises: when a preset block device access event is triggered, if it is determined that there is a preset program code written on the basis of a preset virtual machine in a kernel space before a function to be invoked corresponding to the preset block device access event, acquiring, by means of the preset program code, block device access information corresponding to the function to be invoked; and storing the block device access information in a storage format corresponding to the preset virtual machine for user space reading.

Description

块设备访问追踪方法以及装置、存储介质及终端Block device access tracking method and device, storage medium and terminal
本申请要求在2018年09月26日提交中国专利局、申请号为201811125064.9的中国专利申请的优先权,该申请的全部内容通过引用结合在本申请中。This application claims priority from a Chinese patent application filed with the Chinese Patent Office on September 26, 2018, with application number 201811125064.9, the entire contents of which are incorporated herein by reference.
技术领域Technical field
本申请实施例涉及终端技术领域,例如涉及块设备访问追踪方法以及装置、存储介质及终端。The embodiments of the present application relate to the technical field of terminals, for example, to a method and device for tracking access to a block device, a storage medium, and a terminal.
背景技术Background technique
目前,在终端的操作系统中,对各类文件的访问比较频繁,而对文件的访问也会产生块设备的访问,如何对块设备访问进行优化,是系统优化课题中重要的一环。At present, in the operating system of the terminal, access to various types of files is relatively frequent, and access to files also generates access to block devices. How to optimize access to block devices is an important part of the system optimization topic.
在研究对块设备访问的优化时,通常需要对块设备的访问进行追踪,以了解块设备被访问时的相关信息。然而,相关的文件追踪方案仍不够完善,需要改进。When studying the optimization of access to block devices, it is usually necessary to track the access to block devices to understand the relevant information when the block devices are accessed. However, the related file tracking scheme is still not perfect and needs to be improved.
发明内容Summary of the Invention
本申请实施例提供一种块设备访问追踪方法、装置、存储介质及终端,可以优化块设备访问追踪方案。The embodiments of the present application provide a method, an apparatus, a storage medium, and a terminal for tracking access to a block device, which can optimize a block device access tracking solution.
第一方面,本申请实施例提供了一种块设备访问追踪方法,包括:In a first aspect, an embodiment of the present application provides a method for tracking access to a block device, including:
预设块设备访问事件被触发时,判断内核空间中与所述预设块设备访问事件对应的待调用函数之前,是否存在基于预设虚拟机编写的预设程序代码;When a preset block device access event is triggered, determining whether there is a preset program code written based on a preset virtual machine in a kernel space before a function to be called corresponding to the preset block device access event;
若存在,则通过所述预设程序代码获取所述待调用函数对应的块设备访问信息;If it exists, obtaining the block device access information corresponding to the function to be called through the preset program code;
采用所述预设虚拟机对应的存储格式对所述块设备访问信息进行存储,以供用户空间读取。The block device access information is stored in a storage format corresponding to the preset virtual machine for user space reading.
第二方面,本申请实施例提供了一种块设备访问追踪装置,包括:In a second aspect, an embodiment of the present application provides a block device access tracking apparatus, including:
判断模块,设置为在预设块设备访问事件被触发时,判断内核空间中与所述预设块设备访问事件对应的待调用函数之前,是否存在基于预设虚拟机编写的预设程序代码;A judging module configured to determine, when a preset block device access event is triggered, whether a preset program code written based on a preset virtual machine exists in a kernel space before a function to be called corresponding to the preset block device access event;
访问信息获取模块,设置为在所述判断模块的判断结果为存在时,通过所述预设程序代码获取所述待调用函数对应的块设备访问信息;The access information acquisition module is configured to acquire, when the judgment result of the judgment module is present, the access information of the block device corresponding to the function to be called through the preset program code;
访问信息存储模块,设置为采用所述预设虚拟机对应的存储格式对所述块设备访问信息进行存储,以供用户空间读取。The access information storage module is configured to store the block device access information in a storage format corresponding to the preset virtual machine for user space to read.
第三方面,本申请实施例提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现如本申请实施例所述的块设备访问追踪方法。In a third aspect, an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the block device access tracking method according to the embodiment of the present application is implemented.
第四方面,本申请实施例提供了一种终端,包括存储器,处理器及存储在存储器上并可在处理器运行的计算机程序,所述处理器执行所述计算机程序时实现如本申请实施例所述的块设备访问追踪方法。In a fourth aspect, an embodiment of the present application provides a terminal, including a memory, a processor, and a computer program stored in the memory and executable by the processor. When the processor executes the computer program, the implementation is implemented as in the embodiment of the present application. The block device access tracking method.
附图概述Overview of the drawings
图1为本申请实施例提供的一种块设备访问追踪方法的流程示意图;FIG. 1 is a schematic flowchart of a method for tracking access to a block device according to an embodiment of the present application; FIG.
图2为本申请实施例提供的另一种块设备访问追踪方法的流程示意图;FIG. 2 is a schematic flowchart of another block device access tracking method according to an embodiment of the present application; FIG.
图3为本申请实施例提供的又一种块设备访问追踪方法的流程示意图;FIG. 3 is a schematic flowchart of still another block device access tracking method according to an embodiment of the present application; FIG.
图4为本申请实施例提供的一种块设备访问追踪装置的结构框图;4 is a structural block diagram of a block device access tracking apparatus according to an embodiment of the present application;
图5为本申请实施例提供的一种终端的结构示意图;5 is a schematic structural diagram of a terminal according to an embodiment of the present application;
图6为本申请实施例提供的又一种终端的结构示意图。FIG. 6 is a schematic structural diagram of still another terminal provided by an embodiment of the present application.
具体实施方式detailed description
下面结合附图并通过具体实施方式来进一步说明本申请的技术方案。可以理解的是,此处所描述的具体实施例仅仅用于解释本申请,而非对本申请的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与本申请相关的部分而非全部结构。The technical solutions of the present application will be further described below with reference to the accompanying drawings and specific embodiments. It can be understood that the specific embodiments described herein are only used to explain the present application, rather than limiting the present application. In addition, it should be noted that, for convenience of description, only some parts related to the present application are shown in the drawings instead of the entire structure.
在更加详细地讨论示例性实施例之前应当提到的是,一些示例性实施例被描述成作为流程图描绘的处理或方法。虽然流程图将各步骤描述成顺序的处理,但是其中的许多步骤可以被并行地、并发地或者同时实施。此外,各步骤的顺序可以被重新安排。当其操作完成时所述处理可以被终止,但是还可以具有未包括在附图中的附加步骤。所述处理可以对应于方法、函数、规程、子例程、子程序等等。Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although flowcharts describe steps as sequential processing, many of these steps can be performed in parallel, concurrently, or simultaneously. In addition, the order of the steps can be rearranged. The process may be terminated when its operation is completed, but may also have additional steps not included in the drawings. The processing may correspond to methods, functions, procedures, subroutines, subroutines, and so on.
图1为本申请实施例提供的一种块设备访问追踪方法的流程示意图,该方法可以由块设备访问追踪装置执行,其中该装置可由软件和/或硬件实现,一般可集成在终端中。如图1所示,该方法包括:步骤101、步骤102和步骤103。FIG. 1 is a schematic flowchart of a block device access tracking method according to an embodiment of the present application. The method may be executed by a block device access tracking device, where the device may be implemented by software and / or hardware, and may generally be integrated in a terminal. As shown in FIG. 1, the method includes steps 101, 102 and 103.
在步骤101中,预设块设备访问事件被触发时,判断内核空间中与所述预设块设备访问事件对应的待调用函数之前,是否存在基于预设虚拟机编写的预设程序代码。In step 101, when a preset block device access event is triggered, it is determined whether there is a preset program code written based on a preset virtual machine in a kernel space before a function to be called corresponding to the preset block device access event.
示例性的,本申请实施例中的终端可包括手机、平板电脑、笔记本电脑、计算机以及智能家电等设置安装有操作系统的设备。Exemplarily, the terminal in the embodiment of the present application may include a device provided with an operating system, such as a mobile phone, a tablet computer, a notebook computer, a computer, and a smart home appliance.
本申请实施例中对操作系统的类型不做限定,例如可包括安卓(Android)操作系统、窗口(Windows)操作系统以及苹果(ios)操作系统等等。对于很多操作系统来说,内核一般基于Linux实现,Linux中的输入输出(I/O)设备主要分为两类,字符设备和块设备,两种设备本身没有严格限制,但基于不同的功能进行了分类。字符设备可提供连续的数据流,应用程序可以顺序读取,通常不支持随机存取,相反,此类设备支持按字节/字符来读写数据,举例来说,键盘、串口、调制解调器都是典型的字符设备。对于块设备,将信息存储在固定大小的块中,每个块都有自己的地址,应用程序可以随机访问设备数据,程序可自行确定读取数据的位置,硬盘、软盘和闪存等都是典型的块设备,应用程序可以寻址磁盘上的任何位置,并由此读取数据。此外,数据的读写只能以块(通常是512B)的倍数进行。与字符设备不同,块设备并不支持基于字符的寻址。其中,块是内核或文件系统等数据处理的基本单位,1个块由1个或多个扇区组成。The type of the operating system is not limited in the embodiments of the present application, and may include, for example, an Android operating system, a Windows operating system, and an Apple operating system. For many operating systems, the kernel is generally implemented based on Linux. Input / output (I / O) devices in Linux are mainly divided into two types, character devices and block devices. The two devices themselves are not strictly limited, but are based on different functions. Classification. Character devices can provide a continuous data stream, and applications can read them sequentially. Usually, random access is not supported. On the contrary, such devices support byte / character reading and writing of data. For example, keyboards, serial ports, and modems are all Typical character device. For block devices, information is stored in fixed-size blocks. Each block has its own address. Applications can access the device data randomly. The program can determine where to read the data. Hard disks, floppy disks, and flash memory are typical. Block device, the application can address any location on the disk and read data from it. In addition, data can only be read and written in multiples of blocks (usually 512B). Unlike character devices, block devices do not support character-based addressing. Among them, a block is a basic unit of data processing such as a kernel or a file system, and a block is composed of one or more sectors.
为了便于说明,本申请实施例将以安卓操作系统为例进行后续的说明。在终端的Android操作系统中,对各类文件的访问非常频繁,而对文件的访问也会产生块设备的访问,如何对块设备访问进行优化,是系统优化课题中重要的一环。在相关技术中,对块设备访问进行优化时,需要使用某种手段追踪块设备的访问,获取块设备访问信息,以达到精确的优化目标。For ease of description, the embodiments of this application will take the Android operating system as an example for subsequent description. In the terminal's Android operating system, access to various types of files is very frequent, and access to files also generates access to block devices. How to optimize access to block devices is an important part of the system optimization topic. In related technologies, when optimizing the access of a block device, it is necessary to use some means to track the access of the block device and obtain the access information of the block device to achieve a precise optimization goal.
示例性的,通常可采用类似ftrace或blktrace的Linux内核级的追踪框架实现块设备访问追踪。最早ftrace是一个函数追踪器(function tracer),仅能够记录内核的函数调用流程,如今ftrace已经发展成为一个框架(framework),可采用插入(plugin)的方式支持开发人员添加更多种类的追踪(trace)功能,帮助开发人员了解Linux内核的运行时行为,以便进行故障调试或性能分析,因此,可以用于对块设备访问进行追踪。然而,采用ftrace一类的追踪框架进行块设备访问追踪时,会将收集到的信息写入环形缓存(ring buffer)中,且收集过程中不能对信息进行筛选或统计等操作,在收集内核信息时,仅能够获取内核标准格式的信息,导致收集的信息量较大,而ring buffer中的存储空间有限,为了防止信息丢失,用户空间程序就会不断地读取ring buffer中的内容,然后在用户空间对读取到的信息进行筛选、计算或统计等操作。这样,会产生大量的内核空间和用户空间的交互,用户空间程序会占用大量的处理器,如中央处理器(central processing unit,CPU)的资源。另外,若想要收集内核标准格式信息以外其他类型信息,则需要在内核中插入相应的代码,基于ftrace等架构在内核中插入代码尝尝会导致内核崩溃等异常,降低系统稳定性,导致开发周期较长,在实际量产系统中难以集成。blktrace是针对块设备层的追踪框架,具体工作方式与ftrace类似,因此也存在上述同样的问题。For example, a Linux kernel-level tracing framework similar to ftrace or blktrace may be used to implement block device access tracking. The earliest ftrace is a function tracer, which can only record the function call process of the kernel. Now ftrace has developed into a framework, which can be used to support developers to add more kinds of traces (plugin). The trace) function helps developers understand the runtime behavior of the Linux kernel for fault debugging or performance analysis. Therefore, it can be used to trace block device access. However, when using a tracing framework such as ftrace to perform block device access tracking, the collected information is written into a ring buffer (ring buffer), and operations such as filtering or statistics cannot be performed during the collection process, and kernel information is collected. At this time, only the information in the kernel standard format can be obtained, resulting in a large amount of collected information, and the storage space in the ring buffer is limited. In order to prevent information loss, the user space program will continuously read the content in the ring buffer, and then User space performs operations such as filtering, calculation, or statistics on the read information. In this way, a large number of kernel space and user space interactions will be generated, and user space programs will occupy a large number of processors, such as central processing unit (CPU) resources. In addition, if you want to collect other types of information than the standard format information of the kernel, you need to insert the corresponding code in the kernel. Inserting code into the kernel based on architectures such as ftrace will cause exceptions such as kernel crashes, reduce system stability, and lead to development. The cycle is long and it is difficult to integrate in the actual mass production system. blktrace is a tracing framework for the block device layer. The specific working method is similar to ftrace, so it also has the same problems as above.
本申请实施例中,可以基于实现在内核空间中的预设虚拟机实现块设备访问追踪。示例性的,所述预设块设备访问事件可包括同步读、同步写、异步读和异步写等。当然,还可包含其他块设备访问事件,不同的操作系统中块设备访问事件的类型或叫法可能不同,本领域技术人员可根据实际使用的操作系统进行适应性的选择。In the embodiment of the present application, block device access tracking may be implemented based on a preset virtual machine implemented in a kernel space. Exemplarily, the preset block device access event may include synchronous read, synchronous write, asynchronous read, asynchronous write, and the like. Of course, other block device access events may also be included. The types or names of the block device access events may be different in different operating systems, and those skilled in the art may make adaptive selections according to the actual operating system used.
对于很多操作系统来说,系统底层一般为Linux Kernel,系统会进行内核空间和用户空间的划分,不同的操作系统划分方式或划分结果可能不同。用户空间一般指用户进程所在的内存区域,应用程序运行在用户空间,用户进程的数据存放于用户空间;而内核空间是操作系统占据的内存区域,操作系统和驱动程序运行在内核空间,操作系统的数据存放于系统空间。这样,可以将用户数据和系统数据进行隔离,保证系统的稳定性。一般的,用户空间和内核空间通过系统调用(system call)进行交互,系统调用可以理解为由操作系统实现提供的所有系统调用所构成的集合,即程序接口或应用编程接口(Application Programming Interface,API),是应用程序与系统之间的接口。操作系统的主要功能是为管理硬件资源和为应用程序开发人员提供良好的环境来使应用程序具有更好的兼容性,为了达到这个目的,内核提供一系列具备预定功能的多内核函数,通过一组称为系统调用的接口呈现给用户。系统调用把应用程序的请求传给内核,调用相应的内核函数完成所需的处理,将处理结果返回给应用程序。For many operating systems, the bottom layer of the system is generally Linux Kernel. The system divides kernel space and user space. Different operating systems may have different division methods or results. User space generally refers to the memory area where the user process is located. Application programs run in user space, and user process data is stored in user space. Kernel space is the memory area occupied by the operating system. The operating system and drivers run in kernel space. The operating system The data is stored in the system space. In this way, user data and system data can be isolated to ensure system stability. In general, user space and kernel space interact through system calls. System calls can be understood as a set of all system calls provided by the operating system implementation, that is, a program interface or application programming interface (Application Programming Interface, API). ) Is the interface between the application and the system. The main function of the operating system is to manage hardware resources and provide a good environment for application developers to make applications more compatible. In order to achieve this purpose, the kernel provides a series of multi-kernel functions with predetermined functions. Groups of interfaces called system calls are presented to the user. The system call passes the application's request to the kernel, calls the corresponding kernel function to complete the required processing, and returns the processing result to the application.
本申请实施例中,在应用程序对块设备进行访问时,需要通过系统调用的方式访问内核空间,也即,需要调用相应的系统调用接口访问内核空间,因此,可根据预设块设备访问事件对应的系统调用接口是否被调用来判断预设块设备访问事件是否被触发,若被调用,则可认为预设块设备访问事件被触发。In the embodiment of the present application, when an application program accesses a block device, the kernel space needs to be accessed through a system call, that is, the corresponding system call interface needs to be called to access the kernel space. Therefore, events can be accessed according to a preset block device Whether the corresponding system call interface is called to determine whether the preset block device access event is triggered. If it is called, it can be considered that the preset block device access event is triggered.
示例性的,在调用相应的系统调用接口后,还需要调用(一般通过块设备驱动程序调用)内核空间中的相应函数来实现块设备访问,可将该相应函数称为待调用函数。以上述的同步读、同步写、异步读和异步写等为例,每个预设块设备访问事件都对应着相应的待调用函数,用于实现同步读、同步写、异步读和异步写的功能。在不同的操作系统中,函数具体的实现形式可能不同,本申请实施例不做限定。For example, after calling a corresponding system call interface, a corresponding function in the kernel space needs to be called (usually called by a block device driver) to implement block device access, and the corresponding function may be called a function to be called. Taking the above-mentioned synchronous read, synchronous write, asynchronous read, and asynchronous write as examples, each preset block device access event corresponds to a corresponding function to be called, and is used to implement synchronous read, synchronous write, asynchronous read, and asynchronous write. Features. The specific implementation form of the function may be different in different operating systems, which are not limited in the embodiments of the present application.
本申请实施例中,可预先基于预设虚拟机的程序代码编写方式,在内核空间中的待调用函数之前,插入预设程序代码,该预设程序代码用于获取块设备访问信息。这样,预设块设备访问事件被触发时,就可以判断是否存在基于预设虚拟机编写的预设程序代码,进而确定先执行该预设程序代码,还是直接执行待调用函数对应的代码。基于预设虚拟机插入预设程序代码,能够保证系统的稳定性。In the embodiment of the present application, a preset program code writing method based on a preset virtual machine may be used in advance, and a preset program code is inserted before a function to be called in the kernel space, and the preset program code is used to obtain block device access information. In this way, when the preset block device access event is triggered, it can be determined whether there is a preset program code written based on the preset virtual machine, and then it is determined whether the preset program code is executed first or the code corresponding to the function to be called is directly executed. Inserting the preset program code based on the preset virtual machine can ensure the stability of the system.
在步骤102中,若存在,则通过所述预设程序代码获取所述待调用函数对应的块设备访问信息。In step 102, if there is, the block device access information corresponding to the function to be called is obtained through the preset program code.
示例性的,在确定存在预设程序代码时,可先执行该预设程序代码,然后再执行待调用函数,预设程序代码用于对执行待调用函数时的与块设备访问相关的信息进行获取,这些信息本申请实施例中称为块设备访问信息。块设备访问信息可包括反应块设备访问过程的细节信息,如访问的哪个块设备,访问块设备里的哪个文件,以及具体的访问方式等等。在一实施例中,所述块设备访问信息包括所述预设块设备访问事件对应的数据传输过程结束时,传输数据量的大小和传输延迟。其中,传输延迟可表示访问请求发起,到访问请求完成(即针对访问请求的数据传输过程结束)之间的时间间隔。通过对传输数据量的大小和传输延迟的分析,可以对块设备的访问性能进行评价,从而更加有针对性的对块设备的访问进行优化。For example, when it is determined that a preset program code exists, the preset program code may be executed first, and then the function to be called is executed. The preset program code is used to perform information related to block device access when executing the function to be called. This information is acquired in the embodiments of the present application as block device access information. The block device access information may include detailed information reflecting the block device access process, such as which block device is accessed, which file is accessed in the block device, and the specific access method, etc. In an embodiment, the block device access information includes a size of a transmission data amount and a transmission delay when a data transmission process corresponding to the preset block device access event ends. The transmission delay may represent a time interval between the initiation of the access request and the completion of the access request (that is, the end of the data transmission process for the access request). By analyzing the amount of transmission data and transmission delay, the access performance of the block device can be evaluated, so that the access to the block device can be optimized in a more targeted manner.
在步骤103中,采用所述预设虚拟机对应的存储格式对所述块设备访问信息进行存储,以供用户空间读取。In step 103, the block device access information is stored in a storage format corresponding to the preset virtual machine for user space reading.
本申请实施例中,利用预设虚拟机对应的存储格式对所获取的块设备访问信息进行存储,而并非采用内核标准格式进行存储,能够节省存储空间。用户空间不需要不停地读取块设备访问信息,而是可以定期或在需要时一次性读取所需的块设备访问信息即可,可有效减少内核空间和用户空间的交互次数,且由于采用预设虚拟机的存储格式,读取信息量更少,传输量小,所以交互数据量也减小,从而降低块设备访问追踪对系统的负担,提高系统稳定性。In the embodiment of the present application, the acquired block device access information is stored by using a preset storage format corresponding to a virtual machine, instead of storing in a kernel standard format, which can save storage space. User space does not need to constantly read the block device access information, but can read the required block device access information periodically or when needed, which can effectively reduce the number of interactions between kernel space and user space. Adopting a preset virtual machine storage format, the amount of read information is less, and the amount of transmission is small, so the amount of interactive data is also reduced, thereby reducing the burden of block device access tracking on the system and improving system stability.
本申请实施例中提供的块设备访问追踪方法,预设块设备访问事件被触发时,若判断出内核空间中与预设块设备访问事件对应的待调用函数之前存在基于预设虚拟机编写的预设程序代码,则通过预设程序代码获取待调用函数对应的块设备访问信息,采用预设虚拟机对应的存储格式对块设备访问信息进行存储,以供用户空间读取。通过采用上述技术方案,可以基于实现在内核空间中的预设虚拟机,在内核空间中的与预设块设备访问事件对应的待调用函数之前插入预设程序代码,利用该预设程序代码获取并存储块设备访问信息,供用户空间读取,可以减少内核空间和用户空间的交互,降低块设备访问追踪对系统的负担,提高系统稳定性。In the block device access tracking method provided in the embodiment of the present application, when a preset block device access event is triggered, if it is determined that a function to be called corresponding to the preset block device access event exists in the kernel space and is written based on a preset virtual machine, The preset program code obtains the block device access information corresponding to the function to be called through the preset program code, and stores the block device access information by using a preset storage format corresponding to the virtual machine for user space reading. By adopting the above technical solution, based on a preset virtual machine implemented in kernel space, a preset program code can be inserted before a function to be called corresponding to a preset block device access event in the kernel space, and the preset program code can be used to obtain And store block device access information for user space reading, which can reduce the interaction between kernel space and user space, reduce the burden of block device access tracking on the system, and improve system stability.
在一些实施例中,所述判断内核空间中与所述预设块设备访问事件对应的待调用函数之前,是否存在基于预设虚拟机编写的预设程序代码,包括:判断内核空间中的块设备层中,调用与所述预设块设备访问事件对应的待调用函数的起始位置处,是否存在基于预设虚拟机编写的预设程序代码。这样设置的好处在于,不会破坏内核空间中相关代码。块设备层又称为通用块层,用于实现块设备访问的待调用函数一般处于该层中,可以在调用待调用函数的起始位置 处写入基于预设虚拟机的程序,用于获取块设备访问信息,使得在判断是否存在预设程序代码时的时机和位置更加明确,保证预设程序代码能够成功被执行。此外,在进行块设备访问时,调用相应的系统调用接口后,可能需要进行访问方式的判断,一般包括内存访问和物理设备访问,若确定为物理设备访问时,则继续判断内核空间中的块设备层中,调用与所述预设块设备访问事件对应的待调用函数的起始位置处,是否存在基于预设虚拟机编写的预设程序代码。In some embodiments, before the determining whether there is a preset program code written based on a preset virtual machine in a kernel space to be called corresponding to the preset block device access event, includes: determining a block in the kernel space In the device layer, whether a preset program code written based on a preset virtual machine exists at a start position of a function to be called corresponding to the preset block device access event. The advantage of this setting is that it does not destroy related code in kernel space. The block device layer is also called the general block layer. The function to be called for implementing block device access is generally in this layer. A program based on a preset virtual machine can be written at the starting position of the function to be called, and used to obtain The block device access information makes the timing and location of the preset program code more clear when it is determined whether the preset program code exists, and ensures that the preset program code can be successfully executed. In addition, when accessing the block device, after calling the corresponding system call interface, it may be necessary to determine the access method, which generally includes memory access and physical device access. If it is determined that the physical device access is made, continue to determine the block in the kernel space In the device layer, whether a preset program code written based on a preset virtual machine exists at a start position of a function to be called corresponding to the preset block device access event.
在一些实施例中,对于所述传输数据量的大小,所述通过所述预设程序代码获取所述待调用函数对应的块设备访问信息,包括:通过所述预设程序代码获取所述待调用函数对应的函数参数内容和/或所述待调用函数对应的内核数据结构内容;根据所述函数参数内容和/或所述内核数据结构内容确定所述待调用函数对应的传输数据量的大小。这样设置的好处在于,能够成功准确地获取到块设备访问信息中的传输数据量的大小。在执行待调用函数时,传输数据量的大小可能会存在于函数参数里面;还可能会存在于对应的内核数据结构中,该内核数据结构也可能存在于函数参数里。其中,存在的形式不做限定,在获取到函数参数内容或内核数据结构内容后,可能需要进行转换,从而得到最终所需的块设备访问信息。In some embodiments, for the size of the amount of data to be transmitted, obtaining the block device access information corresponding to the function to be called through the preset program code includes: obtaining the standby device information through the preset program code. The content of the function parameters corresponding to the calling function and / or the content of the kernel data structure corresponding to the function to be called; determining the size of the amount of transmission data corresponding to the function to be called according to the content of the function parameter and / or the content of the kernel data structure. . The advantage of this setting is that it can successfully and accurately obtain the size of the amount of transmitted data in the block device access information. When executing the function to be called, the amount of data transferred may exist in the function parameters; it may also exist in the corresponding kernel data structure, and the kernel data structure may also exist in the function parameters. Among them, the existing form is not limited. After obtaining the content of the function parameters or the content of the kernel data structure, it may need to be converted to obtain the finally required block device access information.
在一些实施例中,所述待调用函数包括块设备请求发起事件对应的第一待调用函数和块设备请求完成事件对应的第二待调用函数。对于所述传输延迟,所述通过所述预设程序代码获取所述待调用函数对应的块设备访问信息,包括:通过所述预设程序代码获取所述第一待调用函数被调用时的第一时刻,以及所述第二待调用函数被调用时的第二时刻;根据所述第二时刻与所述第一时刻的差值确定对应的传输延迟。这样设置的好处在于,能够成功准确地获取到块设备访问信息中的传输延迟。在Linux中,驱动对块设备的输入输出(I/O)操作,即对块设备进行访问时,都会向块设备发起一个请求,在驱动中用request结构体描述,对应的所调用的函数记为第一待调用函数。但对于一些磁盘设备而言请求的速度很慢,这时候内核就提供一种队列的机制把这些I/O请求添加到队列中(可称为请求队列),在驱动中用request_queue结构体描述。在完成对块设备的访问时,也即完成请求时,需要返回指示请求的数据是否已经完成传输,对应的所调用的函数记为第二待调用函数。因此,可以根据调用这两个待调用函数的时间差来确定本次预设块设备访问事件对应的传输延迟。In some embodiments, the functions to be called include a first to-be-called function corresponding to a block device request initiation event and a second to-be-called function corresponding to a block device request completion event. For the transmission delay, obtaining the block device access information corresponding to the function to be called through the preset program code includes: obtaining the first time when the first to be called function is called through the preset program code. A time, and a second time when the second function to be called is called; and a corresponding transmission delay is determined according to a difference between the second time and the first time. The advantage of this setting is that it can successfully and accurately obtain the transmission delay in the block device access information. In Linux, the driver's input / output (I / O) operations on the block device, that is, when the block device is accessed, a request is made to the block device, which is described by the request structure in the driver, and the corresponding called function is recorded Is the first function to be called. However, for some disk devices, the request speed is very slow. At this time, the kernel provides a queue mechanism to add these I / O requests to the queue (which can be called a request queue), which is described by the request_queue structure in the driver. When the access to the block device is completed, that is, when the request is completed, it is necessary to return to indicate whether the requested data has been transmitted, and the corresponding called function is recorded as the second function to be called. Therefore, the transmission delay corresponding to the preset block device access event can be determined according to the time difference between calling the two functions to be called.
在一些实施例中,所述预设虚拟机包括扩展伯克利包过滤器(extended Berkeley Packet Filter,eBPF),所述预设虚拟机对应的存储格式包括哈希表。eBPF是一套实现在内核中的虚拟机,它最初被设计用来实现网络数据包的过滤,如今已经有了在内核任何位置进行插入虚拟机代码并实行的能力,并且一 般插入的虚拟机代码在之前还会进行大量检测,保证不会影响系统的稳定性。目前在eBPF中规定的存储格式包括哈希表(Hash table),哈希表又称散列表,是根据关键码值(Key value,简称键值)而直接访问的数据结构,它通过把键值映射到表中一个位置来访问记录,以加快查找的速度。这样设置的好处在于,能够进一步保证系统稳定性,减少内核空间和用户空间的交互。In some embodiments, the preset virtual machine includes an extended Berkeley Packet Filter (eBPF), and a storage format corresponding to the preset virtual machine includes a hash table. eBPF is a set of virtual machines implemented in the kernel. It was originally designed to filter network packets. Now it has the ability to insert and execute virtual machine code anywhere in the kernel, and generally inserts virtual machine code. A large number of tests will be performed before to ensure that the stability of the system will not be affected. Currently, the storage format specified in eBPF includes a hash table (hash table), which is also called a hash table. It is a data structure that is directly accessed according to a key value (Key value, referred to as a key value). Map to a location in the table to access records to speed up lookups. The advantage of this setting is that it can further ensure system stability and reduce interaction between kernel space and user space.
在一些实施例中,所述采用所述预设虚拟机对应的存储格式对所述块设备访问信息进行存储,包括:以所述预设块设备访问事件对应的进程标识和所述块设备访问信息作为哈希表的键值,将与所述键值相匹配的预设块设备访问事件发生的次数存储在与所述预设块设备访问事件对应的哈希表中。这样设置的好处在于,能够合理准确地对块设备访问信息进行存储,且方便查询及后续的分析统计。其中,进程标识可以是进程身份标识(Identification,ID),所述预设块设备访问事件对应的进程标识,可理解为触发预设块设备访问事件的进程的ID。与所述键值相匹配的预设块设备访问事件发生的次数,可理解为对于相同的进程ID,块设备访问信息相同的预设块设备访问事件发生的次数。以块设备访问信息包括传输数据量的大小和传输延迟为例,进程A触发预设块设备访问事件4次,第1次传输数据量的大小为2pages(假设以内存页为单位),传输延迟为2ms,第2次传输数据量的大小为3pages(假设以内存页为单位),传输延迟为2ms,第3次传输数据量的大小为2pages(假设以内存页为单位),传输延迟为2ms,第4次传输数据量的大小为3pages(假设以内存页为单位),传输延迟为1ms。那么可将A22作为第一键值,A表示进程A,第一个2表示传输数据量的大小为2pages,第二个2表示传输延迟为2ms,第一键值对应的存储内容为2次;A32为第二键值,对应存储内容为1次;A31为第二键值,对应存储内容为1次。可以理解的是,进程标识和所述块设备访问信息在键值中的排列顺序不做限定。In some embodiments, storing the block device access information in a storage format corresponding to the preset virtual machine includes: using a process identifier corresponding to the preset block device access event and the block device access The information serves as a key value of the hash table, and the number of occurrences of a preset block device access event that matches the key value is stored in a hash table corresponding to the preset block device access event. The advantage of this setting is that the access information of the block device can be stored reasonably and accurately, and it is convenient for querying and subsequent analysis and statistics. The process identifier may be a process identification (ID), and the process identifier corresponding to the preset block device access event may be understood as the ID of the process that triggered the preset block device access event. The number of occurrences of the preset block device access event matching the key value can be understood as the number of occurrences of the preset block device access event with the same block device access information for the same process ID. Taking the block device access information including the size of transmission data and transmission delay as an example, process A triggers a preset block device access event 4 times, and the size of the first transmission data amount is 2pages (assuming that the unit is memory pages), and the transmission delay 2ms, the size of the second transfer of data is 3pages (assuming memory pages as a unit), the transfer delay is 2ms, the size of the third transfer of data is 2pages (assuming memory pages), and the transfer delay is 2ms , The size of the 4th transmission data amount is 3pages (assuming memory pages as a unit), and the transmission delay is 1ms. Then A22 can be used as the first key value, A means process A, the first 2 means the amount of data transmitted is 2pages, the second 2 means the transmission delay is 2ms, and the storage content corresponding to the first key value is 2 times; A32 is the second key value and the corresponding storage content is 1 time; A31 is the second key value and the corresponding storage content is 1 time. It can be understood that the arrangement order of the process identifier and the block device access information in the key value is not limited.
示例性的,对于不同的预设块设备访问事件,如同步读、同步写以及其他请求,可分别分配一张单独的哈希表。如,同步读对应哈希表1,同步写对应哈希表2,其他请求对应哈希表3。这样设置的好处在于,能过对不同的预设块设备访问事件对应的访问信息进行独立存储,方便后续的查询以及分析。另外,终端中可能存在多个块设备,还可按照块设备进行进一步细分。每个块设备中可包含多个哈希表,这多个哈希表分别对应同步读、同步写以及其他请求。For example, for different preset block device access events, such as synchronous read, synchronous write, and other requests, a separate hash table may be allocated respectively. For example, synchronous read corresponds to hash table 1, synchronous write corresponds to hash table 2, and other requests correspond to hash table 3. The advantage of this setting is that the access information corresponding to different preset block device access events can be stored independently, which is convenient for subsequent query and analysis. In addition, there may be multiple block devices in the terminal, which can be further subdivided according to block devices. Each block device can contain multiple hash tables, and these multiple hash tables correspond to synchronous read, synchronous write, and other requests respectively.
在一些实施例中,在所述采用所述预设虚拟机对应的存储格式对所述块设备访问信息进行存储之前,还包括:获取预设哈希表,其中,所述预设哈希表由所述用户空间传递至所述内核空间,所述预设哈希表中存储有过滤条件信息;根据所述预设哈希表中的过滤条件信息对所述块设备访问信息进行过滤。 相应的,所述采用所述预设虚拟机对应的存储格式对所述块设备访问信息进行存储,包括:采用所述预设虚拟机对应的存储格式对过滤后的块设备访问信息进行存储。其中,过滤可以是正向过滤,也可以是反向过滤。这样设置的好处在于,在对块设备访问信息进行存储之前,能够有选择性的进行过滤,进一步减少存储量。另外,预设哈希表由用户空间传递至内核空间,可支持由用户自行对预设哈希表进行设置,如选取自己关心的某个应用程序(可以使用用户ID表示,即每个应用程序存在对应的用户ID)或某个进程(可以用进程ID进行表示)作为过滤条件信息,指示内核空间将这些应用程序或进程对应的块访问信息筛选出来进行存储。示例性的,可将用户ID或进程ID作为键值,将过滤方式作为对应的存储内容(如保留或滤除);还可反过来,将过滤方式作为键值,将用户ID或进程ID作为对应的存储内容等等。例如,在一些实施例中,还可包括:通过用户空间接收过滤条件设置操作,根据所述过滤条件设置操作生成预设哈希表;将所述预设哈希表由所述用户空间传递至所述内核空间。In some embodiments, before the storing the block device access information by using the storage format corresponding to the preset virtual machine, the method further includes: obtaining a preset hash table, wherein the preset hash table Passed from the user space to the kernel space, filter condition information is stored in the preset hash table; and the block device access information is filtered according to the filter condition information in the preset hash table. Correspondingly, storing the block device access information by using the storage format corresponding to the preset virtual machine includes storing the filtered block device access information by using the storage format corresponding to the preset virtual machine. Among them, filtering can be forward filtering or reverse filtering. The advantage of this setting is that before the block device access information is stored, it can be selectively filtered to further reduce the amount of storage. In addition, the preset hash table is passed from the user space to the kernel space, which can support the user to set the preset hash table by himself, such as selecting an application that he cares about (can be represented by a user ID, that is, each application There is a corresponding user ID) or a process (which can be represented by the process ID) as the filtering condition information, instructing the kernel space to filter out block access information corresponding to these applications or processes for storage. For example, the user ID or process ID can be used as the key value, and the filtering method can be used as the corresponding storage content (such as reserved or filtered out). Alternatively, the filtering mode can be used as the key value, and the user ID or process ID can be used as the key value. Corresponding storage content and so on. For example, in some embodiments, it may further include: receiving a filtering condition setting operation through user space, generating a preset hash table according to the filtering condition setting operation, and passing the preset hash table from the user space to The kernel space.
在一些实施例中,在采用所述预设虚拟机对应的存储格式对所述块设备访问信息进行存储,以供用户空间读取之后,还包括:在所述内核空间接收到所述用户空间的预设读取请求时,根据所述预设读取请求查询与所述预设块设备访问事件对应的哈希表,并将查询结果反馈给所述用户空间。这样设置的好处在于,用户空间可以按照自己的意愿随时或定期向内核空间发送预设读取请求,由内核空间完成查询,而不是由用户空间读取整个存储有块设备访问信息的哈希表并自行查询,能够进一步减少用户空间与内核空间之间的交互数据量,降低追踪块设备访问对系统的负载。In some embodiments, after storing the block device access information in a storage format corresponding to the preset virtual machine for user space reading, the method further includes: receiving the user space in the kernel space. When the preset read request is requested, a hash table corresponding to the preset block device access event is queried according to the preset read request, and the query result is fed back to the user space. The advantage of this setting is that the user space can send preset read requests to the kernel space at any time or periodically according to its own wishes, and the kernel space completes the query, instead of the user space reading the entire hash table storing the block device access information. And self-inquiry can further reduce the amount of interactive data between user space and kernel space, and reduce the load on the system caused by tracking block device access.
在一实施例中,在所述将查询结果反馈给所述用户空间之后,还可在用户空间中对所述查询结果进行进一步的分析或统计等操作。如统计相同传输延迟的访问事件的发生次数;又如,统计相同传输数据量大小的访问事件的发生次数;再如,传输数据量大小和传输延迟的对应关系等等。示例性的,可以采用直方图或热力图等形式进行展示,例如在终端显示屏上显示根据查询结果统计得到的传输延迟直方图(如横轴为传输延迟,单位为ms;纵轴为发生次数)、传输大小直方图(如横轴为传输数据量大小,单位为pages;纵轴为发生次数)以及传输大小vs传输延迟热力图(横轴为传输数据量大小,单位为pages;纵轴为传输延迟,单位为ms;颜色深浅表示发生次数)。在一实施例中,对于同步读、同步写和其他请求可分别对应3个图。In an embodiment, after the query result is fed back to the user space, further operations such as analysis or statistics may be performed on the query result in the user space. For example, count the number of occurrences of access events with the same transmission delay; for example, count the number of occurrences of access events with the same transmission data size; for another example, the correspondence between the amount of transmission data and the transmission delay, and so on. Exemplarily, it may be displayed in the form of a histogram or a heat map. For example, a histogram of transmission delay obtained according to the query result statistics is displayed on the terminal display screen (for example, the horizontal axis is the transmission delay and the unit is ms; the vertical axis is the number of occurrences ), Transmission size histogram (such as the horizontal axis is the amount of transmitted data, the unit is pages; the vertical axis is the number of occurrences) and the transmission size vs. the transmission delay heat map (the horizontal axis is the amount of transmitted data, the unit is pages; the vertical axis is Transmission delay in ms; shades of color indicate the number of occurrences). In one embodiment, three graphs may be corresponding to the synchronous read, synchronous write, and other requests.
图2为本申请实施例提供的另一种块设备访问追踪方法的流程示意图,以预设虚拟机为eBPF为例,该方法包括如下步骤201至步骤207。FIG. 2 is a schematic flowchart of another block device access tracking method according to an embodiment of the present application. Taking a preset virtual machine as an eBPF as an example, the method includes the following steps 201 to 207.
在步骤201中,检测到预设块设备访问事件被触发。In step 201, it is detected that a preset block device access event is triggered.
示例性的,可根据预设块设备访问事件对应的系统调用接口是否被调用来 判断预设块设备访问事件是否被触发,若被调用,则可认为预设块设备访问事件被触发。预设块设备访问事件可包括同步读、同步写、异步读和异步写等。Exemplarily, whether a preset block device access event is triggered may be determined according to whether a system call interface corresponding to the preset block device access event is called. If it is called, the preset block device access event may be considered to be triggered. Preset block device access events can include synchronous read, synchronous write, asynchronous read, asynchronous write, and so on.
在步骤202中,判断内核空间中的块设备层中,调用与预设块设备访问事件对应的第一待调用函数的起始位置处,是否存在基于eBPF编写的预设程序代码,若是,则执行步骤203;否则,执行步骤207。In step 202, it is determined whether there is a preset program code written based on eBPF in the block device layer in the kernel space at the starting position of the first function to be called corresponding to the preset block device access event. Go to step 203; otherwise, go to step 207.
示例性的,待调用函数包括块设备请求发起事件对应的第一待调用函数和块设备请求完成事件对应的第二待调用函数。一般第一待调用函数最先被调用,所以可直接判断调用第一待调用函数的起始位置处是否存在eBPF程序。Exemplarily, the functions to be called include a first to-be-called function corresponding to the block device request initiation event and a second to-be-called function corresponding to the block device request completion event. Generally, the first function to be called is called first, so it can be directly determined whether an eBPF program exists at the starting position of the first function to be called.
在步骤203中,通过预设程序代码获取第一待调用函数和第二待调用函数对应的函数参数内容,并获取第一待调用函数被调用时的第一时刻,以及第二待调用函数被调用时的第二时刻。In step 203, the contents of the function parameters corresponding to the first to-be-called function and the second to-be-called function are obtained through preset program code, and the first moment when the first to-be-called function is called, and the second to-be-called function is called. The second moment when called.
示例性的,可先执行预设程序代码,再执行待调用函数,块设备访问信息一般会存在于函数参数里面,因此可利用预设程序代码对待调用函数执行过程中涉及到的函数参数内容进行获取。另外,需要记录待调用函数被调用的时刻。示例性的,可以存在一个哈希表,将本次请求对应的请求ID作为键值,将对应的调用时刻进行存储。内核空间一般会为每个请求分配内存地址,可将该分配的内存地址作为本次请求的请求ID。For example, the preset program code can be executed first, and then the function to be called is executed. The block device access information generally exists in the function parameters. Therefore, the preset program code can be used to treat the content of the function parameters involved in the execution of the called function. Obtain. In addition, you need to record the moment when the function to be called is called. Exemplarily, there may be a hash table, using the request ID corresponding to this request as a key value, and storing the corresponding calling moment. The kernel space generally allocates a memory address for each request, and the allocated memory address can be used as the request ID for this request.
在步骤204中,根据函数参数内容确定待调用函数对应的传输数据量的大小,根据第二时刻与第一时刻的差值确定对应的传输延迟。In step 204, the size of the amount of transmission data corresponding to the function to be called is determined according to the content of the function parameters, and the corresponding transmission delay is determined according to the difference between the second time and the first time.
在获取到函数参数内容后,函数参数内容中可能包含内核数据结构,可对内核数据结构进行进一步转换,从而得到最终所需的传输数据量的大小。从哈希表中查询同一个请求ID对应的第二时刻与第一时刻,然后计算出传输延迟。After the function parameter content is obtained, the kernel parameter structure may be included in the function parameter content, and the kernel data structure may be further converted to obtain the size of the final required transmission data amount. Query the second time and the first time corresponding to the same request ID from the hash table, and then calculate the transmission delay.
在步骤205中,以预设块设备访问事件对应的进程标识、传输数据量的大小和传输延迟作为哈希表的键值,将与键值相匹配的预设块设备访问事件发生的次数存储在与所述预设块设备访问事件对应的哈希表中。In step 205, the process identifier corresponding to the preset block device access event, the size of the transmission data amount, and the transmission delay are used as key values of the hash table, and the number of occurrences of the preset block device access event matching the key value is stored. In a hash table corresponding to the preset block device access event.
在步骤206中,在内核空间接收到用户空间的预设读取请求时,根据预设读取请求查询与所述预设块设备访问事件对应的哈希表,并将查询结果反馈给所述用户空间。In step 206, when a preset read request in user space is received in the kernel space, a hash table corresponding to the preset block device access event is queried according to the preset read request, and the query result is fed back to the User space.
在步骤207中,执行第一待调用函数。In step 207, the first function to be called is executed.
示例性的,若第一待调用函数被调用的起始位置并不存在预设程序代码,那么可说明当前的块设备访问事件并不被关注,不需要对本次块设备访问进行追踪,也不需要获取相应的块设备访问信息,可直接执行第一待调用函数。Exemplarily, if the preset program code does not exist at the starting position of the first to-be-called function, it may indicate that the current block device access event is not concerned, and there is no need to track the current block device access. It is not necessary to obtain corresponding block device access information, and the first function to be called can be directly executed.
本申请实施例提供的块设备访问追踪方法,利用eBPF框架在内核中实现实时的块设备访问统计,通过在待调用函数被调用的起始位置处插入eBPF程序来实现块设备访问信息的获取,并存储于哈希表中,当接收到用户空间的预 设读取请求时,由内核空间根据预设读取请求对哈希表进行查询,并将查询结果反馈给用户空间。实践证明,每次传输量可降低到几十KB,可见,通过采用本申请实施例提供的方案,可有效减少内核空间和用户空间的交互,降低块设备访问追踪对系统的负担,提高系统稳定性。The block device access tracking method provided in the embodiment of the present application uses the eBPF framework to implement real-time block device access statistics in the kernel, and inserts the eBPF program at the starting position of the function to be called to implement the block device access information acquisition. It is stored in the hash table. When a preset read request from the user space is received, the kernel space queries the hash table according to the preset read request and feeds back the query result to the user space. Practice has proved that the amount of each transmission can be reduced to tens of KB. It can be seen that by adopting the solution provided in the embodiment of the present application, the interaction between the kernel space and the user space can be effectively reduced, the burden of the block device access tracking on the system, and the system stability can be improved Sex.
图3为本申请实施例提供的又一种块设备访问追踪方法的流程示意图,该方法包括:步骤301至步骤310。FIG. 3 is a schematic flowchart of another block device access tracking method according to an embodiment of the present application. The method includes steps 301 to 310.
在步骤301中,通过用户空间接收过滤条件设置操作,根据过滤条件设置操作生成第一哈希表。In step 301, a filtering condition setting operation is received through user space, and a first hash table is generated according to the filtering condition setting operation.
示例性的,可在终端中向用户展示块设备访问追踪设置界面,用户可基于该设置界面输入过滤条件设置操作,如选择自己关心的应用程序或者进程作为目标应用程序或目标进程。用户空间根据用户输入的过滤条件设置操作生成第一哈希表,用于指示内核空间对目标应用程序或目标进程发起的块设备访问进行实时的追踪。For example, the terminal device access tracking setting interface may be displayed to the user in the terminal, and the user may enter a filtering condition setting operation based on the setting interface, such as selecting an application or process that he or she cares about as a target application or target process. The user space generates a first hash table according to the filtering condition setting operation input by the user, and is used to instruct the kernel space to track the block device access initiated by the target application or target process in real time.
在步骤302中,将第一哈希表由用户空间传递至内核空间。In step 302, the first hash table is passed from user space to kernel space.
在步骤303中,检测到预设块设备访问事件被触发。In step 303, it is detected that the preset block device access event is triggered.
在步骤304中,在内核空间中的虚拟文件系统层中,调用与预设块设备访问事件对应的第一待调用函数的起始位置处,检测到基于eBPF编写的预设程序代码。In step 304, in the virtual file system layer in the kernel space, a preset program code written based on eBPF is detected at a start position of a first function to be called corresponding to a preset block device access event.
在步骤305中,通过预设程序代码获取第一待调用函数和第二待调用函数对应的函数参数内容,并获取第一待调用函数被调用时的第一时刻,以及第二待调用函数被调用时的第二时刻。In step 305, the contents of the function parameters corresponding to the first to-be-called function and the second to-be-called function are obtained through preset program code, and the first moment when the first to-be-called function is called, and the second to-be-called function is called. The second moment when called.
在步骤306中,根据函数参数内容确定待调用函数对应的传输数据量的大小,根据第二时刻与第一时刻的差值确定对应的传输延迟。In step 306, the size of the amount of transmission data corresponding to the function to be called is determined according to the content of the function parameters, and the corresponding transmission delay is determined according to the difference between the second time and the first time.
在步骤307中,根据第一哈希表中的过滤条件信息对传输数据量的大小和传输延迟进行过滤。In step 307, the size of the transmission data amount and the transmission delay are filtered according to the filtering condition information in the first hash table.
示例性的,可判断当前传输数据量的大小和传输延迟对应的发起对象是否属于目标应用程序(或是否为目标进程),若是,则说明是需要进行追踪的块设备访问,可将传输数据量的大小和传输延迟进行保留;若不是,则说明是不需要进行追踪的块设备访问,可忽略当前传输数据量的大小和传输延迟,即进行滤除。Exemplarily, it can be judged whether the size of the current transmission data amount and the transmission target corresponding to the transmission delay belong to the target application (or whether it is a target process). If yes, it means that the block device access that needs to be tracked can be used to transfer the amount of data The size and transmission delay are retained; if not, it means that the block device access that does not need to be tracked, and the size of the current transmission data amount and transmission delay can be ignored, that is, filtering is performed.
在步骤308中,以进程标识,以及过滤后的传输数据量的大小和传输延迟作为哈希表的键值,将与键值相匹配的预设块设备访问事件发生的次数进行存储,得到第二哈希表。In step 308, the process identifier, the size of the filtered transmission data amount, and the transmission delay are used as key values of the hash table, and the number of occurrences of a preset block device access event matching the key values is stored to obtain the first Two hash tables.
其中,可将进程标识,以及过滤后的传输数据量的大小和传输延迟组合成一个连续的字符串,形成第二哈希表的键值。The process identifier, the size of the filtered transmission data amount, and the transmission delay can be combined into a continuous string to form the key value of the second hash table.
在步骤309中,在内核空间接收到用户空间的预设读取请求时,根据预设读取请求查询第二哈希表,并将查询结果反馈给用户空间。In step 309, when the kernel space receives a preset read request from the user space, the second hash table is queried according to the preset read request, and the query result is fed back to the user space.
在步骤310中,通过用户空间对查询结果进行统计,并展示传输延迟直方图、传输大小直方图、以及传输大小vs传输延迟热力图。In step 310, the query results are counted through user space, and a transmission delay histogram, a transmission size histogram, and a transmission size vs. transmission delay heat map are displayed.
本申请实施例提供的块设备访问追踪方法,可以由用户对需要进行访问追踪的发起对象进行预先设置,在内核空间通过eBPF程序获取到块设备访问信息后,根据用户的设置进行相应的过滤,再存储于哈希表中,不仅可以进一步减少存储量,还可增强块设备访问追踪的针对性和个性化,在用户空间需要读取块设备访问信息时,能够进一步减少内核空间和用户空间的交互,实现了轻量级的文件追踪,有利于部署到量产系统中。此外,对读取到的块设备访问信息进行统计,以图表形式进行展示,便于对块设备访问的分析和优化。The block device access tracking method provided in the embodiments of the present application can be set in advance by a user on an initiating object that needs to be tracked for access, and after the block device access information is obtained through the eBPF program in the kernel space, corresponding filtering is performed according to the user's settings. Re-storing in the hash table can not only further reduce the storage amount, but also enhance the targeting and personalization of block device access tracking. When user space needs to read block device access information, it can further reduce kernel space and user space. The interaction enables lightweight file tracking, which is beneficial for deployment to mass production systems. In addition, the read access information of the block device is counted and displayed in the form of charts, which is convenient for the analysis and optimization of the block device access.
图4为本申请实施例提供的一种块设备访问追踪装置的结构框图,该装置可由软件和/或硬件实现,一般集成在终端中,可通过执行块设备访问追踪方法来对块设备访问进行追踪。如图4所示,该装置包括:判断模块401、访问信息获取模块402和访问信息存储模块403。FIG. 4 is a structural block diagram of a block device access tracking device according to an embodiment of the present application. The device may be implemented by software and / or hardware, and is generally integrated in a terminal. Block device access may be performed by executing a block device access tracking method. track. As shown in FIG. 4, the device includes a judgment module 401, an access information acquisition module 402, and an access information storage module 403.
判断模块401,设置为在预设块设备访问事件被触发时,判断内核空间中与所述预设块设备访问事件对应的待调用函数之前,是否存在基于预设虚拟机编写的预设程序代码。The judging module 401 is configured to judge whether a preset program code written based on a preset virtual machine exists in a kernel space before a function to be called corresponding to the preset block device access event is triggered when a preset block device access event is triggered. .
访问信息获取模块402,设置为在所述判断模块的判断结果为存在时,通过所述预设程序代码获取所述待调用函数对应的块设备访问信息。The access information acquisition module 402 is configured to acquire the block device access information corresponding to the function to be called through the preset program code when the judgment result of the judgment module is present.
访问信息存储模块403,设置为采用所述预设虚拟机对应的存储格式对所述块设备访问信息进行存储,以供用户空间读取。The access information storage module 403 is configured to store the block device access information in a storage format corresponding to the preset virtual machine for reading by user space.
本申请实施例中提供的块设备访问追踪装置,预设块设备访问事件被触发时,若判断出内核空间中与预设块设备访问事件对应的待调用函数之前存在基于预设虚拟机编写的预设程序代码,则通过预设程序代码获取待调用函数对应的块设备访问信息,采用预设虚拟机对应的存储格式对块设备访问信息进行存储,以供用户空间读取。通过采用上述技术方案,可以基于实现在内核空间中的预设虚拟机,在内核空间中的与预设块设备访问事件对应的待调用函数之前插入预设程序代码,利用该预设程序代码获取并存储块设备访问信息,供用户空间读取,可以减少内核空间和用户空间的交互,降低块设备访问追踪对系统的负担,提高系统稳定性。In the block device access tracking device provided in the embodiment of the present application, when a preset block device access event is triggered, if it is determined that a function to be called corresponding to the preset block device access event exists in the kernel space and is written based on a preset virtual machine, The preset program code obtains the block device access information corresponding to the function to be called through the preset program code, and stores the block device access information by using a preset storage format corresponding to the virtual machine for user space reading. By adopting the above technical solution, based on a preset virtual machine implemented in kernel space, a preset program code can be inserted before a function to be called corresponding to a preset block device access event in the kernel space, and the preset program code can be used to obtain And store block device access information for user space reading, which can reduce the interaction between kernel space and user space, reduce the burden of block device access tracking on the system, and improve system stability.
在一实施例中,所述判断模块还设置为:In an embodiment, the judgment module is further configured to:
判断内核空间中的块设备层中,调用与所述预设块设备访问事件对应的待调用函数的起始位置处,是否存在基于预设虚拟机编写的预设程序代码。It is determined whether a preset program code written based on a preset virtual machine exists in a block device layer in kernel space at a starting position of a function to be called corresponding to the preset block device access event.
在一实施例中,所述块设备访问信息包括所述预设块设备访问事件对应的 数据传输过程结束时,传输数据量的大小和传输延迟。In one embodiment, the block device access information includes a size of a transmission data amount and a transmission delay when a data transmission process corresponding to the preset block device access event ends.
在一实施例中,对于所述传输数据量的大小,所述访问信息获取模块还设置为:In an embodiment, for the size of the amount of transmitted data, the access information acquisition module is further configured to:
通过所述预设程序代码获取所述待调用函数对应的函数参数内容和/或所述待调用函数对应的内核数据结构内容;Obtaining the function parameter content corresponding to the function to be called and / or the kernel data structure content corresponding to the function to be called through the preset program code;
根据所述函数参数内容和/或所述内核数据结构内容确定所述待调用函数对应的传输数据量的大小。The size of the amount of data transmitted corresponding to the function to be called is determined according to the function parameter content and / or the kernel data structure content.
在一实施例中,所述待调用函数包括块设备请求发起事件对应的第一待调用函数和块设备请求完成事件对应的第二待调用函数;In an embodiment, the functions to be called include a first to-be-called function corresponding to a block device request initiation event and a second to-be-called function corresponding to a block device request completion event;
对于所述传输延迟,所述访问信息获取模块设置为:For the transmission delay, the access information acquisition module is set to:
通过所述预设程序代码获取所述第一待调用函数被调用时的第一时刻,以及所述第二待调用函数被调用时的第二时刻;Obtaining the first time when the first function to be called is called and the second time when the second function to be called is called by using the preset program code;
根据所述第二时刻与所述第一时刻的差值确定对应的传输延迟。A corresponding transmission delay is determined according to a difference between the second time and the first time.
在一实施例中,所述预设虚拟机包括扩展伯克利包过滤器eBPF,所述预设虚拟机对应的存储格式包括哈希表。In an embodiment, the preset virtual machine includes an extended Berkeley packet filter eBPF, and the storage format corresponding to the preset virtual machine includes a hash table.
在一实施例中,所述访问信息存储模块还设置为:In an embodiment, the access information storage module is further configured to:
以所述预设块设备访问事件对应的进程标识和所述块设备访问信息作为哈希表的键值,将与所述键值相匹配的预设块设备访问事件发生的次数存储在与所述预设块设备访问事件对应的哈希表中。The process identifier corresponding to the preset block device access event and the block device access information are used as key values of the hash table, and the number of occurrences of the preset block device access event matching the key value is stored in the The preset block access event corresponds to a hash table.
在一实施例中,该装置还包括:预设哈希表获取模块和过滤模块。In an embodiment, the device further includes: a preset hash table acquisition module and a filtering module.
预设哈希表获取模块,设置为获取预设哈希表,其中,所述预设哈希表由所述用户空间传递至所述内核空间,所述预设哈希表中存储有过滤条件信息;The preset hash table obtaining module is configured to obtain a preset hash table, wherein the preset hash table is passed from the user space to the kernel space, and the preset hash table stores filtering conditions. information;
过滤模块,设置为根据所述预设哈希表中的过滤条件信息对所述块设备访问信息进行过滤;A filtering module configured to filter the block device access information according to the filtering condition information in the preset hash table;
相应的,所述访问信息存储模块还设置为:Accordingly, the access information storage module is further configured to:
采用所述预设虚拟机对应的存储格式对过滤后的块设备访问信息进行存储。The filtered block device access information is stored in a storage format corresponding to the preset virtual machine.
在一实施例中,该装置还包括:查询结果反馈模块。In an embodiment, the apparatus further includes a query result feedback module.
查询结果反馈模块,设置为在采用所述预设虚拟机对应的存储格式对所述块设备访问信息进行存储,以供用户空间读取之后,在所述内核空间接收到所述用户空间的预设读取请求时,根据所述预设读取请求查询与所述预设块设备访问事件对应的哈希表,并将查询结果反馈给所述用户空间。The query result feedback module is configured to store the block device access information in a storage format corresponding to the preset virtual machine for user space reading, and then receive a user space preview in the kernel space. When the read request is set, a hash table corresponding to the preset block device access event is queried according to the preset read request, and the query result is fed back to the user space.
在一实施例中,该装置还可包括:预设哈希表生成模块和预设哈希表传递模块。In an embodiment, the apparatus may further include a preset hash table generation module and a preset hash table transfer module.
预设哈希表生成模块,设置为通过用户空间接收过滤条件设置操作,根据 所述过滤条件设置操作生成预设哈希表;A preset hash table generating module configured to receive a filtering condition setting operation through user space, and generate a preset hash table according to the filtering condition setting operation;
预设哈希表传递模块,设置为将所述预设哈希表由所述用户空间传递至所述内核空间。The preset hash table transfer module is configured to transfer the preset hash table from the user space to the kernel space.
本申请实施例还提供一种包含计算机可执行指令的存储介质,所述计算机可执行指令在由计算机处理器执行时用于执行块设备访问追踪方法,该方法包括:An embodiment of the present application further provides a storage medium containing computer-executable instructions, where the computer-executable instructions are used to execute a block device access tracking method when executed by a computer processor, the method includes:
预设块设备访问事件被触发时,判断内核空间中与所述预设块设备访问事件对应的待调用函数之前,是否存在基于预设虚拟机编写的预设程序代码;When a preset block device access event is triggered, determining whether there is a preset program code written based on a preset virtual machine in a kernel space before a function to be called corresponding to the preset block device access event;
若存在,则通过所述预设程序代码获取所述待调用函数对应的块设备访问信息;If it exists, obtaining the block device access information corresponding to the function to be called through the preset program code;
采用所述预设虚拟机对应的存储格式对所述块设备访问信息进行存储,以供用户空间读取。The block device access information is stored in a storage format corresponding to the preset virtual machine for user space reading.
存储介质——任何的各种类型的存储器设备或存储设备。术语“存储介质”旨在包括:安装介质,例如CD-ROM、软盘或磁带装置;计算机系统存储器或随机存取存储器,诸如动态随机存取存储器(Dynamic Random Access Memory,DRAM)、双倍速率同步动态随机存储器(Double Date Rate Synchronous Dynamic Random Access Memory,DDRRAM)、静态随机存取存储器(Static Random Access Memory,SRAM)、扩展式数据输出随机存取存储器(Extended Data Output Random Access Memory,EDORAM),兰巴斯(Rambus)RAM等;非易失性存储器,诸如闪存、磁介质(例如硬盘或光存储);寄存器或其它相似类型的存储器元件等。存储介质可以还包括其它类型的存储器或其组合。另外,存储介质可以位于程序在其中被执行的第一计算机系统中,或者可以位于不同的第二计算机系统中,第二计算机系统通过网络(诸如因特网)连接到第一计算机系统。第二计算机系统可以提供程序指令给第一计算机用于执行。术语“存储介质”可以包括可以驻留在不同位置中(例如在通过网络连接的不同计算机系统中)的两个或更多存储介质。存储介质可以存储可由一个或多个处理器执行的程序指令(例如具体实现为计算机程序)。Storage medium-any type of memory device or storage device. The term "storage medium" is intended to include: installation media, such as CD-ROM, floppy disks, or magnetic tape devices; computer system memory or random access memory, such as Dynamic Random Access Memory (DRAM), double-rate synchronization Dynamic Random Access Memory (Double Date, Synchronous and Dynamic Access Memory, DDRRAM), Static Random Access Memory (Static Random Access Memory, SRAM), Extended Data Output Random Access Memory (Extended Data Output Random Access Memory, EDORAM), Lan Rambus RAM, etc .; non-volatile memory such as flash memory, magnetic media (such as hard disk or optical storage); registers or other similar types of memory elements, etc. The storage medium may further include other types of memory or a combination thereof. In addition, the storage medium may be located in a first computer system in which the program is executed, or may be located in a different second computer system connected to the first computer system through a network such as the Internet. The second computer system may provide program instructions to the first computer for execution. The term "storage medium" may include two or more storage media that may reside in different locations, such as in different computer systems connected through a network. The storage medium may store program instructions (for example, embodied as a computer program) executable by one or more processors.
当然,本申请实施例所提供的一种包含计算机可执行指令的存储介质,其计算机可执行指令不限于如上所述的块设备访问追踪操作,还可以执行本申请任意实施例所提供的块设备访问追踪方法中的相关操作。Certainly, a storage medium including computer-executable instructions provided in the embodiments of the present application is not limited to the block device access tracking operation described above, and may also execute the block device provided by any embodiment of the application. Relevant operations in access tracking methods.
本申请实施例提供了一种终端,该终端中可集成本申请实施例提供的块设备访问追踪装置。图5为本申请实施例提供的一种终端的结构示意图。终端500可以包括:存储器501,处理器502及存储在存储器501上并可在处理器502运行的计算机程序,所述处理器502执行所述计算机程序时实现如本申请实施例所述的块设备访问追踪方法。The embodiment of the present application provides a terminal, and the terminal may be integrated with the block device access tracking device provided by the embodiment of the present application. FIG. 5 is a schematic structural diagram of a terminal according to an embodiment of the present application. The terminal 500 may include: a memory 501, a processor 502, and a computer program stored on the memory 501 and executable on the processor 502. When the processor 502 executes the computer program, the block device according to the embodiment of the present application is implemented Access tracking method.
本申请实施例提供的终端,可以基于实现在内核空间中的预设虚拟机,在内核空间中的与预设块设备访问事件对应的待调用函数之前插入预设程序代码,利用该预设程序代码获取并存储块设备访问信息,供用户空间读取,可以减少内核空间和用户空间的交互,降低块设备访问追踪对系统的负担,提高系统稳定性。The terminal provided in the embodiment of the present application may be based on a preset virtual machine implemented in the kernel space, insert a preset program code before a function to be called corresponding to a preset block device access event in the kernel space, and use the preset program. The code acquires and stores block device access information for user space reading, which can reduce the interaction between kernel space and user space, reduce the burden of block device access tracking on the system, and improve system stability.
图6为本申请实施例提供的另一种终端的结构示意图,该终端可以包括:壳体(图中未示出)、存储器601、中央处理器(central processing unit,CPU)602(又称处理器,以下简称CPU)、电路板(图中未示出)和电源电路(图中未示出)。所述电路板安置在所述壳体围成的空间内部;所述CPU602和所述存储器601设置在所述电路板上;所述电源电路,设置为为所述终端的各个电路或器件供电;所述存储器601,设置为存储可执行预设程序代码;所述CPU602通过读取所述存储器601中存储的可执行预设程序代码来运行与所述可执行预设程序代码对应的计算机程序,以实现以下步骤:FIG. 6 is a schematic structural diagram of another terminal provided by an embodiment of the present application. The terminal may include: a housing (not shown in the figure), a memory 601, a central processing unit (CPU) 602 (also referred to as processing). (Hereinafter referred to as CPU), a circuit board (not shown in the figure) and a power supply circuit (not shown in the figure). The circuit board is disposed in a space surrounded by the housing; the CPU 602 and the memory 601 are disposed on the circuit board; and the power supply circuit is configured to supply power to various circuits or devices of the terminal; The memory 601 is configured to store executable preset program code; the CPU 602 runs a computer program corresponding to the executable preset program code by reading the executable preset program code stored in the memory 601, To achieve the following steps:
预设块设备访问事件被触发时,判断内核空间中与所述预设块设备访问事件对应的待调用函数之前,是否存在基于预设虚拟机编写的预设程序代码;When a preset block device access event is triggered, determining whether there is a preset program code written based on a preset virtual machine in a kernel space before a function to be called corresponding to the preset block device access event;
若存在,则通过所述预设程序代码获取所述待调用函数对应的块设备访问信息;If it exists, obtaining the block device access information corresponding to the function to be called through the preset program code;
采用所述预设虚拟机对应的存储格式对所述块设备访问信息进行存储,以供用户空间读取。The block device access information is stored in a storage format corresponding to the preset virtual machine for user space reading.
所述终端还包括:外设接口603、射频(Radio Frequency,RF)电路605、音频电路606、扬声器611、电源管理芯片608、输入/输出(I/O)子系统609、其他输入/控制设备610、触摸屏612、其他输入/控制设备610以及外部端口604,这些部件通过一个或多个通信总线或信号线607来通信。The terminal further includes: a peripheral interface 603, a radio frequency (RF) circuit 605, an audio circuit 606, a speaker 611, a power management chip 608, an input / output (I / O) subsystem 609, and other input / control devices 610, a touch screen 612, other input / control devices 610, and an external port 604. These components communicate through one or more communication buses or signal lines 607.
应该理解的是,图示终端600仅仅是终端的一个范例,并且终端600可以具有比图中所示出的更多的或者更少的部件,可以组合两个或更多的部件,或者可以具有不同的部件配置。图中所示出的各种部件可以在包括一个或多个信号处理和/或专用集成电路在内的硬件、软件、或硬件和软件的组合中实现。It should be understood that the illustrated terminal 600 is only an example of the terminal, and the terminal 600 may have more or fewer components than those shown in the figure, may combine two or more components, or may have Different component configurations. The various components shown in the figures can be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application specific integrated circuits.
下面就本实施例提供的用于块设备访问追踪的终端进行详细的描述,该终端以手机为例。The terminal for block device access tracking provided in this embodiment is described in detail below. The terminal uses a mobile phone as an example.
存储器601,所述存储器601可以被CPU602、外设接口603等访问,所述存储器601可以包括高速随机存取存储器,还可以包括非易失性存储器,例如一个或多个磁盘存储器件、闪存器件、或其他易失性固态存储器件。 Memory 601, which can be accessed by CPU602, peripheral interface 603, etc. The memory 601 can include high-speed random access memory, and can also include non-volatile memory, such as one or more disk storage devices, flash memory devices , Or other volatile solid-state storage devices.
外设接口603,所述外设接口603可以将设备的输入和输出外设连接到CPU602和存储器601。 Peripheral interface 603, which can connect the input and output peripherals of the device to the CPU 602 and the memory 601.
I/O子系统609,所述I/O子系统609可以将设备上的输入输出外设,例如 触摸屏612和其他输入/控制设备610,连接到外设接口603。I/O子系统609可以包括显示控制器6091和用于控制其他输入/控制设备610的一个或多个输入控制器6092。其中,一个或多个输入控制器6092从其他输入/控制设备610接收电信号或者向其他输入/控制设备610发送电信号,其他输入/控制设备610可以包括物理按钮(按压按钮、摇臂按钮等)、拨号盘、滑动开关、操纵杆、点击滚轮。值得说明的是,输入控制器6092可以与以下任一个连接:键盘、红外端口、USB接口以及诸如鼠标的指示设备。I / O subsystem 609, which can connect input / output peripherals on the device, such as touch screen 612 and other input / control devices 610, to peripheral interface 603. The I / O subsystem 609 may include a display controller 6091 and one or more input controllers 6092 for controlling other input / control devices 610. Among them, one or more input controllers 6092 receive electrical signals from or send electrical signals to other input / control devices 610. Other input / control devices 610 may include physical buttons (press buttons, rocker buttons, etc.) ), Dial, slide switch, joystick, click wheel. It is worth noting that the input controller 6092 can be connected to any of the following: a keyboard, an infrared port, a USB interface, and a pointing device such as a mouse.
触摸屏612,所述触摸屏612是用户终端与用户之间的输入接口和输出接口,将可视输出显示给用户,可视输出可以包括图形、文本、图标、视频等。A touch screen 612, which is an input interface and an output interface between a user terminal and a user, and displays a visual output to the user. The visual output may include graphics, text, icons, videos, and the like.
I/O子系统609中的显示控制器6091从触摸屏612接收电信号或者向触摸屏612发送电信号。触摸屏612检测触摸屏上的接触,显示控制器6091将检测到的接触转换为与显示在触摸屏612上的用户界面对象的交互,即实现人机交互,显示在触摸屏612上的用户界面对象可以是运行游戏的图标、联网到相应网络的图标等。值得说明的是,设备还可以包括光鼠,光鼠是不显示可视输出的触摸敏感表面,或者是由触摸屏形成的触摸敏感表面的延伸。The display controller 6091 in the I / O subsystem 609 receives electrical signals from the touch screen 612 or sends electrical signals to the touch screen 612. The touch screen 612 detects a contact on the touch screen, and the display controller 6091 converts the detected contact into interaction with a user interface object displayed on the touch screen 612, that is, realizes human-computer interaction. The user interface object displayed on the touch screen 612 may be an operation Icons for games, icons connected to the appropriate network, etc. It is worth noting that the device may also include a light mouse, which is a touch-sensitive surface that does not display visual output, or an extension of the touch-sensitive surface formed by a touch screen.
RF电路605,主要设置为建立手机与无线网络(即网络侧)的通信,实现手机与无线网络的数据接收和发送。例如收发短信息、电子邮件等。具体地,RF电路605接收并发送RF信号,RF信号也称为电磁信号,RF电路605将电信号转换为电磁信号或将电磁信号转换为电信号,并且通过该电磁信号与通信网络以及其他设备进行通信。RF电路605可以包括用于执行这些功能的已知电路,其包括但不限于天线系统、RF收发机、一个或多个放大器、调谐器、一个或多个振荡器、数字信号处理器、编译码器(COder-DECoder,CODEC)芯片组、用户标识模块(Subscriber Identity Module,SIM)等等。The RF circuit 605 is mainly configured to establish communication between a mobile phone and a wireless network (that is, a network side), and realize data reception and transmission of the mobile phone and the wireless network. For example, send and receive text messages, e-mail, and so on. Specifically, the RF circuit 605 receives and sends an RF signal. The RF signal is also referred to as an electromagnetic signal. The RF circuit 605 converts an electrical signal into an electromagnetic signal or converts an electromagnetic signal into an electrical signal, and communicates with the communication network and other devices through the electromagnetic signal. For communication. RF circuit 605 may include known circuits for performing these functions, including but not limited to antenna systems, RF transceivers, one or more amplifiers, tuners, one or more oscillators, digital signal processors, codec (COder-DECoder, CODEC) chipset, Subscriber Identity Module (SIM), and so on.
音频电路606,主要设置为从外设接口603接收音频数据,将该音频数据转换为电信号,并且将该电信号发送给扬声器611。The audio circuit 606 is mainly configured to receive audio data from the peripheral interface 603, convert the audio data into an electrical signal, and send the electrical signal to the speaker 611.
扬声器611,设置为将手机通过RF电路605从无线网络接收的语音信号,还原为声音并向用户播放该声音。The speaker 611 is configured to restore a voice signal received by the mobile phone from the wireless network through the RF circuit 605 to a sound and play the sound to a user.
电源管理芯片608,设置为为CPU602、I/O子系统及外设接口所连接的硬件进行供电及电源管理。The power management chip 608 is configured to provide power and power management for the hardware connected to the CPU 602, the I / O subsystem, and peripheral interfaces.
上述实施例中提供的块设备访问追踪装置、存储介质及终端可执行本申请任意实施例所提供的块设备访问追踪方法,具备执行该方法相应的功能模块和有益效果。未在上述实施例中详尽描述的技术细节,可参见本申请任意实施例所提供的块设备访问追踪方法。The block device access tracking device, storage medium, and terminal provided in the foregoing embodiments can execute the block device access tracking method provided by any embodiment of the present application, and have corresponding function modules and beneficial effects for executing the method. For technical details not described in detail in the foregoing embodiments, reference may be made to the block device access tracking method provided in any embodiment of the present application.

Claims (20)

  1. 一种块设备访问追踪方法,包括:A block device access tracking method includes:
    在预设块设备访问事件被触发的情况下,判断内核空间中与所述预设块设备访问事件对应的待调用函数之前,是否存在基于预设虚拟机编写的预设程序代码;If a preset block device access event is triggered, determining whether there is a preset program code written based on a preset virtual machine in a kernel space before a function to be called corresponding to the preset block device access event;
    响应于存在基于预设虚拟机编写的预设程序代码,通过所述预设程序代码获取所述待调用函数对应的块设备访问信息;In response to the existence of a preset program code written based on a preset virtual machine, obtaining the block device access information corresponding to the function to be called through the preset program code;
    采用所述预设虚拟机对应的存储格式对所述块设备访问信息进行存储,以供用户空间读取。The block device access information is stored in a storage format corresponding to the preset virtual machine for user space reading.
  2. 根据权利要求1所述的方法,其中,所述判断内核空间中与所述预设块设备访问事件对应的待调用函数之前,是否存在基于预设虚拟机编写的预设程序代码,包括:The method according to claim 1, wherein, before the determining whether a function to be called corresponding to the preset block device access event in the kernel space exists, a preset program code written based on a preset virtual machine comprises:
    判断内核空间中的块设备层中,调用与所述预设块设备访问事件对应的待调用函数的起始位置处,是否存在基于预设虚拟机编写的预设程序代码。It is determined whether a preset program code written based on a preset virtual machine exists in a block device layer in kernel space at a starting position of a function to be called corresponding to the preset block device access event.
  3. 根据权利要求1所述的方法,其中,所述块设备访问信息包括所述预设块设备访问事件对应的数据传输过程结束时,传输数据量的大小和传输延迟。The method according to claim 1, wherein the block device access information comprises a size of a transmission data amount and a transmission delay when a data transmission process corresponding to the preset block device access event ends.
  4. 根据权利要求3所述的方法,其中,对于所述传输数据量的大小,所述通过所述预设程序代码获取所述待调用函数对应的块设备访问信息,包括:The method according to claim 3, wherein, for the size of the amount of data to be transmitted, the acquiring, through the preset program code, block device access information corresponding to the function to be called comprises:
    通过所述预设程序代码获取所述待调用函数对应的函数参数内容和所述待调用函数对应的内核数据结构内容中的至少之一;Obtaining at least one of content of a function parameter corresponding to the function to be called and content of a kernel data structure corresponding to the function to be called through the preset program code;
    根据所述函数参数内容和所述内核数据结构内容中的至少之一确定所述待调用函数对应的传输数据量的大小。The size of the amount of data transmitted corresponding to the function to be called is determined according to at least one of the function parameter content and the kernel data structure content.
  5. 根据权利要求3所述的方法,其中,所述待调用函数包括块设备请求发起事件对应的第一待调用函数和块设备请求完成事件对应的第二待调用函数;The method according to claim 3, wherein the functions to be called comprise a first to-be-called function corresponding to a block device request initiation event and a second to-be-called function corresponding to a block device request completion event;
    对于所述传输延迟,所述通过所述预设程序代码获取所述待调用函数对应的块设备访问信息,包括:For the transmission delay, obtaining the block device access information corresponding to the function to be called through the preset program code includes:
    通过所述预设程序代码获取所述第一待调用函数被调用时的第一时刻,以及所述第二待调用函数被调用时的第二时刻;Obtaining the first time when the first function to be called is called and the second time when the second function to be called is called by using the preset program code;
    根据所述第二时刻与所述第一时刻的差值确定对应的传输延迟。A corresponding transmission delay is determined according to a difference between the second time and the first time.
  6. 根据权利要求1所述的方法,其中,所述预设虚拟机包括扩展伯克利包过滤器eBPF,所述预设虚拟机对应的存储格式包括哈希表。The method according to claim 1, wherein the preset virtual machine comprises an extended Berkeley packet filter eBPF, and the storage format corresponding to the preset virtual machine comprises a hash table.
  7. 根据权利要求6所述的方法,其中,所述采用所述预设虚拟机对应的存储格式对所述块设备访问信息进行存储,包括:The method according to claim 6, wherein the storing the block device access information in a storage format corresponding to the preset virtual machine comprises:
    以所述预设块设备访问事件对应的进程标识和所述块设备访问信息作为哈希表的键值,将与所述键值相匹配的预设块设备访问事件发生的次数存储在与所述预设块设备访问事件对应的哈希表中。The process identifier corresponding to the preset block device access event and the block device access information are used as key values of the hash table, and the number of occurrences of the preset block device access event matching the key value is stored in the The preset block access event corresponds to a hash table.
  8. 根据权利要求6所述的方法,在所述采用所述预设虚拟机对应的存储格式对所述块设备访问信息进行存储之前,还包括:The method according to claim 6, before the storing the block device access information in the storage format corresponding to the preset virtual machine, further comprising:
    获取预设哈希表,其中,所述预设哈希表由所述用户空间传递至所述内核空间,所述预设哈希表中存储有过滤条件信息;Obtaining a preset hash table, wherein the preset hash table is passed from the user space to the kernel space, and the preset hash table stores filter condition information;
    根据所述预设哈希表中的过滤条件信息对所述块设备访问信息进行过滤;Filtering the block device access information according to the filter condition information in the preset hash table;
    所述采用所述预设虚拟机对应的存储格式对所述块设备访问信息进行存储,包括:The storing the block device access information in a storage format corresponding to the preset virtual machine includes:
    采用所述预设虚拟机对应的存储格式对过滤后的块设备访问信息进行存储。The filtered block device access information is stored in a storage format corresponding to the preset virtual machine.
  9. 根据权利要求6-8任一项所述的方法,在采用所述预设虚拟机对应的存储格式对所述块设备访问信息进行存储,以供用户空间读取之后,还包括:The method according to any one of claims 6 to 8, after storing the block device access information in a storage format corresponding to the preset virtual machine for user space reading, further comprising:
    在所述内核空间接收到所述用户空间的预设读取请求的情况下,根据所述预设读取请求查询与所述预设块设备访问事件对应的哈希表,并将查询结果反馈给所述用户空间。In the case where the kernel space receives a preset read request of the user space, a hash table corresponding to the preset block device access event is queried according to the preset read request, and the query result is fed back Give the user space.
  10. 一种块设备访问追踪装置,包括:A block device access tracking device includes:
    判断模块,设置为在预设块设备访问事件被触发的情况下,判断内核空间中与所述预设块设备访问事件对应的待调用函数之前,是否存在基于预设虚拟机编写的预设程序代码;A judging module configured to determine whether a preset program written based on a preset virtual machine exists in a kernel space before a function to be called corresponding to the preset block device access event is triggered in a case where a preset block device access event is triggered Code
    访问信息获取模块,设置为在所述判断模块的判断结果为存在的情况下,通过所述预设程序代码获取所述待调用函数对应的块设备访问信息;The access information acquisition module is configured to, when the judgment result of the judgment module exists, acquire the access information of the block device corresponding to the function to be called through the preset program code;
    访问信息存储模块,设置为采用所述预设虚拟机对应的存储格式对所述块设备访问信息进行存储,以供用户空间读取。The access information storage module is configured to store the block device access information in a storage format corresponding to the preset virtual machine for user space to read.
  11. 根据权利要求10所述的装置,其中,所述判断模块还设置为:The apparatus according to claim 10, wherein the judgment module is further configured to:
    判断内核空间中的块设备层中,调用与所述预设块设备访问事件对应的待调用函数的起始位置处,是否存在基于预设虚拟机编写的预设程序代码。It is determined whether a preset program code written based on a preset virtual machine exists in a block device layer in kernel space at a starting position of a function to be called corresponding to the preset block device access event.
  12. 根据权利要求10所述的装置,其中,所述块设备访问信息包括所述预设块设备访问事件对应的数据传输过程结束时,传输数据量的大小和传输延迟。The apparatus according to claim 10, wherein the block device access information comprises a size of a transmission data amount and a transmission delay when a data transmission process corresponding to the preset block device access event ends.
  13. 根据权利要求12所述的装置,其中,对于所述传输数据量的大小,所述访问信息获取模块还设置为:The apparatus according to claim 12, wherein, for the size of the amount of transmitted data, the access information acquisition module is further configured to:
    通过所述预设程序代码获取所述待调用函数对应的函数参数内容和所述待调用函数对应的内核数据结构内容中的至少之一;Obtaining at least one of content of a function parameter corresponding to the function to be called and content of a kernel data structure corresponding to the function to be called through the preset program code;
    根据所述函数参数内容和所述内核数据结构内容中的至少之一确定所述待调用函数对应的传输数据量的大小。The size of the amount of data transmitted corresponding to the function to be called is determined according to at least one of the function parameter content and the kernel data structure content.
  14. 根据权利要求12所述的装置,其中,所述待调用函数包括块设备请求发起事件对应的第一待调用函数和块设备请求完成事件对应的第二待调用函 数;The apparatus according to claim 12, wherein the functions to be called comprise a first function to be called corresponding to a block device request initiation event and a second function to be called corresponding to a block device request completion event;
    对于所述传输延迟,所述访问信息获取模块设置为:For the transmission delay, the access information acquisition module is set to:
    通过所述预设程序代码获取所述第一待调用函数被调用时的第一时刻,以及所述第二待调用函数被调用时的第二时刻;Obtaining the first time when the first function to be called is called and the second time when the second function to be called is called by using the preset program code;
    根据所述第二时刻与所述第一时刻的差值确定对应的传输延迟。A corresponding transmission delay is determined according to a difference between the second time and the first time.
  15. 根据权利要求10所述的装置,其中,所述预设虚拟机包括扩展伯克利包过滤器eBPF,所述预设虚拟机对应的存储格式包括哈希表。The apparatus according to claim 10, wherein the preset virtual machine comprises an extended Berkeley packet filter eBPF, and the storage format corresponding to the preset virtual machine includes a hash table.
  16. 根据权利要求15所述的装置,其中,所述访问信息存储模块还设置为:The apparatus according to claim 15, wherein the access information storage module is further configured to:
    以所述预设块设备访问事件对应的进程标识和所述块设备访问信息作为哈希表的键值,将与所述键值相匹配的预设块设备访问事件发生的次数存储在与所述预设块设备访问事件对应的哈希表中。The process identifier corresponding to the preset block device access event and the block device access information are used as key values of the hash table, and the number of occurrences of the preset block device access event matching the key value is stored in the The preset block access event corresponds to a hash table.
  17. 根据权利要求10所述的装置,还包括:The apparatus of claim 10, further comprising:
    预设哈希表获取模块,设置为获取预设哈希表,其中,所述预设哈希表由所述用户空间传递至所述内核空间,所述预设哈希表中存储有过滤条件信息;The preset hash table obtaining module is configured to obtain a preset hash table, wherein the preset hash table is passed from the user space to the kernel space, and the preset hash table stores filtering conditions. information;
    过滤模块,设置为根据所述预设哈希表中的过滤条件信息对所述块设备访问信息进行过滤;A filtering module configured to filter the block device access information according to the filtering condition information in the preset hash table;
    其中,所述访问信息存储模块还设置为:The access information storage module is further configured to:
    采用所述预设虚拟机对应的存储格式对过滤后的块设备访问信息进行存储。The filtered block device access information is stored in a storage format corresponding to the preset virtual machine.
  18. 根据权利要求10所述的装置,还包括:The apparatus of claim 10, further comprising:
    查询结果反馈模块,设置为在所述内核空间接收到所述用户空间的预设读取请求的情况下,根据所述预设读取请求查询与所述预设块设备访问事件对应的哈希表,并将查询结果反馈给所述用户空间。The query result feedback module is configured to query a hash corresponding to the preset block device access event according to the preset read request when the preset read request of the user space is received in the kernel space. Table, and feedback the query results to the user space.
  19. 一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现如权利要求1-9中任一所述的块设备访问追踪方法。A computer-readable storage medium having stored thereon a computer program that, when executed by a processor, implements the block device access tracking method according to any one of claims 1-9.
  20. 一种终端,包括存储器,处理器及存储在存储器上并可在处理器运行的计算机程序,所述处理器执行所述计算机程序时实现如权利要求1-9任一所述的块设备访问追踪方法。A terminal includes a memory, a processor, and a computer program stored on the memory and executable by the processor. When the processor executes the computer program, the block device access tracking according to any one of claims 1-9 is implemented. method.
PCT/CN2019/093718 2018-09-26 2019-06-28 Block device access tracking method and apparatus, storage medium and terminal WO2020062985A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811125064.9A CN110955584B (en) 2018-09-26 2018-09-26 Block device access tracking method and device, storage medium and terminal
CN201811125064.9 2018-09-26

Publications (1)

Publication Number Publication Date
WO2020062985A1 true WO2020062985A1 (en) 2020-04-02

Family

ID=69952830

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/093718 WO2020062985A1 (en) 2018-09-26 2019-06-28 Block device access tracking method and apparatus, storage medium and terminal

Country Status (2)

Country Link
CN (1) CN110955584B (en)
WO (1) WO2020062985A1 (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114390098A (en) * 2020-10-21 2022-04-22 北京金山云网络技术有限公司 Data transmission method and device, electronic equipment and storage medium
CN112817597B (en) * 2021-01-12 2024-03-15 山东兆物网络技术股份有限公司 Method for realizing software container based on EBPF running in user space
CN114816279B (en) * 2022-06-30 2022-11-11 广东睿江云计算股份有限公司 Control method and control system for realizing virtual machine disk read-write based on ebpf
CN115202990B (en) * 2022-09-09 2022-12-06 天津市天河计算机技术有限公司 Method, device, equipment and storage medium for acquiring IO performance data
CN116107764B (en) * 2023-04-03 2023-09-26 阿里云计算有限公司 Data processing method and system
CN116886445B (en) * 2023-09-05 2024-01-19 苏州浪潮智能科技有限公司 Processing method and device of filtering result, storage medium and electronic equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101546287A (en) * 2008-03-26 2009-09-30 国际商业机器公司 Code modification method and code modification equipment
CN102917005A (en) * 2012-08-28 2013-02-06 大唐软件技术股份有限公司 Method and device supporting massive memory access to transactions
CN104318152A (en) * 2014-09-28 2015-01-28 江苏科技大学 Data access control method of block device of VxWorks system driver layer
US20160292462A1 (en) * 2015-03-31 2016-10-06 Symantec Corporation Policy-driven device control in operating systems

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101546287A (en) * 2008-03-26 2009-09-30 国际商业机器公司 Code modification method and code modification equipment
CN102917005A (en) * 2012-08-28 2013-02-06 大唐软件技术股份有限公司 Method and device supporting massive memory access to transactions
CN104318152A (en) * 2014-09-28 2015-01-28 江苏科技大学 Data access control method of block device of VxWorks system driver layer
US20160292462A1 (en) * 2015-03-31 2016-10-06 Symantec Corporation Policy-driven device control in operating systems

Also Published As

Publication number Publication date
CN110955584A (en) 2020-04-03
CN110955584B (en) 2021-06-15

Similar Documents

Publication Publication Date Title
WO2020062985A1 (en) Block device access tracking method and apparatus, storage medium and terminal
WO2020062980A1 (en) File access tracking method, device, storage medium and terminal
US11397590B2 (en) Method for preloading application, storage medium, and terminal
JP7414842B2 (en) How to add comments and electronic devices
WO2019114506A1 (en) Compilation optimization method and device, storage medium, intelligent terminal and server
WO2019223578A1 (en) Application program preloading method and apparatus, and storage medium and terminal
TWI529524B (en) Recognition application scenarios, power management method, apparatus and terminal equipment
CN107491560B (en) Page picture display method and device, storage medium, server and mobile terminal
EP3499786B1 (en) Data synchronization method, apparatus, storage medium and electronic device
CN109710396B (en) Method and device for information acquisition and memory release
US11455075B2 (en) Display method when application is exited and terminal
CN110222288B (en) Page display method, device and storage medium
WO2020062986A1 (en) Recovery method and device for page cache, storage medium and terminal
WO2020062981A1 (en) Method and apparatus for tracking file caching efficiency, and storage medium and terminal
CN113064919B (en) Data processing method, data storage system, computer device and storage medium
WO2015103724A1 (en) Icon arrangement method and terminal
WO2014190700A1 (en) Method of memory access, buffer scheduler and memory module
US8074050B2 (en) Electronic device and address space expansion method
CN110908552B (en) Multi-window operation control method, device, equipment and storage medium
CN109828714B (en) Page switching method and device, storage medium and electronic equipment
CN111444117A (en) Method and device for realizing fragmentation of storage space, storage medium and electronic equipment
CN110413192A (en) Shortcut key response method, device, equipment and storage medium
CN108563752B (en) Data interaction method and device, terminal equipment and storage medium
CN110554821A (en) Display method, system and equipment of suspension frame for screening query conditions
WO2023051178A1 (en) Task scheduling method, electronic device, chip system, and storage medium

Legal Events

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

Ref document number: 19867651

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19867651

Country of ref document: EP

Kind code of ref document: A1