Disclosure of Invention
The application aims to provide a method, a device and equipment for analyzing a data file, which are high in efficiency and low in energy consumption, and a computer readable storage medium, and effectively ensure the normal operation of an analysis process.
In order to solve the above technical problem, the present application provides a method for parsing a data file, including:
periodically traversing each performance data folder, and executing the following steps when traversing each performance data folder:
acquiring the analysis state information of the current performance data folder from an analysis state information base; the analysis state information base stores and updates the identification information and the analysis state information of all the performance data folders which participate in analysis; the analysis state information is the state information of an analysis thread which is opened for the performance data folder during the last time of the pass;
if the analysis state information of the current performance data folder is an analysis ending state, restarting an analysis thread aiming at the current performance data folder so as to analyze each performance data file in the current performance data folder in sequence; updating the analysis state information of the current performance data folder in the analysis state information base into an analysis running state;
if the analysis state information of the current performance data folder is an analysis running state, ending the traversal of the current performance data folder so as to start to traverse other performance data folders.
Optionally, sequentially parsing each performance data file in the current performance data folder includes:
adding each performance data file in the current performance data folder into an analysis queue;
and analyzing the performance data files in the analysis queue in sequence, and saving analysis results and deleting the performance data files after the analysis of each performance data file is completed.
Optionally, the identification information of the performance data folder is a path of the performance data folder.
Optionally, the parsing state information is expressed by boolean values.
Optionally, when the analysis state information of the current performance data folder is obtained in the analysis state information base, the method further includes:
if the acquisition fails, starting an analysis thread aiming at the current performance data folder so as to analyze each performance data file in the current performance data folder in sequence; and the analysis state information of the current performance data folder is recorded in the analysis state information base in a supplementing mode.
The application also provides an analysis device for the performance data file, which comprises:
an acquisition module: the analysis state information database is used for acquiring the analysis state information of the current performance data folder when each performance data folder is traversed periodically; the analysis state information base stores and updates the identification information and the analysis state information of all the performance data folders which participate in analysis; the analysis state information is the state information of an analysis thread which is opened for the performance data folder during the last time of the pass;
an analysis module: the analysis thread corresponding to the current performance data folder is restarted when the analysis state information of the current performance data folder is an analysis ending state, so that each performance data file in the current performance data folder is analyzed in sequence; updating the analysis state information of the current performance data folder into an analysis running state;
an end module: and when the analysis state information of the current performance data folder is an analysis running state, ending the traversal of the current performance data folder so as to start to traverse other performance data folders.
Optionally, the parsing module is specifically configured to:
adding each performance data file in the current performance data folder into an analysis queue; and analyzing the performance data files in the analysis queue in sequence, and saving analysis results and deleting the performance data files after the analysis of each performance data file is completed.
Optionally, the parsing module is further configured to:
when the acquisition module fails to acquire the analysis state information of the current performance data folder, starting an analysis thread aiming at the current performance data folder so as to analyze each performance data file in the current performance data folder in sequence; and the analysis state information of the current performance data folder is recorded in the analysis state information base in a supplementing mode.
The application also provides an analysis device of the performance data file, which comprises:
a memory: for storing a computer program;
a processor: for executing the computer program to implement the steps of any of the performance data file parsing methods described above.
The present application further provides a computer-readable storage medium having a computer program stored thereon, which, when being executed by a processor, is adapted to carry out the steps of any of the methods for parsing a performance data file as described above.
The method for analyzing the data file comprises the following steps: periodically traversing each performance data folder, and executing the following steps when traversing each performance data folder: acquiring the analysis state information of the current performance data folder from an analysis state information base; the analysis state information base stores and updates the identification information and the analysis state information of all the performance data folders which participate in analysis; the analysis state information is the state information of an analysis thread which is opened for the performance data folder during the last time of the pass; if the analysis state information of the current performance data folder is an analysis ending state, restarting an analysis thread aiming at the current performance data folder so as to analyze each performance data file in the current performance data folder in sequence; updating the analysis state information of the current performance data folder in the analysis state information base into an analysis running state; if the analysis state information of the current performance data folder is an analysis running state, ending the traversal of the current performance data folder so as to start to traverse other performance data folders.
Therefore, compared with the prior art, in the analysis method of the data file provided by the application, the real-time analysis state information of each performance data folder is recorded and updated by establishing the analysis state information base, a new analysis thread can be started for the performance data folder with the last analysis completed when the performance data folder is traversed each time, and no analysis processing is performed on the performance data folder with the last analysis not completed. Therefore, the condition that a plurality of analysis threads analyze the same performance data file can be effectively avoided, the normal operation of analysis work is ensured, the analysis efficiency is effectively improved, and the analysis energy consumption is reduced. The data file analyzing device, the data file analyzing equipment and the computer readable storage medium can realize the data file analyzing method, and also have the beneficial effects.
Detailed Description
The core of the application is to provide a method, a device, equipment and a computer readable storage medium for analyzing a data file with high efficiency and low energy consumption, and simultaneously effectively ensure the normal operation of an analysis process.
In order to more clearly and completely describe the technical solutions in the embodiments of the present application, the technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application. It is to be understood that the embodiments described are only a few embodiments of the present application and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Referring to fig. 1, fig. 1 is a flowchart of a data file parsing method provided in the present application, and the main steps include periodically traversing each performance data folder, where traversing each performance data folder mainly includes the following steps:
step 1: and acquiring the analysis state information of the current performance data folder in an analysis state information base.
The analysis state information base stores and updates the identification information and the analysis state information of all performance data folders participating in analysis; the analysis state information is the state information of the analysis thread which is opened to the performance data folder during the last pass.
If the analysis state information of the current performance data folder is an analysis ending state, entering the step 2; and if the analysis state information of the current performance data folder is the analysis running state, entering the step 3.
Specifically, the analysis method for the data file provided by the application establishes an analysis state information base for storing the analysis state information of each performance data folder which participates in analysis. Of course, in order to identify each performance data folder, identification information of each performance data folder is also generally stored. The analysis state information comprises an analysis running state and an analysis ending state and is used for representing the running state of an analysis thread opened to the performance data folder when the performance data file is traversed last time.
Step 2: restarting an analysis thread aiming at the current performance data folder so as to analyze each performance data file in the current performance data folder in sequence; and updating the analysis state information of the current performance data folder in the analysis state information base into an analysis running state.
Specifically, when the analysis state information of the performance data file is an analysis end state, it indicates that the analysis thread that was opened for the performance data folder during the last pass has completed the analysis work, and all the performance data files that need to be analyzed are analyzed, and at this time, the performance data files that still exist in the performance data folder should all be performance data files that are newly generated after the last analysis thread is opened, and they have not been added to any analysis thread. Therefore, at this time, a new parsing thread may be opened for the performance data folder, and all performance data files existing in the performance data folder at this time may be parsed.
Moreover, when a new parsing thread is started, the parsing status of the performance data folder changes, and therefore, the parsing status information of the performance data folder needs to be updated in the parsing status information base.
And step 3: the traversal of the current performance data folder is ended to begin traversing the other performance data folders.
Specifically, on the other hand, when the analysis state information of the performance data folder is in the analysis running state, it indicates that the analysis thread opened for the performance data folder during the last pass has not been run and ended, and a part of the performance data file to be analyzed is not analyzed at that time, and therefore, the part of the performance data file to be analyzed is stored in the performance data folder together with the newly generated performance data file. In order to avoid that a plurality of analysis threads analyze the same performance data file, at this time, a new analysis thread does not need to be opened for the performance data folder, but the traversal of the performance data folder can be directly ended, and the traversal of the next performance data folder is started.
Therefore, in the analysis method for the data file provided by the application, the real-time analysis state information of each performance data folder is recorded and updated by establishing the analysis state information base, so that a new analysis thread can be started for the performance data folder which has been analyzed last time when the performance data folder is traversed each time, and the performance data folder which has not been analyzed last time is not subjected to any analysis processing. Therefore, the condition that a plurality of analysis threads analyze the same performance data file can be effectively avoided, the normal operation of analysis work is ensured, the analysis efficiency is effectively improved, and the analysis energy consumption is reduced.
The method for analyzing the data file provided by the application is based on the embodiment as follows:
as a preferred embodiment, sequentially parsing each performance data file in the current performance data folder includes:
adding each performance data file in the current performance data folder into an analysis queue;
and analyzing the performance data files in the analysis queue in sequence, and saving analysis results and deleting the performance data files after the analysis of each performance data file is completed.
Specifically, when a plurality of performance data files exist in the traversed current performance data folder, all the performance data files can be added into the analysis queue, and the analysis thread is started to analyze the performance data files in the analysis queue in sequence. As described above, generally, after one performance data file is analyzed, the performance data file is deleted and the analysis result is stored.
As a preferred embodiment, the identification information of the performance data folder is a path of the performance data folder.
Specifically, a path is generally used to identify a folder, and therefore, the identification information of the performance data folder may also be used as the path.
As a preferred embodiment, the parsing state information is expressed in boolean values.
Specifically, the boolean value includes two states of fire and FALSE, which are easy to recognize, and therefore, in order to enhance readability, the analytic state information may be expressed in a boolean value representation manner. For example, the analysis status information indicating that the current performance data folder is in the analysis end status may be referred to as "tune"; and the FALSE represents the analysis state information of the current performance data folder as the analysis running state.
As a preferred embodiment, when the analysis state information of the current performance data folder is obtained in the analysis state information base, the method further includes:
if the acquisition fails, starting an analysis thread aiming at the current performance data folder so as to analyze each performance data file in the current performance data folder in sequence; and the analysis state information of the current performance data folder is supplementarily recorded in the analysis state information base.
Specifically, if the acquisition fails when the analysis state information of the current performance data folder is acquired in the analysis state information base, it indicates that the current performance data folder has not been subjected to analysis and has not been added to the analysis state information base. Therefore, at this time, an analysis thread can be directly opened for the performance data folder to analyze the performance data file therein.
The following describes an analysis apparatus for data files provided in the present application.
Referring to fig. 2, fig. 2 is a block diagram illustrating a structure of a data file parsing apparatus according to the present application; the system comprises an acquisition module 1, an analysis module 2 and an end module 3;
the obtaining module 1 is configured to obtain analysis state information of a current performance data folder in an analysis state information base when each performance data folder is periodically traversed.
The analysis state information base stores and updates the identification information and the analysis state information of all performance data folders participating in analysis; the analysis state information is the state information of the analysis thread which is opened to the performance data folder during the last pass.
The analysis module 2 is used for restarting an analysis thread aiming at the current performance data folder when the analysis state information of the current performance data folder is an analysis ending state so as to analyze each performance data file in the current performance data folder in sequence; updating the analysis state information of the current performance data folder into an analysis running state;
the ending module 3 is configured to end traversal of the current performance data folder when the analysis state information of the current performance data folder is an analysis running state, so as to start traversal of other performance data folders.
Therefore, the data file analysis device provided by the application records and updates the real-time analysis state information of each performance data folder by establishing the analysis state information base, can open a new analysis thread for the performance data folder with the last analysis completed when traversing the performance data folders each time, and does not perform any analysis processing on the performance data folder with the last analysis not completed. Therefore, the condition that a plurality of analysis threads analyze the same performance data file can be effectively avoided, the normal operation of analysis work is ensured, the analysis efficiency is effectively improved, and the analysis energy consumption is reduced.
The data file analysis device provided by the application is based on the embodiment:
as a preferred embodiment, the parsing module 2 is specifically configured to:
adding each performance data file in the current performance data folder into an analysis queue; and analyzing the performance data files in the analysis queue in sequence, and saving analysis results and deleting the performance data files after the analysis of each performance data file is completed.
As a preferred embodiment, the parsing module 2 is further configured to:
when the acquisition module fails to acquire the analysis state information of the current performance data folder, starting an analysis thread aiming at the current performance data folder so as to analyze each performance data file in the current performance data folder in sequence; and the analysis state information of the current performance data folder is supplementarily recorded in the analysis state information base.
The application also provides an analysis device of the performance data file, which comprises:
a memory: for storing a computer program;
a processor: for executing the computer program to implement the steps of any of the performance data file parsing methods described above.
The present application further provides a computer-readable storage medium having a computer program stored thereon, which, when being executed by a processor, is adapted to carry out the steps of any of the methods for parsing a performance data file as described above.
The specific embodiments of the data file parsing apparatus, the device and the computer-readable storage medium provided in the present application and the data file parsing method described above may be referred to correspondingly, and are not described herein again.
The embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
It is further noted that, throughout this document, relational terms such as "first" and "second" are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Furthermore, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The technical solutions provided by the present application are described in detail above. The principles and embodiments of the present application are explained herein using specific examples, which are provided only to help understand the method and the core idea of the present application. It should be noted that, for those skilled in the art, it is possible to make several improvements and modifications to the present application without departing from the principle of the present application, and such improvements and modifications also fall within the scope of the claims of the present application.