Visual analysis method for SSD log, medium and equipment

By adopting a fixed-format logging method in SSD logs and using log type identifiers (ID) and timestamps (Ts) to identify logs, the problems of long logging time and low space utilization are solved, achieving efficient log visualization and analysis and improving CPU performance.

CN122019314APending Publication Date: 2026-05-12JIANGSU XINSHENG INTELLIGENT TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
JIANGSU XINSHENG INTELLIGENT TECH CO LTD
Filing Date
2026-04-15
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

Existing SSD logging methods are time-consuming, leading to decreased CPU performance and low log space utilization efficiency.

Method used

A preset fixed log format is adopted, and logs are identified by log type identifier ID and timestamp Ts. The log buffer is directly filled with raw data to reduce the character length, and the log is visualized and analyzed by the host-side log tool.

Benefits of technology

It improves log space utilization, reduces CPU consumption, enables visual analysis of SSD logs, and simplifies the log recording process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122019314A_ABST
    Figure CN122019314A_ABST
Patent Text Reader

Abstract

The invention discloses a visual analysis method for SSD logs, a medium and equipment, and relates to the technical field of SSDs, the method comprises the steps that a dotting function is pre-buried in a place where logs need to be recorded in a code, and the dotting function distinguishes the logs through parameter transmission; when the code runs, the dotting function uses a preset fixed log format, the log buffer area is filled with parameters in an original data mode, and the number of cached logs is recorded; after the recorded log is written into the NAND storage medium, reading stored log data from the NAND storage medium through a Host side log tool; and processing the read log data by using a preset analysis tool, and drawing the dotting information into a curve graph. According to the method, the log buffer is directly filled with the parameters in a data mode, so that complex parameter analysis is not needed, the SSD log space utilization efficiency is improved, and the SSD master control CPU consumption is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of SSD solid-state drive technology, and specifically to a method, medium, and device for visual analysis of SSD logs. Background Technology

[0002] During the operation of an SSD (Solid State Drive), it is inevitable to record disk operation logs in order to record the disk's operating status and facilitate problem localization. The general method of logging is to use the printf function to print the log prefix (including timestamp, log level, IO count, etc.), keywords, and key parameters, and then store them in text format.

[0003] The master control's logging system provides corresponding API interfaces for callers to print and output logs. The logging system outputs log content to the serial port or writes it to the log flush buffer. When the log buffer is full, or other flush trigger conditions are met, the logging system flushes the logs in the buffer to the Nand flash memory and simultaneously records key information such as the flush position. In the event of a power outage, the restarted logging system needs to scan the log data to recover relevant parameters, and then read the corresponding log content from the Nand flash memory based on the recovered flush parameters.

[0004] When logging, key parameters are parsed based on the format string, and descriptive characters are printed to ensure the uniqueness of the log entry. This process is relatively time-consuming, especially for high-performance SSDs. Frequent printing and looping parameter parsing consume CPU time, leading to performance degradation. Summary of the Invention

[0005] The purpose of this invention is to overcome the shortcomings of the prior art and provide a method, medium and device for visual analysis of SSD logs.

[0006] The objective of this invention is achieved through the following technical solution: Firstly, this application discloses a method for visual analysis of SSD logs, including: In the code, a logging function is embedded where logging is required. The logging function distinguishes logs by passing parameters. During code execution, the logging function uses a preset fixed log format to fill the parameters into the log buffer as raw data and records the number of cached logs. The preset fixed log format includes a log recording timestamp Ts, a log type identifier ID, a valid number of parameters Num, and a parameter Value that needs to be recorded in the log. Different logs are identified by the log recording timestamp Ts and the log type identifier ID, shortening the character length of the log. Log recording is performed based on the preset ID enable state. If the ID is enabled, the log is recorded; otherwise, the log does not need to be recorded. After the recorded logs are written to the NAND storage medium, the stored log data is read from the NAND storage medium using the host-side log tool; The read log data is processed using a preset analysis tool, and the marked information recorded in the log data is plotted as a curve to achieve visual analysis of SSD logs.

[0007] Based on the first aspect, after the parameters are filled into the log buffer as raw data, the write pointer of the log buffer is updated to determine whether the log buffer needs to be flushed.

[0008] Based on the first aspect, the logs will be flushed to the NAND flash memory. The host side will request data from the SSD through the logging tool, obtain the log data, and concatenate it into a binary file.

[0009] Based on the first aspect, the binary file is processed using a preset analysis tool, specifically including: Log statistics include the types, quantity, and time range of logs, as well as the quantity and range of various log IDs, and statistical values. Log filtering involves manually disabling or enabling certain types of logs for focused analysis, including log plotting and log redirection. Log plotting: Based on preset filtering conditions, the filtered logs are plotted as a line graph. Log redirection: Based on preset filtering conditions, the filtered logs are redirected to text format. The preset filtering conditions include selectively selecting certain IDs, sorting by ID, or sorting by value.

[0010] Based on the first aspect, by setting an ID mask, a dynamic individual switch for the interval log can be specified.

[0011] Secondly, this application discloses a computer storage medium storing a computer program, which is executed by a processor to implement the above-described method.

[0012] Thirdly, this application discloses an electronic device, the electronic device comprising: Memory, which stores executable instructions; A processor that executes the executable instructions in the memory to implement the above method.

[0013] The beneficial effects of this invention are: 1) This application standardizes the log into a fixed log format and directly fills the parameters into the log buffer as data, thereby eliminating the need for complex parameter parsing, improving the efficiency of SSD log space utilization and reducing the CPU consumption of the SSD controller. Attached Figure Description

[0014] Figure 1 This is a schematic diagram of the preset filtering conditions for displaying IDs sorted by timestamp in an embodiment of the present invention. Figure 2 This is a schematic diagram of the curve displaying Values ​​sorted by timestamp according to the preset filtering conditions in an embodiment of the present invention. Figure 3 This is a schematic diagram of a fixed log format according to an embodiment of the present invention; Figure 4 This is a schematic diagram of the process of recording the preset ID enable state log in an embodiment of the present invention; Figure 5 This is a flowchart illustrating the visualization analysis method for SSD logs according to an embodiment of the present invention. Detailed Implementation

[0015] The technical solution of the present invention will be clearly and completely described below with reference to the embodiments. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0016] For example, this application discloses a visualization analysis method for SSD logs, the flowchart of which is shown below. Figure 5 As shown, it includes: During code execution, the logging function uses a preset fixed log format to fill the parameters into the log buffer as raw data and records the number of cached logs. The preset fixed log format includes a log recording timestamp Ts, a log type identifier ID, a valid number of parameters Num, and a parameter Value that needs to be recorded in the log. Different logs are identified by the log recording timestamp Ts and the log type identifier ID, shortening the character length of the log. Log recording is performed based on the preset ID enable state. If the ID is enabled, the log is recorded; otherwise, the log does not need to be recorded. After the recorded logs are written to the NAND storage medium, the stored log data is read from the NAND storage medium using the host-side log tool; The read log data is processed using a preset analysis tool, and the marked information recorded in the log data is plotted as a curve to achieve visual analysis of SSD logs.

[0017] For example, in the prior art, text log formats generally consist of a log prefix, a log descriptor (including a format string), and key parameters, with newlines used to distinguish individual log entries. The preset fixed log format described in this application includes a log recording timestamp Ts, a log type identifier ID, the number of valid parameters Num, and the parameters Value that the log needs to record. Without a log prefix and descriptive characters, a fixed log format diagram is shown below. Figure 3 As shown, different logs are identified by ID and Ts, greatly reducing the character length of the logs; the log timestamp Ts follows the system clock and can be stored in 4 bytes; the log type identifier ID is identified according to the log event type and is used to uniquely identify a certain type of log event, and can be stored in 4 bytes; the number of valid parameters Num indicates how many valid log parameters this log entry has, which is used to know the length of this log during log parsing. This field can be reused with ID and does not require additional space; the parameter Value that needs to be recorded in the log has a fixed size as needed, generally 4 bytes. Therefore, the fixed log format preset in this application occupies less space, approximately 12-20 bytes, with the actual size depending on the number of parameters.

[0018] For example, in existing technologies, when a logging system needs to print at a certain point, it typically calls the logging system to output a log. When the code runs to this point, this log will be output, which poses a risk of overwriting the log. Even if a switch is set, it is usually enabled or disabled uniformly by log level or module, and cannot be individually enabled or disabled. The log entry of this application can dynamically enable or disable logging at a certain location by setting an ID mask or enabling an ID range, such as enabling or disabling log points for ID1 / ID2 individually, enabling or disabling log points in the range [IDx, IDy], and can easily achieve persistence as needed.

[0019] For example, a flowchart illustrating the process of logging the preset ID enable state is shown below. Figure 4As shown, logging is performed based on the preset ID enable state. If the ID is enabled, logging is performed; otherwise, no logging is required. After caching an entry, the cache write pointer needs to be updated. Before caching, it is checked whether the environment space is sufficient. If the write pointer filling the current entry does not exceed the log buffer size, the parameters are filled into the log buffer as raw data, and the log buffer write pointer is updated. If it exceeds the log buffer size, it is necessary to switch to PingPang Mem to store the current entry and flush the log buffer.

[0020] For example, traditional logs require calling an API to parse format strings and repeatedly parse print parameters, ultimately converting them into strings and storing them on disk for easy retrieval as text. However, this leads to low utilization; for instance, logging 0x12345678 requires 10 bytes of space. This application uses a fixed format for each log entry, eliminating format string parsing and directly storing parameters in their raw data. Storing parameter 0x12345678 requires only 4 bytes, significantly improving log space utilization, which is highly beneficial for storing longer logs on disk. Furthermore, the absence of format string parsing reduces CPU time slice consumption, allowing the CPU more time for other tasks.

[0021] For example, logs will be periodically or irregularly flushed to NAND flash memory to prevent log loss due to power outages. The host side requests data from the SSD using a logging tool, obtains the log data, and concatenates it into a binary file. This log data is in binary format, which is not intuitive for analysis. A preset analysis tool is used to process the binary file. This preset analysis tool can be the same app or script as traditional logging tools, but it adds log analysis functionality compared to traditional logging tools, specifically including: Log statistics: This function includes information such as the types of logs, the number of log entries, the time range, as well as the number and range of various log IDs, and statistical values ​​(maximum and minimum values, average values). Log filtering: This function allows you to manually turn off or enable certain types of logs for focused analysis, such as log plotting and log redirection. Log plotting: Based on preset filtering conditions, the filtered logs are plotted as line graphs, providing a new, more intuitive and concise way to analyze logs; Log redirection: Based on preset filtering conditions, the filtered logs are redirected to text format. The logs should be stored in text format for detailed analysis. The preset filtering conditions include selectively selecting certain IDs, sorting by ID, or sorting by value.

[0022] For example, by using a fixed format for log entries, analysis tools can easily parse and analyze the logs. Operations such as filtering, sorting, counting, statistics, and coloring can be performed on log entries, and specific curves can be plotted, such as sorting by timestamp and filtering irrelevant logs. Logs can also be redirected to generate text for analysis using text analysis methods. A curve diagram showing the IDs sorted by timestamp with preset filtering conditions is shown below. Figure 1 As shown, based on preset filtering conditions, the filtered Entries are displayed in chronological order, which can be used to observe certain abnormal events (such as abnormal interruptions), runtime timing relationships, etc. A schematic diagram of the curve displaying Values ​​sorted by timestamp based on preset filtering conditions is shown below. Figure 2 As shown, based on preset filtering conditions, the values ​​of certain categories of entries are displayed according to their time configurations, allowing for the observation of anomalies in specific events, such as fluctuations or abnormal values. Through these operations, developers can intuitively observe the disk operation process and anomalies, such as disk performance data, abnormal interruptions or events, and abnormal values ​​of normal IDs. Logs are filtered according to preset filtering conditions, sorted by timestamp, and redirected to text format using analysis tools for text-based analysis.

[0023] For example, this application discloses a computer storage medium storing a computer program that is executed by a processor to implement the method described above.

[0024] For example, this application discloses an electronic device, the electronic device comprising: Memory, which stores executable instructions; A processor that executes the executable instructions in the memory to implement the method described above.

[0025] The above description is merely a preferred embodiment of the present invention. It should be understood that the present invention is not limited to the forms disclosed herein and should not be construed as excluding other embodiments. It can be used in various other combinations, modifications, and environments, and can be altered within the scope of the concept described herein through the above teachings or related technologies or knowledge. Modifications and variations made by those skilled in the art that do not depart from the spirit and scope of the present invention should be within the protection scope of the appended claims.

Claims

1. A method for visual analysis of SSD logs, characterized in that, include: In the code, a logging function is embedded where logging is required. The logging function distinguishes logs by passing parameters. During code execution, the logging function uses a preset fixed log format to fill the parameters into the log buffer as raw data and records the number of cached logs. The preset fixed log format includes a log recording timestamp Ts, a log type identifier ID, a valid number of parameters Num, and a parameter Value that needs to be recorded in the log. Different logs are identified by the log recording timestamp Ts and the log type identifier ID, shortening the character length of the log. Log recording is performed based on the preset ID enable state. If the ID is enabled, the log is recorded; otherwise, the log does not need to be recorded. After the recorded logs are written to the NAND storage medium, the stored log data is read from the NAND storage medium using the host-side log tool; The read log data is processed using a preset analysis tool, and the marked information recorded in the log data is plotted as a curve to achieve visual analysis of SSD logs.

2. The visualization analysis method for SSD logs according to claim 1, characterized in that: After the parameters are filled into the log buffer as raw data, the write pointer of the log buffer is updated to determine whether the log buffer needs to be flushed.

3. The visualization analysis method for SSD logs according to claim 2, characterized in that: The logs will be flushed to the NAND flash memory. The host side will request data from the SSD through the logging tool, obtain the log data, and concatenate it into a binary file.

4. The visualization analysis method for SSD logs according to claim 3, characterized in that, The binary file is processed using a preset analysis tool, specifically including: Log statistics include the types, quantity, and time range of logs, as well as the quantity and range of various log IDs, and statistical values. Log filtering involves manually disabling or enabling certain types of logs for focused analysis, including log plotting and log redirection. Log plotting: Based on preset filtering conditions, the filtered logs are plotted as a line graph. Log redirection: Based on preset filtering conditions, the filtered logs are redirected to text format. The preset filtering conditions include selectively selecting certain IDs, sorting by ID, or sorting by value.

5. The visualization analysis method for SSD logs according to claim 4, characterized in that: By setting an ID mask, you can specify a dynamic, individual on / off switch for range logs.

6. A computer storage medium, characterized in that, The medium stores a computer program, which is executed by a processor to implement the method described in any one of claims 1 to 5.

7. An electronic device, characterized in that, The electronic device includes: Memory, which stores executable instructions; A processor that executes the executable instructions in the memory to implement the method of any one of claims 1 to 5.