Data analysis method and device, computer equipment and storage medium
By obtaining multiple lines of data to be parsed from the header file in the kernel source code file, and using annotation variables and structure variables for parsing to form a mapping relationship, the problem of not being able to determine the differences in kernel source code structure data in existing technologies is solved, realizing efficient difference analysis and fast lookup, and improving development efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- TENCENT TECHNOLOGY (SHENZHEN) CO LTD
- Filing Date
- 2024-11-08
- Publication Date
- 2026-05-12
AI Technical Summary
In existing technologies, distributed version control systems can only determine the differences between different versions of files, but cannot determine the differences between structural data under different versions of kernel source code, resulting in low efficiency in analyzing differences between structural data.
By obtaining multiple lines of data to be parsed from the header file in the kernel source code file, and using annotation variables and structure variables to parse them line by line, the annotation data and structure data are distinguished to form a first mapping relationship. Combined with the version name, a second mapping relationship is formed, enabling fast search and data analysis of the target data to be analyzed.
It improves the parsing speed and difference analysis efficiency of structured data, enabling rapid retrieval and analysis of target data, and guiding the development of systems or applications.
Smart Images

Figure CN122018967A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, specifically to a data analysis method, apparatus, computer equipment, and storage medium. Background Technology
[0002] With the development of computer technology, many open-source operating systems have emerged, such as Linux, which continuously updates its kernel source code to achieve iterative updates. The kernel source code contains structured data, constructed using related data structures to implement various functions such as process description, address description, and file description. These structured data may differ between different versions of the kernel source code.
[0003] To develop operating system software or systems, it's necessary to analyze the differences in structural data across different versions of kernel source code. These differences then guide subsequent software or system development. One approach is to use distributed version control systems to search for historical changes to structural data. However, these records only reveal differences between different file versions, not between structural data within different kernel source code versions. This necessitates manual verification of these differences, resulting in inefficient structural data discrepancy analysis. Summary of the Invention
[0004] This application provides a data analysis method, apparatus, computer device, and storage medium that can improve the efficiency of analyzing differences in structural data under different versions of kernel source code.
[0005] To achieve the above objectives, one embodiment of this application provides a data analysis method, including:
[0006] Obtain kernel source code files from multiple versions, and retrieve the corresponding header files from each version of the kernel source code file;
[0007] Obtain multiple lines of data to be parsed from the header file, and obtain the annotation variables used for data annotation identification and the structure variables used for data structure identification for each line of data to be parsed;
[0008] Based on the annotation variables and the structure variables, the multiple lines of data to be parsed are parsed line by line to obtain multiple sets of structure data under each version of the kernel source code file and the structure data name of each set of structure data.
[0009] Associate each set of structure data in each version of the kernel source code file with the corresponding structure data name to form a first mapping relationship, and associate the first mapping relationship with the version name of the corresponding version of the kernel source code file to form a second mapping relationship;
[0010] Obtain the target version name and target structure data name of the structure data to be analyzed, and find the corresponding multiple sets of target data to be analyzed under the second mapping relationship based on the target version name and the target structure data name.
[0011] To achieve the above objectives, one embodiment of this application provides a data analysis apparatus, including:
[0012] The first acquisition module is used to acquire kernel source code files from multiple versions, and to acquire the corresponding header files from each version of the kernel source code file;
[0013] The second acquisition module is used to acquire multiple lines of data to be parsed from the header file, and to acquire annotation variables used for data annotation identification and structure variables used for data structure identification in each line of data to be parsed.
[0014] The parsing module is used to parse the multiple lines of data to be parsed line by line according to the annotation variables and the structure variables, so as to obtain multiple sets of structure data under the kernel source code file of each version and the structure data name of each set of structure data.
[0015] The association module is used to associate each set of structure data under each version of the kernel source code file with the corresponding structure data name to form a first mapping relationship, and associate the first mapping relationship with the version name of the corresponding version of the kernel source code file to form a second mapping relationship;
[0016] The analysis module is used to obtain the target version name and target structure data name of the structure data to be analyzed, and to find the corresponding multiple sets of target data to be analyzed under the second mapping relationship based on the target version name and the target structure data name.
[0017] In some implementations, the second acquisition module is used for:
[0018] The target character is matched in the data of the header file according to the first regular expression;
[0019] The target character is replaced according to the preset character to obtain multiple lines of parsed data.
[0020] In some implementations, the parsing module includes a determining submodule, a first parsing submodule, and a second parsing submodule. The determining submodule is used to determine the first state value of the annotation variable of the current row of data to be parsed among the multiple rows of data to be parsed.
[0021] The first parsing submodule is used to filter the unstructured data in the current row of data to be parsed when the first state value of the annotation variable is a first preset value, so as to obtain preprocessed data to be parsed.
[0022] The preprocessed data to be parsed is parsed according to the structure variables to obtain the structure data and the structure data name corresponding to the structure data and group them. The next row of data to be parsed is determined as the current row of data to be parsed until each row of data to be parsed is traversed to obtain multiple sets of structure data under each version of the kernel source code file and the structure data name of each set of structure data.
[0023] The second parsing submodule is used to skip the current line of data to be parsed when the first state value of the annotation variable is the second preset value and the current line of data to be parsed does not contain the comment end character, and to determine the next line of data to be parsed as the current line of data to be parsed, until each line of data to be parsed is traversed, so as to obtain multiple sets of structure data under each version of the kernel source code file and the structure data name of each set of structure data.
[0024] In some implementations, after determining the first state value of the annotation variable for the current row of data to be parsed, the second parsing submodule is used to:
[0025] When the first state value of the annotation variable is the second preset value and the current line of data to be parsed contains the annotation terminator, the first state value is updated to the first preset value, and the step of filtering unstructured data in the current line of data to be parsed is performed.
[0026] In some implementations, the first parsing submodule is used for:
[0027] Determine the second state value of the structure variables of the preprocessed data to be parsed;
[0028] When the second state value is zero and the preprocessed data to be parsed matches the second regular expression corresponding to the preset data structure, the preprocessed data to be parsed is determined as structured data and the structured data name is obtained, and the structured data is grouped according to the structured data name;
[0029] The second state value is updated by adding a value to obtain the updated second state value, and the updated second state value is determined as the second state value of the structure variable of the next row of data to be parsed.
[0030] In some implementations, the first parsing submodule is used for:
[0031] When the second state value is greater than zero and the preprocessed data to be parsed matches the second regular expression corresponding to the preset data structure, the preprocessed data to be parsed is determined as structured data, and the structured data name corresponding to the previous row of data to be parsed is determined as the structured data name of the structured data, and the structured data is grouped according to the structured data name.
[0032] When the preprocessed data to be parsed contains a start locator, the second state value is updated by adding a value to obtain the updated second state value, and the updated second state value is determined as the second state value of the structure variable of the next row of data to be parsed;
[0033] When the preprocessed data to be parsed contains an end locator but does not contain a start locator, the second state value is decremented to obtain an updated second state value, and the updated second state value is determined as the second state value of the structure variable of the next row of data to be parsed.
[0034] In some implementations, the parsing module further includes a filtering submodule, which, before filtering the unstructured data in the current row of data to be parsed to obtain preprocessed data to be parsed, is used to:
[0035] If the current line of data to be parsed contains macro-defined characters, discard the current line of data to be parsed and determine the next line of data to be parsed as the current line of data to be parsed.
[0036] The first parsing submodule is used for:
[0037] When the macro definition character does not exist in the current line of data to be parsed, obtain the comment identifier corresponding to the current line of data to be parsed;
[0038] The annotation data corresponding to the current row of data to be parsed is deleted according to the annotation identifier, and the data after deleting the annotation data is determined as the preprocessed data to be parsed.
[0039] In some implementations, the first parsing submodule is used for:
[0040] When the annotation identifier is a first type of annotation identifier, the annotation identifier and the annotation data following the annotation identifier are deleted from the current row of data to be parsed;
[0041] When the comment identifier is a second type of comment identifier and the comment identifier contains a comment start character and a comment end character, the comment data between the comment start character, the comment end character, and the comment data between the comment start character and the comment end character in the current line of data to be parsed is deleted.
[0042] In some implementations, the first parsing submodule is used for:
[0043] When the comment identifier is a second type of comment identifier and the comment identifier contains the comment start character but does not contain the comment end character, the comment start character and the comment data after the comment start character in the current line of data to be parsed are deleted;
[0044] The first state value is updated to the second preset value to obtain the updated first state value, and the updated first state value is determined as the first state value of the annotation variable of the next row of data to be parsed.
[0045] In some implementations, the analysis module is used for:
[0046] Based on the target version name and the target structure data name, search for multiple sets of target data to be analyzed stored in the database under the second mapping relationship;
[0047] Remove spaces from each set of target data to be analyzed to generate preprocessed data to be analyzed, and determine the checksum of each set of preprocessed data to be analyzed;
[0048] A data analysis table is generated based on the target data to be analyzed, the target version name, and the target structure data name. A corresponding color mark is generated in the data analysis table based on the similarity between the verification values corresponding to each group of target data to be analyzed.
[0049] The corresponding target data to be analyzed is analyzed based on the color markers and the data analysis table.
[0050] To achieve the above objectives, one aspect of this application provides a computer-readable storage medium storing a plurality of instructions adapted for loading by a processor to execute the data analysis method provided in this application.
[0051] To achieve the above objectives, one aspect of this application provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the data analysis method provided in this application.
[0052] To achieve the above objectives, one aspect of this application provides a computer program product, including a computer program or instructions, which, when executed by a processor, implement the data analysis method provided in this application.
[0053] In this embodiment, multiple versions of kernel source code files are obtained, and corresponding header files are obtained in each version of the kernel source code file. Multiple lines of data to be parsed are obtained from the header files, along with annotation variables used for data annotation identification and structure variables used for data structure identification in each line of data to be parsed. The multiple lines of data to be parsed are parsed line by line based on the annotation variables and structure variables to obtain multiple sets of structure data under each version of the kernel source code file and the structure data name of each set of structure data. Each set of structure data under each version of the kernel source code file is associated with its corresponding structure data name to form a first mapping relationship, and the first mapping relationship is associated with the version name of the corresponding version of the kernel source code file to form a second mapping relationship. The target version name and target structure data name of the structure data to be analyzed are obtained, and the corresponding multiple sets of target data to be analyzed are found under the second mapping relationship based on the target version name and target structure data name. Therefore, in each version of the kernel source code file, by obtaining multiple lines of data to be parsed from the header file, and during the process of parsing these multiple lines of data line by line, annotation variables used for data annotation identification can be used to identify the annotation data in the multiple lines of data to be parsed, and structure variables used for data structure identification can be used to identify the composition structure of the structure data in the multiple lines of data to be parsed. This distinguishes between annotation data and structure data, thereby obtaining multiple sets of structure data and the structure data name of each set of structure data, improving the parsing speed of multiple lines of data to be parsed. Furthermore, by associating each set of structure data in each version of the kernel source code file with the corresponding structure data name to form a first mapping relationship, and associating the first mapping relationship with the version name of the corresponding version of the kernel source code file to form a second mapping relationship, the target version name and target structure data name of the structure data to be analyzed, combined with the second mapping relationship, can achieve rapid search and data analysis of the target data to be analyzed, thereby improving the efficiency of data difference analysis.
[0054] Other features and advantages of this application will be set forth in the following description and will be apparent in part from the description or may be learned by practicing the application. The objectives and other advantages of this application may be realized and obtained by means of the structures particularly pointed out in the description, claims and drawings. Attached Figure Description
[0055] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0056] Figure 1This is a schematic diagram of the system framework corresponding to the data analysis method provided in the embodiments of this application;
[0057] Figure 2 This is a schematic diagram illustrating a scenario of the data analysis method provided in an embodiment of this application;
[0058] Figure 3 This is a flowchart illustrating the data analysis method provided in an embodiment of this application;
[0059] Figure 4 This is a schematic diagram corresponding to the structural data provided in the embodiments of this application;
[0060] Figure 5 This is a schematic diagram of the target character provided in the embodiments of this application;
[0061] Figure 6 This is a flowchart illustrating the parsing process of multiple lines of data to be parsed, provided in an embodiment of this application.
[0062] Figure 7 This is another flowchart illustrating the parsing of multiple lines of data to be parsed, provided in an embodiment of this application.
[0063] Figure 8 This is another flowchart illustrating the data analysis method provided in the embodiments of this application;
[0064] Figure 9 This is a schematic diagram of the structure of the data analysis device provided in the embodiments of this application;
[0065] Figure 10 This is a schematic diagram of the structure of the computer device provided in the embodiments of this application. Detailed Implementation
[0066] To enable those skilled in the art to better understand the solutions of this application, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0067] It should be noted that in the specific implementation of this application, the kernel source code file and other related data are involved. When the above embodiments of this application are applied to specific products or technologies, the corresponding licenses or consents need to be obtained, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards.
[0068] Before providing a further detailed description of the embodiments of this disclosure, the terms and concepts used in these embodiments are explained, and they are subject to the following interpretations:
[0069] Header files: In the kernel source code files, header files are typically used to define data types, declare functions, and expose interfaces between kernel components. These header files can be self-contained or depend on other header files or source files. For example, in the Linux kernel source code files, header files are ".h" files.
[0070] Regular expressions are text patterns used to match combinations of characters in a string. They include ordinary characters (such as the letters a through z) and special characters (called "metacharacters"), which have specific meanings and are used to define matching rules. Regular expressions use a single string to describe and match a series of strings that conform to a certain syntax rule, and are typically used to retrieve and replace text that matches a specific pattern.
[0071] Structured data: Structured data is a type of data defined based on a data structure, used to organize related data. For example, in the Linux kernel, struct is a data structure, and corresponding structured data can be defined based on this data structure. Some structured data contains all the information required by a process, such as process ID, parent process pointer, child process list head, memory descriptor, etc., while some structured data describes the entire virtual address space of each process.
[0072] First, let's describe the technical problems existing in the relevant technologies:
[0073] With the development of computer technology, many open-source operating systems have emerged, such as Linux, which continuously updates its kernel source code to achieve iterative updates. The kernel source code contains structured data, constructed using related data structures to implement various functions such as process description, address description, and file description. These structured data may differ between different versions of the kernel source code.
[0074] To develop operating system software or systems, it's necessary to analyze the differences in structural data across different versions of kernel source code. These differences then guide subsequent software or system development. One approach is to use distributed version control systems to search for historical changes to structural data. However, these records only reveal differences between different file versions, not between structural data within different kernel source code versions. This necessitates manual verification of these differences, resulting in inefficient structural data discrepancy analysis.
[0075] To address the aforementioned technical problems, embodiments of this application provide a data analysis method, apparatus, computer device, and storage medium. Specifically, in each version of the kernel source code file, multiple lines of data to be parsed are obtained from the header file. During the line-by-line parsing of these lines, annotation variables used for data annotation identification are used to identify annotation data within the multiple lines of data to be parsed. Structure variables used for data structure identification are used to identify the composition structure of the structural data within the multiple lines of data to be parsed. This distinguishes between annotation data and structural data, thereby obtaining multiple sets of structural data and the structural data name of each set, improving the parsing speed of the structural data. Furthermore, by associating each set of structural data in each version of the kernel source code file with its corresponding structural data name to form a first mapping relationship, and by associating the first mapping relationship with the version name of the corresponding version of the kernel source code file to form a second mapping relationship, the second mapping relationship enables rapid retrieval and analysis of the structural data to be analyzed, thereby improving the efficiency of differential analysis of the data.
[0076] Please see Figure 1 , Figure 1 This is a schematic diagram of the system framework corresponding to the data analysis method provided in the embodiments of this application. The data analysis method provided in the embodiments of this application can be applied to this system framework.
[0077] Please refer to the details. Figure 1 , Figure 1 This is a system architecture diagram of the data analysis method provided in this application embodiment. It includes a terminal 140, an Internet 130, a gateway 120, a server 110, etc.
[0078] Terminal 140 or server 110 can be a device that performs data analysis methods.
[0079] Terminal 140 includes, but is not limited to, mobile phones, computers, smart voice interaction devices, smart home appliances, vehicle terminals, and aircraft. This application embodiment can be applied to various scenarios, including but not limited to cloud office and enterprise management. Furthermore, it can be a single device or a collection of multiple devices. For example, multiple desktop computers can be interconnected via a local area network, sharing a single monitor to work collaboratively, forming a single terminal 140. Terminal 140 can communicate with the Internet 130 via wired or wireless means to exchange data.
[0080] Server 110 refers to a computer system that can provide certain services to terminal 140. Compared to ordinary terminal 140, server 110 has higher requirements in terms of stability, security, and performance. Server 110 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.
[0081] Gateway 120, also known as an internetwork connector or protocol converter, is a computer system or device that acts as a translator, enabling network interconnection at the transport layer. It bridges the gap between two systems using different communication protocols, data formats, languages, or even completely different architectures. Gateways can also provide filtering and security functions. Messages sent from terminal 140 to server 110 are forwarded to the corresponding server 110 via gateway 120. Messages sent from server 110 to terminal 140 are also forwarded to the corresponding terminal 140 via gateway 120.
[0082] The data analysis methods in this application can be applied to various scenarios, such as operating system kernel source code analysis and code analysis in code files. This application does not impose any limitations on the scenarios in which the data analysis methods in this application can be applied.
[0083] This application provides a data analysis method, apparatus, computer device, and storage medium. Specifically, this application will describe the data analysis apparatus from the perspective of the data analysis device, which can be integrated into a computer device, such as a server or a terminal. The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The terminal can be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, smart home appliance, vehicle terminal, smart voice interaction device, aircraft, etc., but is not limited to these. This application can be applied to various scenarios, including but not limited to cloud office and enterprise management.
[0084] To gain a more detailed understanding of the data analysis method provided in the embodiments of this application, the following will use the analysis of the kernel source code of the operating system as an example.
[0085] Please see Figure 2 , Figure 2 This is a schematic diagram of a scenario for the data analysis method provided in the embodiments of this application.
[0086] Operating system updates involve updating the kernel source code. When the kernel source code is updated, the corresponding functions or operating mechanisms of the operating system change. For example, new features may be added, process management mechanisms may change, and data access mechanisms may change. Therefore, it is necessary to analyze the kernel source code of different operating system versions and then develop corresponding systems or applications based on the analysis results.
[0087] Each version of the kernel source code corresponds to a kernel source file. Different versions of the kernel source code can be obtained, such as kernel source file V11.0, kernel source file V11.5.6, kernel source file 11.8.3, and kernel source file V12.0. In the kernel source file of different versions, the defined structure data for some data structures differs. Assuming the kernel source file is a Linux system kernel source file, and the structure data is defined under a default data structure (e.g., the default data structure is a `struct` data structure, and the structure data is `struct` data), then the `struct` data in the kernel source file of different versions will be different. Therefore, it is necessary to analyze the differences between the `struct` data in the kernel source file of different versions.
[0088] In this application, multiple versions of kernel source code files can be obtained, and the corresponding header files can be obtained from each version of the kernel source code files. For example, if the header file is a file in the ".h" format, the header file can be obtained according to this data naming format. After obtaining the header file corresponding to each version, data analysis can be performed on the header file corresponding to each version.
[0089] Then, multiple lines of data to be parsed are obtained from the header file, along with annotation variables for identifying data comments and structure variables for identifying data structures in each line. After reading the header file, the computer can read the corresponding code data, which can be preprocessed to obtain multiple lines of data to be parsed. Each line of data to be parsed can be understood as a line of code, and each line has corresponding annotation variables for identifying data comments and structure variables for identifying data structures. The computer can read these annotation variables and structure variables to perform corresponding parsing operations on each line of data. For example, the annotation variables can be used to determine whether the current line of data contains comment data, and the structure variables can be used to determine whether the current line contains structure data. This improves the parsing efficiency of the computer for each line of data to be parsed.
[0090] The computer device parses multiple lines of data line by line based on annotation variables and structure variables, obtaining multiple sets of structure data and the structure data name of each set under the kernel source code file for each version. Each set of structure data corresponds to the structure data under a specific data structure, pre-defined as `struct`, which has multiple sub-data structures, such as `struct mm struct`, `struct task struct`, etc. When the computer device reads a `struct mm struct` data structure, it groups the read structure data into a set and associates this set with the corresponding structure data name. Similarly, when the computer device reads a `struct task struct` data structure, it groups the read structure data into a set and associates this set with the corresponding structure data name. This process yields multiple sets of structure data and the structure data name of each set. The structure data set and its name for each version are the parsing results. For example, the structure data set and its name for version V11.0 is parsing result 1, and the structure data set and its name for version V11.5.6 is parsing result 2.
[0091] Next, each set of structure data in each version of the kernel source code file is associated with its corresponding structure data name to form a first mapping relationship. This first mapping relationship is then associated with the version name of the corresponding version of the kernel source code file to form a second mapping relationship. In other words, by forming the second mapping relationship, a kind of index table is created, which allows you to find the structure data in any parsed version of the kernel source code file.
[0092] Finally, the target version name and target structure data name of the structural data to be analyzed are obtained. Based on these names and the second mapping relationship, multiple sets of target data to be analyzed are then located. For example, if the structural data to be analyzed is from a specific version, the target version name and target structure data name can be obtained. By matching these names with the second mapping relationship, the parsed target data from the same version with the same target structure data name can be found. Analyzing these multiple sets of target data reveals the differences between different versions. For instance, the differences between target data from versions V11.0, V11.5.6, and V12.0 can be compared. In this way, by using the target version name and target structure data name of the structural data to be analyzed, combined with the second mapping relationship, rapid retrieval and analysis of the target data can be achieved, thereby improving the efficiency of difference analysis.
[0093] After obtaining the difference analysis results corresponding to multiple sets of target data to be analyzed, the difference analysis results can guide developers to develop the system or application, thereby improving the development efficiency of the system or application.
[0094] The above is a scenario description of the data analysis method provided in the embodiments of this application. Specifically, it can be applied to analyze the structure data corresponding to the struct data structure in the kernel source code file of the Linux system to analyze the differences between the structure data in the kernel source code files of different versions. However, the data analysis method provided in the embodiments of this application can also be applied to the analysis of other data and should not be regarded as a limitation of this application.
[0095] The data analysis method provided in the embodiments of this application will be described in detail below.
[0096] Please see Figure 3 , Figure 3 This is a flowchart illustrating the data analysis method provided in an embodiment of this application. The data analysis method may include the following steps:
[0097] Step 210: Obtain multiple versions of kernel source code files, and obtain the corresponding header files in each version of the kernel source code file;
[0098] Step 220: Obtain multiple lines of data to be parsed from the header file, and obtain the annotation variables used for data annotation identification and the structure variables used for data structure identification for each line of data to be parsed;
[0099] Step 230: Parse the multiple lines of data to be parsed line by line according to the annotation variables and structure variables to obtain multiple sets of structure data under each version of the kernel source code file and the structure data name of each set of structure data;
[0100] Step 240: Associate each group of structure data under each version of the kernel source code file with the corresponding structure data name to form a first mapping relationship, and associate the first mapping relationship with the version name of the corresponding version of the kernel source code file to form a second mapping relationship;
[0101] Step 250: Obtain the target version name and target structure data name of the structure data to be analyzed, and find the corresponding multiple sets of target data to be analyzed under the second mapping relationship based on the target version name and target structure data name.
[0102] Steps 210 to 250 will be described in detail below.
[0103] In step 210, multiple versions of kernel source code files are obtained, and the corresponding header files are obtained in each version of the kernel source code file.
[0104] The kernel source file can be the kernel source file of an operating system, such as the kernel source file of the Linux operating system. When the operating system is updated and iterated, the kernel source file of the operating system is also updated accordingly, so it is possible to obtain kernel source files from multiple versions.
[0105] Each kernel source code version contains corresponding header files, which include structured data that needs to be parsed. For example, header files are named in the format ".h". By reading this naming format, you can obtain the header files for each kernel source code version.
[0106] In step 220, multiple lines of data to be parsed are obtained from the header file, and annotation variables used for data annotation identification and structure variables used for data structure identification are obtained for each line of data to be parsed.
[0107] The header file contains multiple lines of code data. These lines of code data can be preprocessed for each version's header file to obtain multiple lines of data to be parsed. For example, the multiple lines of code data can be formatted to obtain the final lines of data to be parsed.
[0108] After obtaining multiple rows of data to be parsed, annotation variables for identifying data annotations and structure variables for identifying data structures can be obtained for each row of data. The annotation variables indicate whether each row of data contains annotation data. Each annotation variable has a first state value. When the first state value is a first preset value, the annotation variable indicates that the current row of data does not contain annotation data; when the first state value is a second preset value, the annotation variable indicates that the current row of data contains annotation data.
[0109] Structure variables are used to determine whether the structured data of the current group has been completely parsed, and to determine whether the current group's structured data contains multi-level structured data. Each structure variable has a corresponding second state value, which is determined based on the hierarchy of the structured data. For example, when the start locator of the structured data is read for the first time, the second state value is set to 1. When the start locator is read again, the second state value is incremented to 2. When the start locator is read a third time, the second state value is incremented to 3. Similarly, when the end locator is read for the first time, the second state value is decremented to 2. When the end locator is read again, the second state value is decremented to 1. When the end locator is read a third time, the second state value is decremented to 0, indicating that the current group's structured data has been completely parsed.
[0110] Please refer to the specific details. Figure 4 , Figure 4 This is a schematic diagram of the structured data provided in the embodiments of this application. Taking a set of structured data as an example, when "struct" is read, it indicates that the subsequent data to be parsed contains the structured data defined by "struct". When the start locator "{" is read for the first time, the second state value of the structure variable is updated from 0 to 1. When the start locator "{" is read for the second time, the second state value of the structure variable is updated from 1 to 2. When the start locator "{" is read for the third time, the second state value of the structure variable is updated from 2 to 3. When the end locator "}" is read for the first time, the second state value of the structure variable is updated from 3 to 2. When the end locator "}" is read for the second time, the second state value of the structure variable is updated from 2 to 1. When the end locator "}" is read for the third time, the second state value of the structure variable is updated from 1 to 0. When the second state value of the structure variable is zero, it indicates that the parsing of the current set of structured data is complete.
[0111] It should be noted that structure variables and annotation variables can be understood as a status identifier for each line of data to be parsed. Structure variables and annotation variables will change according to the actual content of each line of data to be parsed. In other words, each line of data to be parsed has corresponding structure variables and annotation variables.
[0112] As described above, in this embodiment, by setting annotation variables, it can be determined whether each line of data to be parsed contains annotation data. By identifying the composition structure of the structural data in multiple lines of data to be parsed, it can be determined whether the current group of structural data has been parsed completely. This achieves the distinction between annotation data and structural data, improving the parsing speed of multiple lines of data to be parsed.
[0113] In some implementations, multiple lines of data to be parsed are obtained from the header file, including:
[0114] (1.1) Match the target character in the header file data according to the first regular expression;
[0115] (1.2) Replace the target character with the preset character to obtain multiple lines of parsed data.
[0116] The first regular expression is used to match target characters in the code data of the header file. For example, the first regular expression is "\s*\n{\s*\n", which can match the corresponding target characters. The target characters can then be replaced, for example, by replacing them with the form expressed by the regular expression "{\n".
[0117] Please refer to the details. Figure 5 , Figure 5 This is a schematic diagram of the target characters provided in the embodiments of this application. Wherein, Figure 5 The left side shows the target characters matched by the first regular expression in the header file's code data, before replacement. Then, the target characters will be replaced, resulting in... Figure 5 The right-hand diagram shows multiple lines of data to be parsed. For example, after "struct", there is the start locator "{" and at least part of the corresponding structural data. By performing character substitution on the target character, the data structure and subsequent structural data can be associated on a single line, increasing the amount of data contained in each line and improving parsing efficiency.
[0118] In step 230, the multiple lines of data to be parsed are parsed line by line according to the annotation variables and structure variables, to obtain multiple sets of structure data under each version of the kernel source code file and the structure data name of each set of structure data.
[0119] In the kernel source code of each version, the multiple lines of data to be parsed can be parsed line by line based on annotation variables and structure variables. That is, the previous line of data to be parsed is parsed line by line, and then the next line of data to be parsed is parsed line by line. Then, the structure data with the same group is grouped together, and the structure data name of each group is obtained. In this way, the multiple groups of structure data in the kernel source code file of each version and the structure data name of each group of structure data are obtained.
[0120] Please see Figure 6 , Figure 6 This is a flowchart illustrating the parsing process of multiple lines of data to be parsed, provided in an embodiment of this application. In some implementations, the multiple lines of data to be parsed are parsed line by line based on annotation variables and structure variables, resulting in multiple sets of structure data under each version of the kernel source code file, as well as the structure data name of each set of structure data, including:
[0121] Step 301: In the multiple rows of data to be parsed, determine the first state value of the annotation variable of the current row of data to be parsed;
[0122] Step 302: When the first state value of the annotation variable is the first preset value, filter the unstructured data in the current row of data to be parsed to obtain preprocessed data to be parsed.
[0123] Step 303: Parse the preprocessed data to be parsed according to the structure variables, obtain the structure data and the corresponding structure data name, and group them. Determine the next row of data to be parsed as the current row of data to be parsed, until each row of data to be parsed is traversed, and obtain multiple sets of structure data and the structure data name of each set of structure data under each version of the kernel source code file.
[0124] Step 304: When the first state value of the annotation variable is the second preset value and the current line of data to be parsed does not contain the comment end character, skip the current line of data to be parsed and determine the next line of data to be parsed as the current line of data to be parsed, until each line of data to be parsed is traversed, and obtain multiple sets of structure data and the structure data name of each set of structure data under the kernel source code file of each version.
[0125] Steps 301 to 304 will be described in detail below.
[0126] In step 301, among the multiple rows of data to be parsed, the first state value of the annotation variable of the current row of data to be parsed is determined.
[0127] In this process, when there are multiple rows of data to be parsed, it is necessary to parse the current row of data and then parse the next row of data to be parsed, thereby achieving the parsing of multiple rows of data line by line.
[0128] To make it easier to understand Figure 6 Please refer to the solution corresponding to the flowchart shown. Figure 7 , Figure 7 This is another flowchart illustrating the parsing of multiple lines of data to be parsed, provided in an embodiment of this application.
[0129] Before determining the first state value of the annotation variable for the current row of data to be parsed, it can be determined whether the multiple rows of data to be parsed have been traversed. If the multiple rows of data to be parsed have not been traversed, the current row of data to be parsed is retrieved, and then the first state value of the annotation variable for the current row of data to be parsed is determined.
[0130] In step 302, when the first state value of the annotation variable is the first preset value, the unstructured data in the current row of data to be parsed is filtered to obtain preprocessed data to be parsed.
[0131] When the first state value of the annotation variable is the first preset value, it is assumed that not all of the data to be parsed in the current row is annotation data. There are two possibilities for the data to be parsed in the current row: one is that the data to be parsed in the current row contains some annotation data, and the other is that the data to be parsed in the current row does not contain annotation data.
[0132] To improve the efficiency of parsing the current row of data to be parsed, this application can filter the unstructured data in the current row of data to be parsed to obtain preprocessed data to be parsed. The preprocessed data to be parsed can be understood as the data after filtering the annotation data in the current row of data to be parsed.
[0133] In some implementations, before filtering the unstructured data in the current row of data to be parsed to obtain preprocessed data to be parsed, the following steps are also included:
[0134] If the current line of data to be parsed contains macro definition characters, discard the current line of data to be parsed and determine the next line of data to be parsed as the current line of data to be parsed.
[0135] For example, if the current line of data to be parsed starts with the character "#", it means that the current line of data to be parsed contains macro definition characters. Since the current line of data to be parsed is macro definition data in C language, it can be discarded and skipped, and the next line of data to be parsed can be determined as the current line of data to be parsed.
[0136] In some implementations, unstructured data in the current row of data to be parsed is filtered to obtain preprocessed data to be parsed, including:
[0137] (1.1) When there is no macro definition character in the current line of data to be parsed, obtain the comment identifier corresponding to the current line of data to be parsed;
[0138] (1.2) Delete the comment data corresponding to the data to be parsed in the current row according to the comment identifier, and determine the data after deleting the comment data as the data to be parsed in the preprocessing.
[0139] For example, if there are no macro definition characters in the current line of data to be parsed, the comment identifier corresponding to the current line of data to be parsed can be obtained. Then, the comment data in the current line of data to be parsed can be determined based on the comment identifier, and the data after deleting the comment data can be determined as the preprocessed data to be parsed.
[0140] The advantage of doing this is that useless comment data can be deleted based on the comment symbols, which is beneficial for subsequent reading of structural data points and can improve the efficiency of computer equipment in reading and parsing structural data.
[0141] In some implementations, comment data corresponding to the data to be parsed in the current line is deleted based on the comment identifier, including:
[0142] (1.2.1) When the comment identifier is a first type of comment identifier, delete the comment identifier and the comment data after the comment identifier in the data to be parsed in the current row;
[0143] (1.2.2) When the comment identifier is a second type of comment identifier and the comment identifier contains a comment start character and a comment end character, the comment start character, the comment end character, and the comment data between the comment start character and the comment end character are deleted in the data to be parsed in the current line.
[0144] For example, the first type of comment identifier is " / / ", and the data after the comment identifier " / / " is the comment data. When the comment identifier is a first type of comment identifier, the comment identifier " / / " and the comment data after it can be deleted.
[0145] For example, the first type of comment identifier is " / *xxxx* / ", where " / *" is the comment start character and "* / " is the comment end character. The data between the comment start character and the comment end character is the comment data. The comment start character, comment end character, and comment data between the comment start character and the comment end character can be deleted from the data to be parsed in the current line.
[0146] In some implementations, comment data corresponding to the data to be parsed in the current line is deleted based on the comment identifier, including:
[0147] (1.2.3) When the comment identifier is a second type of comment identifier and the comment identifier contains a comment start character but does not contain a comment end character, the comment start character and the comment data after the comment start character in the current row of data to be parsed are deleted;
[0148] (1.2.4) Update the first state value to the second preset value to obtain the updated first state value, and determine the updated first state value as the first state value of the annotation variable of the next row of data to be parsed.
[0149] For example, when the comment identifier is a second type of comment identifier and the comment identifier contains a comment start character but does not contain a comment end character, that is, when the comment identifier is the comment start character " / *", the data after the comment start character " / *" is the comment data. In this case, the comment start character " / *" and the comment data after the comment start character " / *" can be deleted.
[0150] Then, the first state value is updated to the second preset value, resulting in the updated first state value. This updated first state value is then used as the first state value for the annotation variable in the next line of data to be parsed. For example, if the first state value of the annotation variable in the current line of data to be parsed is the first preset value, it means that the current line of data to be parsed is not entirely annotation data. However, it is determined that the current line of data to be parsed contains the comment start character " / *", but does not contain the comment end character "* / ". Since the data after the comment start character " / *" is annotation data, the first state value of the annotation variable corresponding to the next line of data to be parsed needs to be changed to the second preset value. In other words, the next line of data to be parsed will contain annotation data.
[0151] As can be seen from the above, in this application, by deleting or skipping the annotation data, the preprocessed data to be parsed is obtained. The preprocessed data to be parsed has a smaller amount of data than the data to be parsed, thus reducing the amount of data that the computer device needs to process and improving the parsing efficiency of multiple lines of data to be parsed.
[0152] Please combine Figure 7 In some implementations, after determining the first state value of the annotation variable for the current row of data to be parsed, the method further includes:
[0153] When the first state value of the annotation variable is the second preset value and the current row of data to be parsed contains the annotation terminator, the first state value is updated to the first preset value, and the step of filtering the unstructured data in the current row of data to be parsed is performed.
[0154] For example, when the first state value of the annotation variable is the second preset value and the current line of data to be parsed contains a comment terminator, the exact end position of the comment terminator is unknown. The comment terminator may be in the middle of the current line of data to be parsed. Therefore, we cannot blindly delete or skip the current line of data to be parsed, as this may incorrectly filter out structured data. Thus, we need to update the first state value of the annotation variable to the first preset value and perform the step of filtering non-structured data in the current line of data to be parsed. In other words, we filter the current line of data to be parsed based on the annotation identifier to avoid incorrect filtering of structured data, thereby improving the accuracy of data parsing.
[0155] In step 303, the preprocessed data to be parsed is parsed according to the structure variables to obtain the structure data and the corresponding structure data name and group them. The next row of data to be parsed is determined as the current row of data to be parsed, until each row of data to be parsed is traversed, and multiple sets of structure data and the structure data name of each set of structure data are obtained under the kernel source code file of each version.
[0156] After obtaining the preprocessed data to be parsed, the preprocessed data to be parsed can be parsed according to the structure variables to obtain the structure data and the corresponding structure data name and group them. That is, all structure data under a structure data name are grouped together, which can avoid the situation that the structure data under a certain structure data name is incomplete.
[0157] Then, the next line of data to be parsed is determined as the current line of data to be parsed, and the data parsing of the current line of data to be parsed continues. In this way, the parsing result corresponding to the current line of data to be parsed is obtained. This process can be repeated to achieve the parsing of multiple lines of data to be parsed line by line until each line of data to be parsed is traversed, and multiple sets of structure data and the structure data name of each set of structure data are obtained under the kernel source code file of each version.
[0158] Please combine Figure 7 In some implementations, the preprocessed data to be parsed is parsed based on structural variables to obtain structural data and corresponding structural data names, and then grouped, including:
[0159] (1.1) Determine the second state value of the structure variables of the data to be parsed in the preprocessing;
[0160] (1.2) When the second state value is zero and the preprocessed data to be parsed matches the second regular expression corresponding to the preset data structure, the preprocessed data to be parsed is determined as structured data and the structured data name is obtained, and the structured data is grouped according to the structured data name.
[0161] (1.3) The second state value is updated by adding value to obtain the updated second state value, and the updated second state value is determined as the second state value of the structure variable of the next row of data to be parsed.
[0162] After obtaining the preprocessed parsed data, the state values of the structure variables can be determined. If the second state value of the structure variable is zero, and the preprocessed data to be parsed matches the second regular expression corresponding to the preset data structure (meaning the structure variable's value is zero), and the preprocessed data to be parsed matches the second regular expression "^struct\s+\s+\s*{$", it indicates that the preprocessed data to be parsed is structured data defined by the "struct" data structure, and the data corresponding to this data structure has multiple levels of structured data. At this point, the preprocessed data to be parsed is identified as structured data, and the structure data name is obtained. The structured data is then grouped according to the structure data name, for example, using the structure data name as the group name. The structured data is then assigned to the group, thus establishing a relationship between the structure data name and the structured data. The structured data and its name in this group are saved to the database for subsequent retrieval and data analysis.
[0163] Then, the second state value of the structure variable is updated by adding a value, for example, increasing the second state value from 0 to 1, and the updated second state value is 1. The updated second state value is determined as the second state value of the structure variable of the next row of data to be parsed, and the second state value of the structure variable of the next row of data to be parsed is 1.
[0164] Please combine Figure 7 In some implementations, the preprocessed data to be parsed is parsed based on structural variables to obtain structural data and corresponding structural data names, and then grouped, including:
[0165] (2.1) When the second state value is greater than zero and the preprocessed data to be parsed matches the second regular expression corresponding to the preset data structure, the preprocessed data to be parsed is determined as structured data, and the structured data name corresponding to the previous row of data to be parsed is determined as the structured data name of the structured data, and the structured data is grouped according to the structured data name.
[0166] (2.2) When the preprocessed data to be parsed contains a start locator, the second state value is updated by adding a value to obtain the updated second state value, and the updated second state value is determined as the second state value of the structure variable of the next row of data to be parsed;
[0167] (2.3) When the preprocessed data to be parsed contains an end locator but does not contain a start locator, the second state value is decremented to obtain the updated second state value, and the updated second state value is determined as the second state value of the structure variable of the next row of data to be parsed.
[0168] Understandably, the minimum value of the second state of the structure variable is zero. After updating the second state value by adding a value, the second state value of the structure variable of the preprocessed data to be parsed in the current row is greater than zero, indicating that the data level corresponding to the preprocessed data to be parsed in the current row is deeper. At this time, the structure data is obtained from the preprocessed data to be parsed in the current row, and the name of the structure data corresponding to the data to be parsed in the previous row is determined as the structure data name of the structure data. In this way, the structure data corresponding to the preprocessed data to be parsed in the current row is grouped together by the structure data name.
[0169] Then, it can be determined whether the preprocessed data to be parsed contains a start locator. If the preprocessed data to be parsed contains a start locator, the second state value is incremented to obtain an updated second state value, and this updated second state value is set as the second state value of the structure variable of the next row of data to be parsed. For example, if the second state value of the structure variable of the current row of data to be parsed is 1, then after incrementing the second state value, the second state value is updated from 1 to 2. The second state value of the structure variable of the next row of data to be parsed is 2, indicating that the structure data contained in the next row of data to be parsed still belongs to the structure data of the current group.
[0170] If the preprocessed data to be parsed in the current row does not contain a start locator, then determine whether the preprocessed data to be parsed in the current row contains an end locator. If the preprocessed data to be parsed in the current row does not contain an end locator, it means that the structure data corresponding to the current group has not been parsed. Then continue to parse the data to be parsed in the next row, while keeping the second state value of the structure variable of the data to be parsed in the next row as the second state value of the preprocessed data to be parsed in the current row.
[0171] If the preprocessed data to be parsed in the current row does not contain a start locator, but contains an end locator, it means that the structured data corresponding to the current group is about to be parsed. At this point, the second state value can be decremented to obtain an updated second state value, which is then used as the second state value of the structured variable for the next row of data to be parsed. For example, updating the second state value from 2 to 1 sets the second state value of the structured variable for the next row of data to be parsed to 1. This process continues, parsing the next row of data and setting it as the current row of data to be parsed. If the preprocessed data to be parsed in the current row does not contain a start locator, but contains an end locator, the second state value is updated from 1 to 0, and the second state value of the structured variable for the next row of data to be parsed is set to 0.
[0172] When the second state value of the state variable corresponding to the data to be parsed in the current row is 0, it means that all the structure data corresponding to the current group has been read. At this time, the structure data and structure data name of the current group are grouped.
[0173] In step 304, when the first state value of the annotation variable is the second preset value and the current line of data to be parsed does not contain the comment end character, the current line of data to be parsed is skipped, and the next line of data to be parsed is determined as the current line of data to be parsed, until each line of data to be parsed is traversed, and multiple sets of structure data and the structure data name of each set of structure data are obtained under the kernel source code file of each version.
[0174] Please combine Figure 7 If the first state value of the annotation variable of the data to be parsed in the current row is the second preset value and the data to be parsed in the current row does not contain the end-of-comment character, it means that all the data to be parsed in the current row is annotation data. In this case, the data to be parsed in the current row can be skipped directly, and the data to be parsed in the next row can be determined as the data to be parsed in the current row.
[0175] For each line of data to be parsed, the data parsing can be achieved by determining the first state value of the annotation variable and the second state value of the structure variable as described above, until each line of data to be parsed is traversed, resulting in multiple sets of structure data under each version of the kernel source code file and the structure data name of each set of structure data.
[0176] As described in steps 301 to 304 above, for each row of data to be parsed across multiple rows, if the annotation variables determine that the current row consists entirely of annotation data, then that row is skipped. If the annotation variables and annotation terminator determine that the current row contains both annotation data and other data, then the current row is filtered to remove the annotation data, resulting in preprocessed data. This preprocessed data is then parsed based on its corresponding structure variables to obtain and group the relevant structured data. This approach reduces the need to parse annotation data, improving data parsing efficiency, and groups structured data with the same name together, improving the accuracy of data parsing.
[0177] In step 240, each set of structure data under each version of the kernel source code file is associated with the corresponding structure data name to form a first mapping relationship, and the first mapping relationship is associated with the version name of the corresponding version of the kernel source code file to form a second mapping relationship.
[0178] After obtaining multiple sets of structure data under each version of the kernel source code file, determine the structure data and its corresponding name, associate each set of structure data under each version of the kernel source code file with its corresponding name to form a first mapping relationship, and then associate the first mapping relationship with the version name of the corresponding version of the kernel source code file to form a second mapping relationship.
[0179] This second mapping relationship is equivalent to an index table or lookup table. When a structure data name or version name is entered into a computer device, the computer device can find the corresponding structure data based on the second mapping relationship.
[0180] In this embodiment, after obtaining each set of structured data, the structured data can be stored in a database. Specifically, it can be determined whether there is a corresponding structured data name in the database. If there is no corresponding structured data name in the database, a key-value pair data structure can be constructed using the version name of the structured data kernel source file as the key and the structured data as the value. Then, the data under the key-value pair data structure is serialized to obtain serialized data, which is stored in the storage area under the structured data name. This can improve the storage efficiency of the database and save storage space.
[0181] If the database contains a structure name corresponding to the structured data, the serialized structured data corresponding to that structured data name is deserialized to obtain the data under the key-value pair data structure. Then, it is determined whether the key for the kernel source code version corresponding to the current structured data exists within the data under the key-value pair data structure. If it exists, it means the current structured data was previously saved, and it is discarded. If it does not exist, it means the current structured data has not been saved. At this point, a key-value pair data structure is constructed using the kernel source code file version name of the structured data as the key and the serialized structured data as the value. The data under the key-value pair data structure is then serialized to obtain the serialized data, which is stored in the storage area under the structured data name. This improves database storage efficiency and saves storage space.
[0182] The above method can reduce the weight of structured data, and store structured data under different kernel source code versions under the corresponding structured data names. This can reduce the number of database queries and improve data retrieval efficiency.
[0183] The serialization method used in this application can be Protocol Buffers serialization, which defines a concise language to describe data structures. Then, a specific compiler can be used to generate code in different programming languages for serializing and deserializing these data structures.
[0184] In step 250, the target version name and target structure data name of the structure data to be analyzed are obtained, and multiple sets of target data to be analyzed are found under the second mapping relationship based on the target version name and target structure data name.
[0185] During the data analysis phase, the target version name and target structure data name of the structure data to be analyzed can be obtained. The structure data to be analyzed can be the structure data of the kernel source code of an operating system under a certain version. Then, the target version name and target structure data name are matched with the second mapping relationship to obtain the matching result. Then, based on the matching result, the target data to be analyzed with the same target data name as the target data name, as well as the target data to be analyzed with the same target version name and target structure data name, are matched in the database.
[0186] Finally, the data to be analyzed can be sorted according to the version name of the kernel source code file and the name of the structure data to generate a data analysis table, which helps to improve the efficiency of data analysis.
[0187] In some implementations, multiple sets of target data to be analyzed are located under the second mapping relationship based on the target version name and the target structure data name, including:
[0188] (1.1) Based on the target version name and target structure data name, search for multiple sets of target data to be analyzed stored in the database under the second mapping relationship;
[0189] (1.2) Delete the whitespace characters in each group of target data to be analyzed to generate preprocessed data to be analyzed, and determine the verification value of each group of preprocessed data to be analyzed;
[0190] (1.3) Generate a data analysis table based on the target data to be analyzed, the target version name, and the target structure data name, and generate corresponding color markers in the data analysis table based on the similarity between the verification values corresponding to each group of target data to be analyzed;
[0191] (1.4) Analyze the corresponding target data according to the color symbols and data analysis table.
[0192] Specifically, multiple sets of target data to be analyzed can be retrieved from the database based on the target version name and target structure data name under the second mapping relationship. During the acquisition of these multiple sets of data, deserialization can be performed on the corresponding data to obtain the final set of data to be analyzed.
[0193] Due to the influence of different data structure formats, whitespace characters in each group of target data to be analyzed can be removed to generate preprocessed data to be analyzed. The preprocessed data to be analyzed can be understood as a string. The check value corresponding to each preprocessed data to be analyzed can be calculated. For example, first calculate the MD5 value of the preprocessed data to be analyzed, and then convert the MD5 value to the hex format to obtain the check value corresponding to each preprocessed data to be analyzed.
[0194] Then, a data analysis table is generated based on the target data to be analyzed, the target version name, and the target structure data name. Next, the first six digits of the checksum corresponding to the preprocessed data to be analyzed are obtained. Data with the same first six digits are assigned the same color. Finally, the corresponding color is used to generate the appropriate color for the column of the structure data in the data analysis table based on the color marker. This allows for a more intuitive view of the data analysis table, thereby improving the efficiency of data analysis.
[0195] Finally, the differences in structural data between different kernel source code versions can be determined by analyzing the strings manually or using computer equipment, thus obtaining the difference analysis results. These results can guide developers in implementing corresponding application or system development.
[0196] As described above, in this embodiment, multiple versions of kernel source code files are obtained, and corresponding header files are obtained in each version of the kernel source code file; multiple lines of data to be parsed are obtained in the header files, and annotation variables used for data annotation identification and structure variables used for data structure identification are obtained in each line of data to be parsed; the multiple lines of data to be parsed are parsed line by line according to the annotation variables and structure variables to obtain multiple sets of structure data under each version of the kernel source code file and the structure data name of each set of structure data; each set of structure data under each version of the kernel source code file is associated with the corresponding structure data name to form a first mapping relationship, and the first mapping relationship is associated with the version name of the corresponding version of the kernel source code file to form a second mapping relationship; the target version name and target structure data name of the structure data to be analyzed are obtained, and the corresponding multiple sets of target data to be analyzed are found under the second mapping relationship according to the target version name and target structure data name for analysis. Therefore, in each version of the kernel source code file, by obtaining multiple lines of data to be parsed from the header file, and during the process of parsing these multiple lines of data line by line, annotation variables used for data annotation identification can be used to identify the annotation data in the multiple lines of data to be parsed, and structure variables used for data structure identification can be used to identify the composition structure of the structure data in the multiple lines of data to be parsed. This distinguishes between annotation data and structure data, thereby obtaining multiple sets of structure data and the structure data name of each set of structure data, improving the parsing speed of multiple lines of data to be parsed. Furthermore, by associating each set of structure data in each version of the kernel source code file with the corresponding structure data name to form a first mapping relationship, and associating the first mapping relationship with the version name of the corresponding version of the kernel source code file to form a second mapping relationship, the target version name and target structure data name of the structure data to be analyzed, combined with the second mapping relationship, can achieve rapid search and data analysis of the target data to be analyzed, thereby improving the efficiency of data difference analysis.
[0197] Please see Figure 8 , Figure 8 This is another schematic flowchart of the data analysis method provided in this application embodiment, which may include the following steps:
[0198] Step 401: Obtain kernel source code files for multiple versions, and obtain the corresponding header files for each version of the kernel source code file;
[0199] Step 402: Obtain multiple lines of data to be parsed from the header file, and obtain the annotation variables used for data annotation identification and the structure variables used for data structure identification for each line of data to be parsed;
[0200] Step 403: In the multiple rows of data to be parsed, determine the first state value of the annotation variable of the current row of data to be parsed;
[0201] Step 404: When the first state value of the annotation variable is the first preset value, filter the unstructured data in the current row of data to be parsed to obtain preprocessed data to be parsed.
[0202] Step 405: Parse the preprocessed data to be parsed according to the structure variables, obtain the structure data and the corresponding structure data name, and group them. Determine the next row of data to be parsed as the current row of data to be parsed, until each row of data to be parsed is traversed, and obtain multiple sets of structure data and the structure data name of each set of structure data under each version of the kernel source code file.
[0203] Step 406: When the first state value of the annotation variable is the second preset value and the current line of data to be parsed does not contain the comment end character, skip the current line of data to be parsed and determine the next line of data to be parsed as the current line of data to be parsed, until each line of data to be parsed is traversed, and obtain multiple sets of structure data and the structure data name of each set of structure data under the kernel source code file of each version.
[0204] Step 407: When the first state value of the annotation variable is the second preset value and the current row of data to be parsed contains the annotation terminator, update the first state value to the first preset value and perform the step of filtering the unstructured data in the current row of data to be parsed.
[0205] Step 408: Based on the target version name and target structure data name, search the database for multiple sets of target data to be analyzed stored under the second mapping relationship;
[0206] Step 409: Delete the whitespace characters in each group of target data to be analyzed to generate preprocessed data to be analyzed, and determine the check value of each group of preprocessed data to be analyzed;
[0207] Step 410: Generate a data analysis table based on the target data to be analyzed, the target version name, and the target structure data name, and generate corresponding color markers in the data analysis table based on the similarity between the verification values corresponding to each group of target data to be analyzed;
[0208] Step 411: Analyze the corresponding target data according to the color symbols and data analysis table.
[0209] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the detailed description of the data analysis method above, which will not be repeated here.
[0210] Please see Figure 9 , Figure 9This is a schematic diagram of the data analysis apparatus provided in an embodiment of this application. This data analysis apparatus can be used to perform the data analysis methods described above.
[0211] In this application embodiment, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0212] Data analysis device 500, including:
[0213] The first acquisition module 510 is used to acquire multiple versions of kernel source code files and acquire the corresponding header files in each version of the kernel source code file;
[0214] The second acquisition module 520 is used to acquire multiple lines of data to be parsed in the header file, and to acquire the annotation variables used for data annotation identification and the structure variables used for data structure identification in each line of data to be parsed.
[0215] Parsing module 530 is used to parse multiple lines of data to be parsed line by line based on annotation variables and structure variables, to obtain multiple sets of structure data under each version of the kernel source code file and the structure data name of each set of structure data.
[0216] The association module 540 is used to associate each group of structure data under each version of the kernel source code file with the corresponding structure data name to form a first mapping relationship, and associate the first mapping relationship with the version name of the corresponding version of the kernel source code file to form a second mapping relationship;
[0217] Analysis module 550 is used to obtain the target version name and target structure data name of the structure data to be analyzed, and to find the corresponding multiple sets of target data to be analyzed under the second mapping relationship based on the target version name and target structure data name.
[0218] In some implementations, the second acquisition module 520 is used for:
[0219] The target character is matched in the header file data based on the first regular expression;
[0220] The target character is replaced according to the preset character to obtain multiple lines of parsed data.
[0221] In some implementations, the parsing module 530 includes a determining submodule, a first parsing submodule, and a second parsing submodule. The determining submodule is used to determine the first state value of the annotation variable of the current row of data to be parsed among multiple rows of data to be parsed.
[0222] The first parsing submodule is used to filter the unstructured data in the current row of data to be parsed when the first state value of the annotation variable is the first preset value, so as to obtain the preprocessed data to be parsed.
[0223] The preprocessed data to be parsed is parsed according to the structure variables, and the structure data and the corresponding structure data name are obtained and grouped. The next row of data to be parsed is determined as the current row of data to be parsed, until each row of data to be parsed is traversed, and multiple sets of structure data and the structure data name of each set of structure data are obtained under the kernel source code file of each version.
[0224] The second parsing submodule is used to skip the current line of data to be parsed when the first state value of the annotation variable is the second preset value and the current line of data to be parsed does not contain the end of the annotation. It then determines the next line of data to be parsed as the current line of data to be parsed, until each line of data to be parsed is traversed, and obtains multiple sets of structure data and the structure data name of each set of structure data under the kernel source code file of each version.
[0225] In some implementations, after determining the first state value of the annotation variable for the current row of data to be parsed, the second parsing submodule is used to:
[0226] When the first state value of the annotation variable is the second preset value and the current row of data to be parsed contains the annotation terminator, the first state value is updated to the first preset value, and the step of filtering the unstructured data in the current row of data to be parsed is performed.
[0227] In some implementations, the first parsing submodule is used for:
[0228] Determine the second state value of the structure variables of the preprocessed data to be parsed;
[0229] When the second state value is zero and the preprocessed data to be parsed matches the second regular expression corresponding to the preset data structure, the preprocessed data to be parsed is determined as structured data and the structured data name is obtained. The structured data is then grouped according to the structured data name.
[0230] The second state value is updated by adding a value to obtain the updated second state value, and the updated second state value is determined as the second state value of the structure variable of the next row of data to be parsed.
[0231] In some implementations, the first parsing submodule is used for:
[0232] When the second state value is greater than zero and the preprocessed data to be parsed matches the second regular expression corresponding to the preset data structure, the preprocessed data to be parsed is determined as structured data, and the structured data name corresponding to the previous row of data to be parsed is determined as the structured data name of the structured data, and the structured data is grouped according to the structured data name.
[0233] When the preprocessed data to be parsed contains a start locator, the second state value is updated by adding a value to obtain the updated second state value, and the updated second state value is determined as the second state value of the structure variable of the next row of data to be parsed;
[0234] When the preprocessed data to be parsed contains an end locator but not a start locator, the second state value is decremented to obtain the updated second state value, and the updated second state value is determined as the second state value of the structure variable of the next row of data to be parsed.
[0235] In some implementations, the parsing module 530 further includes a filtering submodule, which, before filtering the unstructured data in the current row of data to be parsed to obtain preprocessed data to be parsed, is used to:
[0236] If the current line of data to be parsed contains macro definition characters, discard the current line of data to be parsed and determine the next line of data to be parsed as the current line of data to be parsed.
[0237] The first parsing submodule is used for:
[0238] If the macro definition character does not exist in the current line of data to be parsed, obtain the comment identifier corresponding to the current line of data to be parsed;
[0239] Delete the comment data corresponding to the data to be parsed in the current row based on the comment identifier, and determine the data after deleting the comment data as the data to be parsed for preprocessing.
[0240] In some implementations, the first parsing submodule is used for:
[0241] When the comment identifier is a first-type comment identifier, delete the comment identifier and the comment data following the comment identifier in the current row of data to be parsed;
[0242] When the comment identifier is a second type of comment identifier and the comment identifier contains a comment start character and a comment end character, the comment start character, the comment end character, and the comment data between the comment start character and the comment end character are deleted from the data to be parsed in the current line.
[0243] In some implementations, the first parsing submodule is used for:
[0244] When the comment identifier is a second type of comment identifier and the comment identifier contains a comment start character but does not contain a comment end character, the comment start character and the comment data after the comment start character in the current line of data to be parsed are deleted;
[0245] The first state value is updated to the second preset value to obtain the updated first state value, and the updated first state value is determined as the first state value of the annotation variable of the next row of data to be parsed.
[0246] In some implementations, the analysis module 550 is used for:
[0247] Based on the target version name and target structure data name, search the database for multiple sets of target data to be analyzed stored under the second mapping relationship;
[0248] Remove spaces from each set of target data to be analyzed to generate preprocessed data to be analyzed, and determine the checksum of each set of preprocessed data to be analyzed;
[0249] A data analysis table is generated based on the target data to be analyzed, the target version name, and the target structure data name. A corresponding color label is generated in the data analysis table based on the similarity between the verification values corresponding to each group of target data to be analyzed.
[0250] The corresponding target data is analyzed based on color-coded symbols and data analysis tables.
[0251] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the detailed description of the data analysis method above, which will not be repeated here.
[0252] As described above, in this embodiment, the first acquisition module 510 acquires multiple versions of kernel source code files and obtains the corresponding header files in each version of the kernel source code file; the second acquisition module 520 acquires multiple lines of data to be parsed in the header files and acquires the annotation variables used for data annotation identification and the structure variables used for data structure identification in each line of data to be parsed; the parsing module 530 parses the multiple lines of data to be parsed line by line according to the annotation variables and structure variables, and obtains multiple sets of structure data under each version of the kernel source code file and the structure data name of each set of structure data; the association module 540 associates each set of structure data under each version of the kernel source code file with the corresponding structure data name to form a first mapping relationship, and associates the first mapping relationship with the version name of the corresponding version of the kernel source code file to form a second mapping relationship; the analysis module 550 acquires the target version name and target structure data name of the structure data to be analyzed, and finds the corresponding multiple sets of target data to be analyzed under the second mapping relationship according to the target version name and target structure data name for analysis. Therefore, in each version of the kernel source code file, by obtaining multiple lines of data to be parsed from the header file, and during the process of parsing these multiple lines of data line by line, annotation variables used for data annotation identification can be used to identify the annotation data in the multiple lines of data to be parsed, and structure variables used for data structure identification can be used to identify the composition structure of the structure data in the multiple lines of data to be parsed. This distinguishes between annotation data and structure data, thereby obtaining multiple sets of structure data and the structure data name of each set of structure data, improving the parsing speed of multiple lines of data to be parsed. Furthermore, by associating each set of structure data in each version of the kernel source code file with the corresponding structure data name to form a first mapping relationship, and associating the first mapping relationship with the version name of the corresponding version of the kernel source code file to form a second mapping relationship, the target version name and target structure data name of the structure data to be analyzed, combined with the second mapping relationship, can achieve rapid search and data analysis of the target data to be analyzed, thereby improving the efficiency of data difference analysis.
[0253] Please see Figure 10 , Figure 10 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. This application also provides a computer device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the aforementioned XXX method. This computer device can be any smart terminal, including tablet computers, in-vehicle computers, etc.
[0254] Please see Figure 10 , Figure 10 The hardware structure of a computer device according to another embodiment is illustrated. The computer device includes:
[0255] The processor 601 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application.
[0256] The memory 602 can be implemented as a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 602 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 602 and is called and executed by the processor 601 using the data analysis method of the embodiments of this application.
[0257] The input / output interface 603 is used to implement information input and output;
[0258] The communication interface 604 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0259] Bus 605 transmits information between various components of the device (e.g., processor 601, memory 602, input / output interface 603, and communication interface 604);
[0260] The processor 601, memory 602, input / output interface 603, and communication interface 604 are connected to each other within the device via bus 605.
[0261] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described data analysis method.
[0262] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0263] The data analysis method, apparatus, computer equipment, and storage medium provided in this application embodiment obtain multiple versions of kernel source code files and corresponding header files in each version of the kernel source code file; obtain multiple lines of data to be parsed in the header files, and obtain annotation variables for data annotation identification and structure variables for data structure identification in each line of data to be parsed; parse the multiple lines of data to be parsed line by line according to the annotation variables and structure variables to obtain multiple sets of structure data under each version of the kernel source code file and the structure data name of each set of structure data; associate each set of structure data under each version of the kernel source code file with the corresponding structure data name to form a first mapping relationship, and associate the first mapping relationship with the version name of the corresponding version of the kernel source code file to form a second mapping relationship; obtain the target version name and target structure data name of the structure data to be analyzed, and find the corresponding multiple sets of target data to be analyzed under the second mapping relationship according to the target version name and target structure data name for analysis. Therefore, in each version of the kernel source code file, by obtaining multiple lines of data to be parsed from the header file, and during the process of parsing these multiple lines of data line by line, annotation variables used for data annotation identification can be used to identify the annotation data in the multiple lines of data to be parsed, and structure variables used for data structure identification can be used to identify the composition structure of the structure data in the multiple lines of data to be parsed. This distinguishes between annotation data and structure data, thereby obtaining multiple sets of structure data and the structure data name of each set of structure data, improving the parsing speed of multiple lines of data to be parsed. Furthermore, by associating each set of structure data in each version of the kernel source code file with the corresponding structure data name to form a first mapping relationship, and associating the first mapping relationship with the version name of the corresponding version of the kernel source code file to form a second mapping relationship, the target version name and target structure data name of the structure data to be analyzed, combined with the second mapping relationship, can achieve rapid search and data analysis of the target data to be analyzed, thereby improving the efficiency of data difference analysis.
[0264] The embodiments described in this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.
[0265] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this application, and may include more or fewer steps than shown, or combine certain steps, or different steps.
[0266] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0267] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or appropriate combinations thereof.
[0268] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0269] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0270] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0271] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0272] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0273] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0274] The preferred embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of the present application shall be within the scope of the claims of the present application.
Claims
1. A data analysis method, characterized in that, include: Obtain kernel source code files from multiple versions, and retrieve the corresponding header files from each version of the kernel source code file; Obtain multiple lines of data to be parsed from the header file, and obtain the annotation variables used for data annotation identification and the structure variables used for data structure identification for each line of data to be parsed; Based on the annotation variables and the structure variables, the multiple lines of data to be parsed are parsed line by line to obtain multiple sets of structure data under each version of the kernel source code file and the structure data name of each set of structure data. Associate each set of structure data in each version of the kernel source code file with the corresponding structure data name to form a first mapping relationship, and associate the first mapping relationship with the version name of the corresponding version of the kernel source code file to form a second mapping relationship; Obtain the target version name and target structure data name of the structure data to be analyzed, and find the corresponding multiple sets of target data to be analyzed under the second mapping relationship based on the target version name and the target structure data name.
2. The data analysis method according to claim 1, characterized in that, The step of obtaining multiple lines of data to be parsed from the header file includes: The target character is matched in the data of the header file according to the first regular expression; The target character is replaced according to the preset character to obtain multiple lines of parsed data.
3. The data analysis method according to claim 1, characterized in that, The process involves parsing the multiple lines of data to be parsed line by line based on the annotation variables and the structure variables, resulting in multiple sets of structure data under each version of the kernel source code file, as well as the structure data name of each set of structure data, including: In the multiple rows of data to be parsed, determine the first state value of the annotation variable of the current row of data to be parsed; When the first state value of the annotation variable is the first preset value, the unstructured data in the current row of data to be parsed is filtered to obtain preprocessed data to be parsed. The preprocessed data to be parsed is parsed according to the structure variables to obtain the structure data and the structure data name corresponding to the structure data and group them. The next row of data to be parsed is determined as the current row of data to be parsed until each row of data to be parsed is traversed to obtain multiple sets of structure data under each version of the kernel source code file and the structure data name of each set of structure data. When the first state value of the annotation variable is the second preset value and the current line of data to be parsed does not contain the comment end character, skip the current line of data to be parsed, and determine the next line of data to be parsed as the current line of data to be parsed, until each line of data to be parsed is traversed, and obtain multiple sets of structure data under each version of the kernel source code file and the structure data name of each set of structure data.
4. The data analysis method according to claim 3, characterized in that, After determining the first state value of the annotation variable for the current row of data to be parsed, the process further includes: When the first state value of the annotation variable is the second preset value and the current line of data to be parsed contains the annotation terminator, the first state value is updated to the first preset value, and the step of filtering unstructured data in the current line of data to be parsed is performed.
5. The data analysis method according to claim 3, characterized in that, The step of parsing the preprocessed data to be parsed based on the structural variables to obtain structural data and the corresponding structural data names, and grouping them, includes: Determine the second state value of the structure variables of the preprocessed data to be parsed; When the second state value is zero and the preprocessed data to be parsed matches the second regular expression corresponding to the preset data structure, the preprocessed data to be parsed is determined as structured data and the structured data name is obtained, and the structured data is grouped according to the structured data name; The second state value is updated by adding a value to obtain the updated second state value, and the updated second state value is determined as the second state value of the structure variable of the next row of data to be parsed.
6. The data analysis method according to claim 5, characterized in that, The step of parsing the preprocessed data to be parsed based on the structural variables to obtain structural data and the corresponding structural data names, and grouping them, includes: When the second state value is greater than zero and the preprocessed data to be parsed matches the second regular expression corresponding to the preset data structure, the preprocessed data to be parsed is determined as structured data, and the structured data name corresponding to the previous row of data to be parsed is determined as the structured data name of the structured data, and the structured data is grouped according to the structured data name. When the preprocessed data to be parsed contains a start locator, the second state value is updated by adding a value to obtain the updated second state value, and the updated second state value is determined as the second state value of the structure variable of the next row of data to be parsed; When the preprocessed data to be parsed contains an end locator but does not contain a start locator, the second state value is decremented to obtain an updated second state value, and the updated second state value is determined as the second state value of the structure variable of the next row of data to be parsed.
7. The data analysis method according to claim 3, characterized in that, Before filtering the unstructured data in the current row of data to be parsed to obtain preprocessed data to be parsed, the process also includes: If the current line of data to be parsed contains macro-defined characters, discard the current line of data to be parsed and determine the next line of data to be parsed as the current line of data to be parsed. The step of filtering unstructured data in the current row of data to be parsed to obtain preprocessed data to be parsed includes: When the macro definition character does not exist in the current line of data to be parsed, obtain the comment identifier corresponding to the current line of data to be parsed; The annotation data corresponding to the current row of data to be parsed is deleted according to the annotation identifier, and the data after deleting the annotation data is determined as the preprocessed data to be parsed.
8. The data analysis method according to claim 7, characterized in that, The step of deleting the annotation data corresponding to the current line of data to be parsed based on the annotation identifier includes: When the annotation identifier is a first type of annotation identifier, the annotation identifier and the annotation data following the annotation identifier are deleted from the current row of data to be parsed; When the comment identifier is a second type of comment identifier and the comment identifier contains a comment start character and a comment end character, the comment data between the comment start character, the comment end character, and the comment data between the comment start character and the comment end character in the current line of data to be parsed is deleted.
9. The data analysis method according to claim 8, characterized in that, The step of deleting the annotation data corresponding to the current line of data to be parsed based on the annotation identifier includes: When the comment identifier is a second type of comment identifier and the comment identifier contains the comment start character but does not contain the comment end character, the comment start character and the comment data after the comment start character in the current line of data to be parsed are deleted; The first state value is updated to the second preset value to obtain the updated first state value, and the updated first state value is determined as the first state value of the annotation variable of the next row of data to be parsed.
10. The data analysis method according to claim 1, characterized in that, The step of finding and analyzing multiple sets of target data to be analyzed under the second mapping relationship based on the target version name and the target structure data name includes: Based on the target version name and the target structure data name, search for multiple sets of target data to be analyzed stored in the database under the second mapping relationship; Remove spaces from each set of target data to be analyzed to generate preprocessed data to be analyzed, and determine the checksum of each set of preprocessed data to be analyzed; A data analysis table is generated based on the target data to be analyzed, the target version name, and the target structure data name. A corresponding color mark is generated in the data analysis table based on the similarity between the verification values corresponding to each group of target data to be analyzed. The corresponding target data to be analyzed is analyzed based on the color markers and the data analysis table.
11. A data analysis device, characterized in that, include: The first acquisition module is used to acquire kernel source code files from multiple versions, and to acquire the corresponding header files from each version of the kernel source code file; The second acquisition module is used to acquire multiple lines of data to be parsed from the header file, and to acquire annotation variables used for data annotation identification and structure variables used for data structure identification in each line of data to be parsed. The parsing module is used to parse the multiple lines of data to be parsed line by line according to the annotation variables and the structure variables, so as to obtain multiple sets of structure data under the kernel source code file of each version and the structure data name of each set of structure data. The association module is used to associate each set of structure data under each version of the kernel source code file with the corresponding structure data name to form a first mapping relationship, and associate the first mapping relationship with the version name of the corresponding version of the kernel source code file to form a second mapping relationship; The analysis module is used to obtain the target version name and target structure data name of the structure data to be analyzed, and to find the corresponding multiple sets of target data to be analyzed under the second mapping relationship based on the target version name and the target structure data name.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a plurality of instructions adapted for loading by a processor to execute the data analysis method according to any one of claims 1 to 10.
13. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the data analysis method according to any one of claims 1 to 10.
14. A computer program product comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by a processor, they implement the data analysis method according to any one of claims 1 to 10.