CN116775419B - File system monitoring method and device - Google Patents

File system monitoring method and device Download PDF

Info

Publication number
CN116775419B
CN116775419B CN202311086278.0A CN202311086278A CN116775419B CN 116775419 B CN116775419 B CN 116775419B CN 202311086278 A CN202311086278 A CN 202311086278A CN 116775419 B CN116775419 B CN 116775419B
Authority
CN
China
Prior art keywords
file
files
storage container
time
partition
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202311086278.0A
Other languages
Chinese (zh)
Other versions
CN116775419A (en
Inventor
王延弼
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Honor Device Co Ltd
Original Assignee
Honor Device Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202311086278.0A priority Critical patent/CN116775419B/en
Publication of CN116775419A publication Critical patent/CN116775419A/en
Application granted granted Critical
Publication of CN116775419B publication Critical patent/CN116775419B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/3034Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a storage system, e.g. DASD based or network based
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3089Monitoring arrangements determined by the means or processing involved in sensing the monitored data, e.g. interfaces, connectors, sensors, probes, agents
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/32Monitoring with visual or acoustical indication of the functioning of the machine
    • G06F11/324Display of status information

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application provides a method and a device for monitoring a file system, wherein the method comprises the following steps: creating a storage container comprising file information of a plurality of files, wherein the files in the storage container are ordered from large to small, and the size of each file in the plurality of files in the storage container is larger than the sizes of other files in a partition where the storage container is located; acquiring the size of a first file in a file system when the first file performs writing operation or offset operation every time; updating file information stored in a storage container according to the size of the first file to obtain updated file information; and uploading the updated file information to a server so that the server displays the updated file information. The scheme realizes a more refined monitoring scheme by creating a storage container for each partition to pertinently manage the largest files, and can dynamically discover and monitor the abnormally-increased files, thereby discovering the files with the abnormality in the partition as soon as possible and preventing the files from being happened.

Description

File system monitoring method and device
Technical Field
The present application relates to the field of monitoring a file system, and in particular, to a method and an apparatus for monitoring a file system.
Background
Often, the storage space of a file system is divided into a plurality of partitions, and each partition contains some files, that is, files stored in the file system are stored in different partitions. When any software product runs in the operating system of the electronic device, operations such as reading and writing are required to be performed on files stored in the file system, and if there is an error in these operations, the storage space of some partitions may be rapidly reduced or even fully occupied, which may cause abnormal functions of the software product corresponding to the files stored in the partitions, and even the software product cannot be run any more.
In order to solve the above problems, a scheme of alerting by monitoring the partition status of a file system has appeared, that is, if a certain partition is detected that the storage space of the partition is full or the space status is abnormal, the abnormal status of the partition is acquired and then the partition is alerted.
However, in such an alarm scheme, when an alarm occurs, the partition being alarmed is damaged and the software product corresponding to the partition is affected, so that the alarm scheme cannot meet the requirement of timely finding a problem.
Therefore, how to monitor the file system more timely is a technical problem to be solved.
Disclosure of Invention
The application provides a method and a device for monitoring a file system, which can monitor the file system more timely.
In a first aspect, a method for monitoring a file system is provided, the method comprising: creating a storage container comprising file information of a plurality of files, wherein the files in the storage container are ordered from large to small, and the size of each file in the plurality of files in the storage container is larger than the sizes of other files in a partition where the storage container is located; acquiring the size of a first file in a file system when the first file performs writing operation or offset operation every time; updating file information stored in a storage container according to the size of the first file to obtain updated file information; and uploading the updated file information to a server so that the server displays the updated file information.
According to the technical scheme, a storage container is created for each partition to pertinently manage the largest files to achieve a finer monitoring scheme, and the files with the abnormally increased sizes can be dynamically found and monitored, so that the files with the abnormal sizes in the partition can be found as soon as possible. In the scheme of the embodiment of the application, as long as any one file (namely the first file) in the partition is continuously increased due to writing operation and/or offset operation, the size of the file is necessarily increased, and the file is necessarily added into the updated file information of the storage container, so that the function of dynamic monitoring is realized. In addition, the scheme of the embodiment of the application not only monitors the capacity of the whole partition, but also thins to monitor a plurality of files in the storage container, namely, the files which are most likely to cause the partition to be full are monitored in a focus way, compared with the traditional scheme that whether the partition is full or not is damaged only by macroscopic monitoring, the method can monitor the abnormally-increased files more accurately and timely, and lock the abnormally-increased files before the partition is full or damaged, thereby preventing the abnormally-increased files from being damaged.
It should be appreciated that, as described above, each of the plurality of files in the storage container is larger in size than the other files in the partition in which the storage container is located, where the other files refer to files in this partition other than the files in the storage container or are in the partition but not stored in the storage container. It should also be appreciated that file information is stored in the storage container and that rather than transferring the files to the storage container, the files are stored in the partition.
It should also be appreciated that the storage containers may be directly in the corresponding partition, which is convenient to manage. However, in actual implementation, the storage containers may be centralized and externally arranged, for example, some storage units may be divided, and these storage containers may be separately and centrally stored.
With reference to the first aspect, in certain implementation manners of the first aspect, when updating file information stored in the storage container according to a size of the first file, the method may include:
when a plurality of files in the storage container comprise first files, updating the size of the first files stored in the storage container to the size of the first files acquired at the current time, and reordering the plurality of files in the storage container according to the sequence from large to small; or,
When the first file is not included in the plurality of files in the storage container, the file information stored in the storage container is updated according to a relationship between the size of the first file and the size of the smallest file in the storage container.
In this implementation, when the file information of the first file is already stored in the storage container, it is stated that the first file is one of the larger files that the partition (the partition corresponding to the storage container) is selected to monitor, at this time, only the size of the first file stored in the storage container needs to be updated to the size increased due to the writing operation or the offset operation, and the reordering can facilitate management of the files in the storage container; when there is no first file in the storage container, it is indicated that the first file is not a larger file in this partition, and at this time, it is necessary to further check whether this first file can be added to the rank of the storage container. According to the implementation mode, dynamic updating of the storage container can be achieved, any file which is abnormally increased can be added into the storage container due to the step, and therefore the file is displayed on a server side, and workers can find the file timely.
With reference to the first aspect, in certain implementation manners of the first aspect, when the plurality of files in the storage container do not include the first file, updating the file information stored in the storage container according to a relationship between a size of the first file and a size of a smallest file in the storage container may include:
when the size of the first file is larger than that of the minimum file, deleting the minimum file in the storage container, adding the first file into a plurality of files in the storage container, and reordering all files in the storage container according to the sequence from large to small; or,
when the size of the first file is smaller than or equal to the size of the minimum file, file information in the storage container is not changed.
In this implementation, dynamic updating of files in the storage container is mainly implemented, and any file is added to the storage container when it is increased to be larger than the smallest file in the storage container. It will be appreciated that a file larger than the smallest file does not account for the smallest file that would be present after the file was added, so that reordering enables the order of the sizes of the files in all storage containers after the first file was added to be updated synchronously.
With reference to the first aspect, in certain implementation manners of the first aspect, the method further includes:
acquiring the accumulated operation times of a second file in a file system, wherein the accumulated operation times are the times of writing operation and/or offset operation on the second file in a preset statistical period;
uploading the accumulated operation times of the second file to the server so that the server displays the accumulated operation times of the second file.
In such implementations, files that are frequently being subjected to write operations and/or offset operations are discovered primarily through monitoring of the number of operations. This implementation can be considered to be an overlay scheme based on the monitoring of file size of the present application, adding to another monitoring strategy for finding abnormal files, the files frequently being written and/or shifted tend to be increasing with these operations, with a higher likelihood of anomalies and a greater impact on the partition. It should be appreciated that the second file is any file in the file system, which partition need not be locked, nor need it be restricted to be in a storage container, so the second file may or may not be the same file as the first file. This implementation is also a fine-to-file granularity monitoring scheme, finer, and more in place.
In one example, in obtaining the accumulated number of operations for the second file in the file system may include:
creating a counter of the second file, wherein the initial value of the counter is zero;
in a preset statistical period, adding one to the value of the counter every time a write operation or an offset operation to the second file is detected;
after the preset counting period is finished, the numerical value of the counter is determined to be the accumulated operation times of the second file, and the numerical value of the counter is cleared.
In this example, the total number of times a file is subjected to a write operation and an offset operation in each preset counting period is counted by setting a counter for each file, and it is displayed that if a certain file is subjected to a write operation and/or an offset operation frequently, it is monitored.
In another example, when uploading the accumulated operation number of the second file to the server so that the server displays the accumulated operation number of the second file, it may include:
comparing the relation between the accumulated operation times of the second file and a preset time threshold, wherein the preset time threshold is a time threshold corresponding to a preset statistical period;
and uploading the accumulated operation times of the second file to the server when the accumulated operation times of the second file are greater than or equal to a preset time threshold.
The accumulated operation times need to be uploaded once in each preset statistical period of each file, but in fact, many files are not abnormal, so that uploading of a large amount of monitoring data can bring about data transmission burden, and the method is not beneficial to workers to find the files with the abnormalities in time. Therefore, by setting the number threshold, only the data of the file whose cumulative number of operations is greater than or equal to the number threshold can be uploaded. Therefore, the number of data transmission times can be reduced, and workers can find (screen out) abnormal files more quickly.
In the embodiment of the application, the number of times is monitored for each file, but the amount of the uploaded data and how to upload the data affect the workload of the staff for analyzing and processing the monitoring result. Besides the implementation mode that only the times risk is screened out by setting the preset times threshold, that is, the files with the abnormality exist, the files with the largest times can be uploaded by taking the files for the whole file system or each partition.
With reference to the first aspect, in certain implementation manners of the first aspect, the method further includes:
Acquiring the accumulated operation times of each file in a file system, wherein the accumulated operation times are the times of writing operation and/or offset operation on each file in a preset statistical period;
uploading the accumulated operation times of M files with the accumulated operation times of M being the first in a preset statistical period in the file system to a server, so that the server displays the accumulated operation times of the M files with the accumulated operation times of M being an integer greater than 1 in the file system.
In this implementation manner, only M files with the largest accumulated operation times are uploaded for the whole file system to display the accumulated operation times, and the data transmission amount is small. The M files are the files with the largest cumulative operation times in the file system, that is, the cumulative operation times of any one of the M files is greater than or equal to the cumulative operation times of other files except the M files. In this implementation, the first M files are displayed, but there is no requirement that these M must exceed the count threshold, so it will be understood that these M may already have one or more exception files, but there may be no exception files. This implementation more reasonably reveals the "health" of the file system than screening only files that are abnormal in nature as a whole. For example, when none of the M files has an abnormal file (i.e., no file having a cumulative number of operations greater than or equal to a preset number of times threshold), it is indicated that the file system is normal as a whole; when the M files have a small number of abnormal files, the problem that the file system has some hidden dangers but the problem is not serious is shown; when all the M files are abnormal files, the problem that the file system has potential abnormality is seriously solved.
In one example, in obtaining the cumulative number of operations for each file in the file system, it may include:
creating a counter for each file in the file system, and setting the initial value of the counter to be zero;
for each file, in a preset statistical period, adding one to the value of the counter every time a write operation or an offset operation to the file is detected;
after the preset counting period is finished, the numerical value of the counter of each file is determined to be the accumulated operation times of the file, and the numerical value of the counter is cleared.
That is, the method of acquiring the cumulative number of operations by the counter is not limited to any number of monitoring strategies, as long as the number of times of monitoring the file can be used.
With reference to the first aspect, in certain implementation manners of the first aspect, the method further includes:
acquiring the accumulated operation times of each file of a first partition in a file system, wherein the accumulated operation times are the times of writing operation and/or offset operation on each file in a preset statistical period; the first partition is any partition in the file system;
uploading the accumulated operation times of the files with the accumulated operation times of P in the first partition within a preset statistical period to a server, so that the server displays the accumulated operation times of the P in the first partition, wherein P is an integer larger than 1.
In this implementation, only P files with the largest accumulated operation times are uploaded for each partition to display the accumulated operation times, and the data transmission amount is small. The P files are the files with the largest accumulated operation times in the first partition, that is, the accumulated operation times of any one file in the P files are larger than or equal to the accumulated operation times of other files in the first partition except the P files. In this implementation, the first P files are displayed, but the P must exceed the threshold number of times is not required, so it is understood that the P may already have one or more exception files, but may not have any exception files. This implementation more reasonably reveals the "health" of each partition in the file system than screening only the files that are in exception as a whole. For example, when none of the P files has an abnormal file (i.e., no file having a cumulative number of operations greater than or equal to a preset number of times threshold), it is indicated that the first partition is normal as a whole; when the P files have a small number of abnormal files, the first partition has some hidden dangers but the problem is not serious; when the P files are all abnormal files, it is indicated that there is an abnormal hidden danger in the first partition, and the problem is serious.
It should also be appreciated that this implementation more reasonably reflects the file system situation than the previous M files screened for the entire file system. For example, assuming that M files reported in the above solution of the entire file system are all of a certain partition, only the partition problem is serious, but the hidden situation of other partitions is not opportunistically revealed, and there are other partitions that are possibly problematic only if the problem is not serious, but because the monitoring solution of the entire file system is submerged. So taking the first P displays per partition is finer and more reasonable than taking the first M displays for the entire file system.
It should be further noted that, in the frequency monitoring strategy, since the frequency operation does not have a steady gradual trend, that is, does not steadily increase or decrease, the ranking of each cumulative count period does not depend too much on the value of the previous cumulative count period, so that it is not necessary to set a storage container to maintain the ranking as in the size monitoring strategy. That is, the change of the file with the largest number of operations per time has no gradual trend, the sequence of the file per time is greatly changed, and if the storage container is set, the information in the storage container needs to be updated very frequently, which is too complicated.
In one example, in obtaining the cumulative number of operations for each file of the first partition of the file system, it may include:
creating a counter for each file in the first partition, and setting the initial value of the counter to be zero;
for each file in the first partition, in a preset statistical period, adding one to the value of the counter every time a write operation or an offset operation to the file is detected;
after the preset statistical period is finished, the numerical value of the counter of each file in the first partition is determined as the accumulated operation times of the file, and the numerical value of the counter is cleared.
That is, the method of acquiring the cumulative number of operations by the counter is not limited to any number of monitoring strategies, as long as the number of times of monitoring the file can be used.
With reference to the first aspect, in certain implementation manners of the first aspect, the method further includes:
acquiring the N-time operation duration of a third file in the file system, wherein the N-time operation duration is used for indicating the time-consuming duration for executing the N-time writing operation or the offset operation, and N is a positive integer;
and uploading the operation duration of the Nth time of the third file to the server after the operation duration of the Nth time of the third file is numbered in sequence by using N, so that the server displays the operation duration of the Nth time of the third file according to the sequence number.
In this implementation, the file with the abnormal operation duration is mainly discovered through monitoring the operation duration. It can be considered that this implementation is an overlay scheme based on the monitoring of the file size of the present application, and adds another monitoring policy for finding abnormal files, where files with excessively long execution time of one execution of a write operation or an offset operation tend to be abnormal, and the influence on the partition is greater. It should be appreciated that the third file is any file in the file system, which partition need not be locked, nor need it be restricted to be in a storage container, so the third file and the first file may be the same file or not the same file; the third file and the second file may or may not be the same file. This implementation is also a fine-to-file granularity monitoring scheme, finer, and more in place.
It should also be appreciated that the present application provides three monitoring strategies, size monitoring, frequency monitoring and time consuming monitoring, respectively. The size monitoring refers to monitoring of the size of any file, and in the embodiment of the present application, the size of some files is monitored with a storage container in a targeted manner. The number of times monitoring is monitoring of the number of operations (which may be regarded as the operation frequency) for a certain time of an arbitrary file. Time consuming monitoring refers to monitoring the length of time that each write operation and/or offset operation is performed. The three monitoring strategies can be combined arbitrarily, and the more the combined strategies are, the better the monitoring effect is, and the more the protection of the file system is in place.
In one example, when acquiring the nth time duration of the operation on the third file in the file system, it may include:
recording a system time when execution of an nth write operation or an offset operation on the third file starts and a system time when execution is completed;
the difference between the system time when the execution is completed and the system time when the execution is started is determined as the nth operation duration of the third file.
In this example, the operation duration is calculated by using the difference of the system time, and the calculation is simple and accurate, and is more accurate and simple than calculation by using other modes such as natural time. Because the clock adopted by the system in execution is fixed, when the system time is used for calculation, the time length can be accurately calculated by calculating the number of clocks.
In another example, when the nth time period of the third file is sequentially numbered with "N" and then uploaded to the server, so that the server displays the nth time period of the third file according to the sequence number, the method may include:
comparing the relation between the N-th operation time length of the third file and a preset time length threshold;
when the N-th operation time length of the third file is greater than or equal to a preset time length threshold, the N-th operation time length of the third file is sequentially numbered by 'N', and then the operation time length is uploaded to a server.
The time length of uploading operation is needed when each file is subjected to writing operation or offset operation, but in fact, many files are not time-consuming and abnormal, so that uploading of a large amount of monitoring data can bring about data transmission burden, and the file with abnormal condition is not easy to find by staff in time. Therefore, by setting the duration threshold, only the data of the file with the operation duration greater than or equal to the duration threshold can be uploaded. Therefore, the number of data transmission times can be reduced, and workers can find (screen out) abnormal files more quickly.
In the embodiment of the application, time-consuming monitoring is performed on each file, but the amount of data uploaded and how to upload the data can influence the workload of staff on analysis processing of monitoring results. Besides the implementation mode that only the files with time consumption risks, namely the files with anomalies, are screened out by setting the preset time length threshold, only the files with the longest time consumption can be taken for the whole file system or each partition to upload.
With reference to the first aspect, in certain implementation manners of the first aspect, the method further includes:
Acquiring an nth time operation duration of each file in a file system, wherein the nth time operation duration is used for indicating a time-consuming duration for executing an nth writing operation or an offset operation on each file, and N is a positive integer;
when each uploading period is finished, the N-th operation time length of the K files with the operation time length of the previous K in the file system is sequentially numbered by N and then uploaded to the server, so that the server displays the N-th operation time length of the previous K files in the file system according to the sequential numbering; k is an integer greater than 1.
In this implementation manner, for the whole file system, only K files with the longest time duration are taken for each uploading period to upload the operation duration of the nth operation of the K files for display, and the data transmission amount is small. The K files are the files with the longest time duration of the Nth operation in the file system. In this implementation, the first K files are displayed, but there is no requirement that all of these K files must be long enough, so it will be understood that these K files may already have one or more exception files, but may not have any exception files. This implementation more reasonably reveals the "health" of the file system than screening only files that are abnormal in nature as a whole. For example, when none of the K files has an abnormal file (i.e., no file with an operational time period greater than or equal to a preset time period threshold), it is indicated that the file system as a whole is normal; when the K files have a small number of abnormal files, the problem that the file system has some hidden dangers but the problem is not serious is shown; when all the K files are abnormal files, the problem that the file system has potential abnormality is seriously solved.
In one example, when acquiring the nth time duration of the operation for each file in the file system, it may include:
for each file in the file system, the recorded system time at the start of execution of the nth write operation or offset operation and the system time at the completion of execution; and determining a difference between the system time when the execution is completed and the system time when the execution is started as an nth operation duration of the file.
That is, the scheme of calculating the operation time period by using the system time is not limited to any time-consuming monitoring strategy as long as the time-consuming monitoring of the file is possible.
With reference to the first aspect, in certain implementation manners of the first aspect, the method further includes:
acquiring the N-time operation duration of each file in a second partition in the file system, wherein the N-time operation duration is used for indicating the time-consuming duration of executing the N-time writing operation or the offset operation on each file, and N is a positive integer; the second partition is any partition in the file system;
when each preset uploading period is finished, the N-th operation time length of the L files with the N-th operation time length of the previous L in the second partition is sequentially numbered by N and then uploaded to the server, so that the server displays the N-th operation time length of the previous L files in the second partition according to the sequential numbering; l is an integer greater than 1.
In this implementation manner, for each partition, each uploading period only takes L files with the longest time duration to upload the operation duration of the nth operation for display, and the data transmission amount is small. The L files are the files with the longest time duration of the Nth operation in the second partition. In this implementation, the first L files are displayed, but there is no requirement that all of these L files must be long enough, so it will be understood that these L files may already have one or more exception files, but may not have any exception files. This implementation more reasonably reveals the "health" of the second partition than simply screening files for anomalies as a whole. For example, when none of the L files has an abnormal file (i.e., no file having an operational time period greater than or equal to a preset time period threshold), it is indicated that the second partition is normal as a whole; when the L files have a small number of abnormal files, the second partition has some hidden dangers but the problem is not serious; when all the L files are abnormal files, the second partition has abnormal hidden danger, and the problem is serious.
It should also be appreciated that this implementation more reasonably reflects the file system situation than the previous K files screened for the entire file system. For example, assuming that K files reported in the above solution of the entire file system are all partitioned, only the partition problem is serious, but the hiding situation of other partitions is not opportunistically revealed, and there are other partitions that are possibly problematic only if the partition is not serious, but because the monitoring solution of the entire file system is submerged. So taking the first L displays by partition is finer and more reasonable than taking the first K displays by the entire file system.
It should be further noted that, in the time-consuming monitoring strategy, since the operation duration of each time does not have a steady gradual trend, that is, does not steadily increase or decrease, there is no interdependence between the operation durations of each time, so that it is not necessary to set a storage container for maintenance as in the size monitoring strategy. That is, the change of the file with the longest operation duration of each time has no gradual trend, the sequence of the file of each time can change greatly, and if the storage container is set, the information in the storage container needs to be updated very frequently, which is too cumbersome.
In one example, when acquiring the nth time duration of operation of each file in the second partition in the file system, it may include:
for each file in the second partition, the recorded system time at the start of execution of the nth write operation or offset operation and the system time at the completion of execution; and determining a difference between the system time when the execution is completed and the system time when the execution is started as an nth operation duration of the file.
That is, the scheme of calculating the operation time period by using the system time is not limited to any time-consuming monitoring strategy as long as the time-consuming monitoring of the file is possible.
In a second aspect, a monitoring device of a file system is provided, the device comprising means for performing any one of the methods of the first aspect, consisting of software and/or hardware.
In a third aspect, there is provided an electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, which when executed by the processor enables the electronic device to implement any one of the methods of the first aspect.
In a fourth aspect, there is provided a chip comprising a processor for reading and executing a computer program stored in a memory, which when executed by the processor enables an electronic device in which the chip is located to carry out any one of the methods of the first aspect.
Optionally, the chip further comprises a memory, the memory being electrically connected to the processor.
Optionally, the chip may further comprise a communication interface.
In a fifth aspect, a computer readable storage medium is provided, the computer readable storage medium storing a computer program, the computer program being capable of implementing any one of the methods of the first aspect when executed by an electronic device.
In a sixth aspect, a computer program product is provided, the computer program product comprising a computer program capable of implementing any one of the methods of the first aspect when the computer program is executed by an electronic device.
Drawings
FIG. 1 is a schematic diagram of a monitoring system for a file system according to an embodiment of the present application.
FIG. 2 is a topology diagram of three monitoring strategies in accordance with an embodiment of the present application.
FIG. 3 is a schematic flow chart of a method of monitoring a file system according to an embodiment of the application.
FIG. 4 is a schematic diagram of a size monitoring strategy according to an embodiment of the present application.
FIG. 5 is a schematic diagram of a time consuming monitoring strategy according to an embodiment of the present application.
Fig. 6 is a schematic diagram of a monitoring device of a file system according to an embodiment of the present application.
Fig. 7 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present application.
Fig. 8 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present application.
Detailed Description
Embodiments of the present application will be described below with reference to the accompanying drawings.
FIG. 1 is a schematic diagram of a monitoring system for a file system according to an embodiment of the present application. As shown in FIG. 1, some operations may be performed on the file system when the product is running on the system, either during the product development stage or after the product has been installed on the electronic device. These operations are performed according to a service (task) to be performed. These operations include read, write, offset, open, close, and the like. Among these operations, the write operation and the offset operation are operations that cause the file size to become large, that is, cause the file to be enlarged. That is, writing and shifting into a file causes the file to become larger.
In conventional approaches, the monitoring of the file system only takes into account the hierarchy (granularity) of the storage partitions, i.e., the partitions are targeted to monitor which partition is corrupted. Such monitoring schemes are too extensive because there may be a real early risk and trend of problems before the partition is fully occupied or abnormal, whereas conventional schemes fail to discover such a risk and discover the tendency of damage to the partition. The following is illustrated in a few scenarios.
Scene 1: the product may have file writing or shifting operations while the system is running, both of which may cause the file to be enlarged. However, if the parameters of the file operation are inaccurate during the development stage, the writing amount is too large, and the partition of the file system may be severely reduced in space or even occupy no residual space, so that the function related to the partition is abnormal.
Scene 2: the writing times of the product are excessive when the system is running, and memory fragmentation is easy to cause.
Scene 3: the abnormal operation of the execution file causes that the execution time is too long and is not easy to find.
However, none of the three scenarios are detected in the conventional scheme, and the logs reported in the conventional scheme do not track the parameter changes caused by the above scenarios, and in fact, these parameter changes may cause damage (full or abnormal space state) to the partition.
In view of the above problems, an embodiment of the present application provides a more timely monitoring scheme for a file system, as shown in fig. 1, the monitoring is not performed with a partition as granularity, but rather, the fine monitoring is performed with emphasis on files with higher risk in the partition, and the finer monitoring scheme is implemented with the files as a hierarchy (granularity). For a partition, the file most likely to bring the risk of partition damage is dynamically and constantly found out, and parameters of the file are monitored, so that the aim of timely finding out problems can be achieved.
As shown in FIG. 1, after a product runs on a system, some operations are performed on a file system, in the file system, a monitoring module is added, after a task is issued to the file system, the operations such as writing or shifting to be performed are not directly performed, but the operations are performed through the monitoring module and then the corresponding operations are further performed, so that the monitoring module can acquire parameter changes caused by the operations performed in the file system in real time. And the monitoring module uploads the monitoring result to the cloud server through an application program (App in fig. 1), and then displays the monitoring result on a display platform. Such a monitoring system enables centralized monitoring of the file systems, i.e. multiple file systems and/or multiple partitions in a file system may be monitored simultaneously. That is, in the development stage of the product, if the operation of increasing the file such as writing (write) or offset (seek) is performed while the product is running, the monitoring of the file is performed while the file is operating, and the writing flow of the file may be ordered in a controlled manner; the data can be uploaded to the APP according to a set time period, then the APP is displayed to the cloud server, and the front-end display platform displays the monitoring result in a visual mode.
FIG. 2 is a topology diagram of three monitoring strategies in accordance with an embodiment of the present application. That is, in embodiments of the present application, monitoring of the file system may include at least one of size monitoring, number of times monitoring, and time consuming monitoring. The size monitoring refers to monitoring of the size of any file, and in the embodiment of the present application, the size of some files is monitored with a storage container in a targeted manner. The number of times monitoring is monitoring of the number of operations (which may be regarded as the operation frequency) for a certain time of an arbitrary file. Time consuming monitoring refers to monitoring the length of time that each write operation and/or offset operation is performed. The three monitoring strategies can be combined arbitrarily, and the more the combined strategies are, the better the monitoring effect is, and the more the protection of the file system is in place.
FIG. 3 is a schematic flow chart of a method of monitoring a file system according to an embodiment of the application. The steps of fig. 3 are described below.
S301, creating a storage container including file information of a plurality of files.
The plurality of files in the storage container are ordered from large to small, and the size of each file in the plurality of files in the storage container is larger than the sizes of other files in the partition where the storage container is located.
Each partition may create a storage container to fine-tune the partition to the file level, i.e., to monitor some files of each partition that require significant attention.
Although only one file may be included in the storage container, when only one file is included, it is not necessary to sort, which is equivalent to monitoring this file independently, and such monitoring, although as fine as the file level, is equivalent to monitoring only the largest file in the entire partition. Compared with the traditional scheme, the method has a certain improvement. However, the file enlargement is not abrupt, but rather is a gradual process, assuming that there is a file that is growing rapidly, but because it is smaller than the largest file, the discovery is not timely enough if there is only one largest file in the storage container. For example, assuming that the largest file in a partition is a, there is an increasing exception to file B, but the initial size of file B is only one percent of file a, then file B is not added to the storage container until it has increased to a size greater than file a, and becomes the largest file. If a plurality of files are monitored together, timeliness of finding problems can be effectively improved.
The monitoring effect can be further improved if the number of files in the storage container is set according to the actual requirement of the partition.
In one example, the number of files in the storage container is determined based on the total number of files in the partition in which the storage container is located and a preset duty cycle. For example, assuming that a partition has 100 files, the number of the plurality of files in the storage container is determined to be 10 according to a preset duty ratio of 10%. The preset duty cycle may be set as desired.
S302, acquiring the size of a first file in a file system when the first file performs writing operation or offset operation every time.
It should be appreciated that when the above operation is performed, the size of the first file changes, here, increases, so the acquired size of the first file is the increased size and may be regarded as the updated size.
It should be understood that other files herein refer to files in this partition other than files in the storage container, or files in this partition but not stored in the storage container. It should also be appreciated that file information is stored in the storage container and that rather than transferring the files to the storage container, the files are stored in the partition.
It should also be appreciated that the storage containers may be directly in the corresponding partition, which is convenient to manage. However, in actual implementation, the storage containers may be centralized and externally arranged, for example, some storage units may be divided, and these storage containers may be separately and centrally stored.
S303, updating file information stored in a storage container according to the size of the first file to obtain updated file information.
That is, it is determined whether file information of a plurality of files stored in the storage container needs to be changed according to the size of the first file.
In one implementation, updating the file information stored in the storage container according to the size of the first file may include:
when a plurality of files in the storage container comprise first files, updating the size of the first files stored in the storage container to the size of the first files acquired at the current time, and reordering the plurality of files in the storage container according to the sequence from large to small; or,
when the first file is not included in the plurality of files in the storage container, the file information stored in the storage container is updated according to a relationship between the size of the first file and the size of the smallest file in the storage container.
In this implementation, when the file information of the first file is already stored in the storage container, it is stated that the first file is one of the larger files that the partition (the partition corresponding to the storage container) is selected to monitor, at this time, only the size of the first file stored in the storage container needs to be updated to the size increased due to the writing operation or the offset operation, and the reordering can facilitate management of the files in the storage container; when there is no first file in the storage container, it is indicated that the first file is not a larger file in this partition, and at this time, it is necessary to further check whether this first file can be added to the rank of the storage container. According to the implementation mode, dynamic updating of the storage container can be achieved, any file which is abnormally increased can be added into the storage container due to the step, and therefore the file is displayed on a server side, and workers can find the file timely.
In one implementation, when the first file is not included in the plurality of files in the storage container, updating the file information stored in the storage container according to a relationship between a size of the first file and a size of a smallest file in the storage container may include:
When the size of the first file is larger than that of the minimum file, deleting the minimum file in the storage container, adding the first file into a plurality of files in the storage container, and reordering all files in the storage container according to the sequence from large to small; or,
when the size of the first file is smaller than or equal to the size of the minimum file, file information in the storage container is not changed.
In this implementation, dynamic updating of files in the storage container is mainly implemented, and any file is added to the storage container when it is increased to be larger than the smallest file in the storage container. It will be appreciated that a file larger than the smallest file does not account for the smallest file that would be present after the file was added, so that reordering enables the order of the sizes of the files in all storage containers after the first file was added to be updated synchronously.
S304, uploading the updated file information to a server so that the server displays the updated file information.
The centralized display of file information for a storage container by a server can support simultaneous monitoring of multiple partitions and/or multiple file systems.
The uploading can be carried out by uploading to the app and then further uploading to the server through the app.
The method shown in fig. 3 realizes a more refined monitoring scheme by creating a storage container for each partition to pertinently manage the largest several files, and can dynamically discover and monitor the abnormally-increased files, thereby discovering the files with the abnormality in the partition as early as possible. In the scheme of the embodiment of the application, as long as any one file (namely the first file) in the partition is continuously increased due to writing operation and/or offset operation, the size of the file is necessarily increased, and the file is necessarily added into the updated file information of the storage container, so that the function of dynamic monitoring is realized. In addition, the scheme of the embodiment of the application not only monitors the capacity of the whole partition, but also thins to monitor a plurality of files in the storage container, namely, the files which are most likely to cause the partition to be full are monitored in a focus way, compared with the traditional scheme that whether the partition is full or not is damaged only by macroscopic monitoring, the method can monitor the abnormally-increased files more accurately and timely, and lock the abnormally-increased files before the partition is full or damaged, thereby preventing the abnormally-increased files from being damaged.
In one implementation, the method further includes:
acquiring the accumulated operation times of a second file in a file system, wherein the accumulated operation times are the times of writing operation and/or offset operation on the second file in a preset statistical period;
uploading the accumulated operation times of the second file to the server so that the server displays the accumulated operation times of the second file.
This implementation is an example of a number of times monitoring policy. In such implementations, files that are frequently being subjected to write operations and/or offset operations are discovered primarily through monitoring of the number of operations. This implementation can be considered to be an overlay scheme based on the monitoring of file size of the present application, adding to another monitoring strategy for finding abnormal files, the files frequently being written and/or shifted tend to be increasing with these operations, with a higher likelihood of anomalies and a greater impact on the partition. It should be appreciated that the second file is any file in the file system, which partition need not be locked, nor need it be restricted to be in a storage container, so the second file may or may not be the same file as the first file. This implementation is also a fine-to-file granularity monitoring scheme, finer, and more in place.
In one example, in obtaining the accumulated number of operations for the second file in the file system may include:
creating a counter of the second file, wherein the initial value of the counter is zero;
in a preset statistical period, adding one to the value of the counter every time a write operation or an offset operation to the second file is detected;
after the preset counting period is finished, the numerical value of the counter is determined to be the accumulated operation times of the second file, and the numerical value of the counter is cleared.
In this implementation, the total number of times a file is subjected to a write operation and an offset operation in each preset counting period is counted by setting a counter for each file, and displayed, if a certain file is frequently subjected to a write operation and/or an offset operation, it is monitored.
The accumulated operation times need to be uploaded once in each preset statistical period of each file, but in fact, many files are not abnormal, so that uploading of a large amount of monitoring data can bring about data transmission burden, and the method is not beneficial to workers to find the files with the abnormalities in time. Therefore, by setting the number threshold, only the data of the file whose cumulative number of operations is greater than or equal to the number threshold can be uploaded. Therefore, the number of data transmission times can be reduced, and workers can find (screen out) abnormal files more quickly.
In another example, when uploading the accumulated operation number of the second file to the server so that the server displays the accumulated operation number of the second file, it may include:
comparing the relation between the accumulated operation times of the second file and a preset time threshold, wherein the preset time threshold is a time threshold corresponding to a preset statistical period;
and uploading the accumulated operation times of the second file to the server when the accumulated operation times of the second file are greater than or equal to a preset time threshold.
In the embodiment of the application, the number of times is monitored for each file, but the amount of the uploaded data and how to upload the data affect the workload of the staff for analyzing and processing the monitoring result. Besides the implementation mode that only the times risk is screened out by setting the preset times threshold, that is, the files with the abnormality exist, the files with the largest times can be uploaded by taking the files for the whole file system or each partition.
In one implementation, the method further includes:
acquiring the accumulated operation times of each file in a file system, wherein the accumulated operation times are the times of writing operation and/or offset operation on each file in a preset statistical period;
Uploading the accumulated operation times of M files with the accumulated operation times of M being the first in a preset statistical period in the file system to a server, so that the server displays the accumulated operation times of the M files with the accumulated operation times of M being an integer greater than 1 in the file system.
In this implementation manner, only M files with the largest accumulated operation times are uploaded for the whole file system to display the accumulated operation times, and the data transmission amount is small. The M files are the files with the largest cumulative operation times in the file system, that is, the cumulative operation times of any one of the M files is greater than or equal to the cumulative operation times of other files except the M files. In this implementation, the first M files are displayed, but there is no requirement that these M must exceed the count threshold, so it will be understood that these M may already have one or more exception files, but there may be no exception files. This implementation more reasonably reveals the "health" of the file system than screening only files that are abnormal in nature as a whole. For example, when none of the M files has an abnormal file (i.e., no file having a cumulative number of operations greater than or equal to a preset number of times threshold), it is indicated that the file system is normal as a whole; when the M files have a small number of abnormal files, the problem that the file system has some hidden dangers but the problem is not serious is shown; when all the M files are abnormal files, the problem that the file system has potential abnormality is seriously solved.
In one example, in obtaining the cumulative number of operations for each file in the file system, it may include:
creating a counter for each file in the file system, and setting the initial value of the counter to be zero;
for each file, in a preset statistical period, adding one to the value of the counter every time a write operation or an offset operation to the file is detected;
after the preset counting period is finished, the numerical value of the counter of each file is determined to be the accumulated operation times of the file, and the numerical value of the counter is cleared.
That is, the method of acquiring the cumulative number of operations by the counter is not limited to any number of monitoring strategies, as long as the number of times of monitoring the file can be used.
In one implementation, the method further includes:
acquiring the accumulated operation times of each file of a first partition in a file system, wherein the accumulated operation times are the times of writing operation and/or offset operation on each file in a preset statistical period; the first partition is any partition in the file system;
uploading the accumulated operation times of the files with the accumulated operation times of P in the first partition within a preset statistical period to a server, so that the server displays the accumulated operation times of the P in the first partition, wherein P is an integer larger than 1.
In this implementation, only P files with the largest accumulated operation times are uploaded for each partition to display the accumulated operation times, and the data transmission amount is small. The P files are the files with the largest accumulated operation times in the first partition, that is, the accumulated operation times of any one file in the P files are larger than or equal to the accumulated operation times of other files in the first partition except the P files. In this implementation, the first P files are displayed, but the P must exceed the threshold number of times is not required, so it is understood that the P may already have one or more exception files, but may not have any exception files. This implementation more reasonably reveals the "health" of each partition in the file system than screening only the files that are in exception as a whole. For example, when none of the P files has an abnormal file (i.e., no file having a cumulative number of operations greater than or equal to a preset number of times threshold), it is indicated that the first partition is normal as a whole; when the P files have a small number of abnormal files, the first partition has some hidden dangers but the problem is not serious; when the P files are all abnormal files, it is indicated that there is an abnormal hidden danger in the first partition, and the problem is serious.
It should also be appreciated that this implementation more reasonably reflects the file system situation than the previous M files screened for the entire file system. For example, assuming that M files reported in the above solution of the entire file system are all of a certain partition, only the partition problem is serious, but the hidden situation of other partitions is not opportunistically revealed, and there are other partitions that are possibly problematic only if the problem is not serious, but because the monitoring solution of the entire file system is submerged. So taking the first P displays per partition is finer and more reasonable than taking the first M displays for the entire file system.
It should be further noted that, in the frequency monitoring strategy, since the frequency operation does not have a steady gradual trend, that is, does not steadily increase or decrease, the ranking of each cumulative count period does not depend too much on the value of the previous cumulative count period, so that it is not necessary to set a storage container to maintain the ranking as in the size monitoring strategy. That is, the change of the file with the largest number of operations per time has no gradual trend, the sequence of the file per time is greatly changed, and if the storage container is set, the information in the storage container needs to be updated very frequently, which is too complicated.
In one example, in obtaining the cumulative number of operations for each file of the first partition of the file system, it may include:
creating a counter for each file in the first partition, and setting the initial value of the counter to be zero;
for each file in the first partition, in a preset statistical period, adding one to the value of the counter every time a write operation or an offset operation to the file is detected;
after the preset statistical period is finished, the numerical value of the counter of each file in the first partition is determined as the accumulated operation times of the file, and the numerical value of the counter is cleared.
That is, the method of acquiring the cumulative number of operations by the counter is not limited to any number of monitoring strategies, as long as the number of times of monitoring the file can be used.
In one implementation, the method further includes:
acquiring the N-time operation duration of a third file in the file system, wherein the N-time operation duration is used for indicating the time-consuming duration for executing the N-time writing operation or the offset operation, and N is a positive integer;
and uploading the operation duration of the nth time of the third file to the server after the operation duration of the nth time of the third file is sequentially numbered by 'N', so that the server displays that the operation duration of the nth time of the third file is the sequence number.
This implementation is an example of a time consuming monitoring strategy. In this implementation, the file with the abnormal operation duration is mainly discovered through monitoring the operation duration. It can be considered that this implementation is an overlay scheme based on the monitoring of the file size of the present application, and adds another monitoring policy for finding abnormal files, where files with excessively long execution time of one execution of a write operation or an offset operation tend to be abnormal, and the influence on the partition is greater. It should be appreciated that the third file is any file in the file system, which partition need not be locked, nor need it be restricted to be in a storage container, so the third file and the first file may be the same file or not the same file; the third file and the second file may or may not be the same file. This implementation is also a fine-to-file granularity monitoring scheme, finer, and more in place.
It should also be appreciated that the present application provides three monitoring strategies, size monitoring, frequency monitoring and time consuming monitoring, respectively. The size monitoring refers to monitoring of the size of any file, and in the embodiment of the present application, the size of some files is monitored with a storage container in a targeted manner. The number of times monitoring is monitoring of the number of operations (which may be regarded as the operation frequency) for a certain time of an arbitrary file. Time consuming monitoring refers to monitoring the length of time that each write operation and/or offset operation is performed. The three monitoring strategies can be combined arbitrarily, and the more the combined strategies are, the better the monitoring effect is, and the more the protection of the file system is in place.
In one example, when acquiring the nth time duration of the operation on the third file in the file system, it may include:
recording a system time when execution of an nth write operation or an offset operation on the third file starts and a system time when execution is completed;
the difference between the system time when the execution is completed and the system time when the execution is started is determined as the nth operation duration of the third file.
In this example, the operation duration is calculated by using the difference of the system time, and the calculation is simple and accurate, and is more accurate and simple than calculation by using other modes such as natural time. Because the clock adopted by the system in execution is fixed, when the system time is used for calculation, the time length can be accurately calculated by calculating the number of clocks.
The time length of uploading operation is needed when each file is subjected to writing operation or offset operation, but in fact, many files are not time-consuming and abnormal, so that uploading of a large amount of monitoring data can bring about data transmission burden, and the file with abnormal condition is not easy to find by staff in time. Therefore, by setting the duration threshold, only the data of the file with the operation duration greater than or equal to the duration threshold can be uploaded. Therefore, the number of data transmission times can be reduced, and workers can find (screen out) abnormal files more quickly.
In another example, when the nth time period of the third file is sequentially numbered with "N" and then uploaded to the server so that the server displays that the nth time period of the third file is the sequential number, the method may include:
comparing the relation between the N-th operation time length of the third file and a preset time length threshold;
when the N-th operation time length of the third file is greater than or equal to a preset time length threshold, the N-th operation time length of the third file is sequentially numbered by 'N', and then the operation time length is uploaded to a server.
In the embodiment of the application, time-consuming monitoring is performed on each file, but the amount of data uploaded and how to upload the data can influence the workload of staff on analysis processing of monitoring results. Besides the implementation mode that only the files with time consumption risks, namely the files with anomalies, are screened out by setting the preset time length threshold, only the files with the longest time consumption can be taken for the whole file system or each partition to upload.
In one implementation, the method further includes:
acquiring an nth time operation duration of each file in a file system, wherein the nth time operation duration is used for indicating a time-consuming duration for executing an nth writing operation or an offset operation on each file, and N is a positive integer;
When each uploading period is finished, the N-th operation time length of the K files with the operation time length of the previous K in the file system is sequentially numbered by N and then uploaded to the server, so that the server displays the N-th operation time length of the previous K files in the file system according to the sequential numbering; k is an integer greater than 1.
In this implementation manner, for the whole file system, only K files with the longest time duration are taken for each uploading period to upload the operation duration of the nth operation of the K files for display, and the data transmission amount is small. The K files are the files with the longest time duration of the Nth operation in the file system. In this implementation, the first K files are displayed, but there is no requirement that all of these K files must be long enough, so it will be understood that these K files may already have one or more exception files, but may not have any exception files. This implementation more reasonably reveals the "health" of the file system than screening only files that are abnormal in nature as a whole. For example, when none of the K files has an abnormal file (i.e., no file with an operational time period greater than or equal to a preset time period threshold), it is indicated that the file system as a whole is normal; when the K files have a small number of abnormal files, the problem that the file system has some hidden dangers but the problem is not serious is shown; when all the K files are abnormal files, the problem that the file system has potential abnormality is seriously solved.
In one example, when acquiring the nth time duration of the operation for each file in the file system, it may include:
for each file in the file system, the recorded system time at the start of execution of the nth write operation or offset operation and the system time at the completion of execution; and determining a difference between the system time when the execution is completed and the system time when the execution is started as an nth operation duration of the file.
That is, the scheme of calculating the operation time period by using the system time is not limited to any time-consuming monitoring strategy as long as the time-consuming monitoring of the file is possible.
In one implementation, the method further includes:
acquiring the N-time operation duration of each file in a second partition in the file system, wherein the N-time operation duration is used for indicating the time-consuming duration of executing the N-time writing operation or the offset operation on each file, and N is a positive integer; the second partition is any partition in the file system;
when each preset uploading period is finished, the N-th operation time length of the L files with the N-th operation time length of the previous L in the second partition is sequentially numbered by N and then uploaded to the server, so that the server displays the N-th operation time length of the previous L files in the second partition according to the sequential numbering; l is an integer greater than 1.
In this implementation manner, for each partition, each uploading period only takes L files with the longest time duration to upload the operation duration of the nth operation for display, and the data transmission amount is small. The L files are the files with the longest time duration of the Nth operation in the second partition. In this implementation, the first L files are displayed, but there is no requirement that all of these L files must be long enough, so it will be understood that these L files may already have one or more exception files, but may not have any exception files. This implementation more reasonably reveals the "health" of the second partition than simply screening files for anomalies as a whole. For example, when none of the L files has an abnormal file (i.e., no file having an operational time period greater than or equal to a preset time period threshold), it is indicated that the second partition is normal as a whole; when the L files have a small number of abnormal files, the second partition has some hidden dangers but the problem is not serious; when all the L files are abnormal files, the second partition has abnormal hidden danger, and the problem is serious.
It should also be appreciated that this implementation more reasonably reflects the file system situation than the previous K files screened for the entire file system. For example, assuming that K files reported in the above solution of the entire file system are all partitioned, only the partition problem is serious, but the hiding situation of other partitions is not opportunistically revealed, and there are other partitions that are possibly problematic only if the partition is not serious, but because the monitoring solution of the entire file system is submerged. So taking the first L displays by partition is finer and more reasonable than taking the first K displays by the entire file system.
It should be further noted that, in the time-consuming monitoring strategy, since the operation duration of each time does not have a steady gradual trend, that is, does not steadily increase or decrease, there is no interdependence between the operation durations of each time, so that it is not necessary to set a storage container for maintenance as in the size monitoring strategy. That is, the change of the file with the longest operation duration of each time has no gradual trend, the sequence of the file of each time can change greatly, and if the storage container is set, the information in the storage container needs to be updated very frequently, which is too cumbersome.
In one example, when acquiring the nth time duration of operation of each file in the second partition in the file system, it may include:
for each file in the second partition, the recorded system time at the start of execution of the nth write operation or offset operation and the system time at the completion of execution; and determining a difference between the system time when the execution is completed and the system time when the execution is started as an nth operation duration of the file.
That is, the scheme of calculating the operation time period by using the system time is not limited to any time-consuming monitoring strategy as long as the time-consuming monitoring of the file is possible. FIG. 4 is a schematic diagram of a size monitoring strategy according to an embodiment of the present application. Fig. 4 can be seen as an example of the method shown in fig. 3.
First, a storage container is created to store the file information of N before the writing flow (size), where N is a positive integer, for example, may be 10. After each file has the file augmentation operation performed, the corresponding file (the file on which the operation was performed) participates in the ordering of the files in the storage container.
S401, the size of the target file after the write operation/offset operation is acquired.
The target file here may be regarded as an example of the first file described above, and step S401 may be regarded as an example of S302.
S402, when the target file exists in the storage container, replacing the size of the target file in the storage container with the increased size of the target file after the writing operation/offset operation in the step S401 is performed.
That is, it is determined whether this target file is one of the files N before the write flow in the storage container, and if so, since the operation of enlarging the file has been performed once, the size corresponding to this file in the storage container is updated to the enlarged size.
S403, when the target file is not in the storage container and the size of the target file after the target file is increased is larger than the size of the smallest file in the storage container, replacing the smallest file in the storage container with the target file.
That is, if the target file is not the N-before-write-flow file, the target file is compared with the N-th largest file (the smallest file in the storage container), and if the target file is larger, the smallest file is replaced, otherwise, not replaced.
S404, reordering files in the storage container according to the size of the increased target file.
Whether step S403 or step S402 is performed, this results in a change in the parameters of the size of one file in the storage container, so that the original ordering may no longer be appropriate, and therefore a reorder from big to small is required.
Steps S402-S404 can be seen as an example of step S303.
S405, uploading the reordered container information to a server.
The container information is file information of a plurality of files stored in the storage container.
The time period for uploading the data can be set, and the file information is uploaded according to the uploading period. The uploaded file information can be displayed to a display platform at the front end after being processed by the server, so that a worker can monitor and analyze the flow according to the file information. In order to make the data easy to analyze accurately, a clearing period can be set, and the information in the storage container can be cleared periodically, so that the storage container can have better real-time performance, namely, the files added into the container have more real-time performance.
Step S405 can be regarded as an example of step S304.
FIG. 5 is a schematic diagram of a time consuming monitoring strategy according to an embodiment of the present application. Fig. 5 illustrates the nth write operation, but it should be understood that the nth offset operation may be illustrated, and the write operation in fig. 5 need only be replaced by the offset operation. N is a positive integer, used to indicate the execution order. FIG. 5 may be the nth write operation to any of the files, such as the third file above.
S501, entering a write function of the Nth write operation.
S502, acquiring the system time when the Nth writing operation starts.
S503, executing the Nth write operation.
S504, after the execution of the Nth write operation is completed, calculating the time consumption of the Nth write operation.
The difference of the system time at the end of the nth write operation minus the system time at the beginning is extremely time consuming for the nth write operation.
S505, uploading the time consumption and the sequence number of the Nth writing operation to a server.
The sequence number is the nth time, so that at the server side, the execution duration of each writing operation can be saved and displayed in an organized manner according to the execution sequence.
The method of the embodiment of the present application is mainly described above with reference to the drawings. It should be understood that, although the steps in the flowcharts related to the embodiments described above are shown in order, these steps are not necessarily performed in the order shown in the figures. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages. The following describes an apparatus according to an embodiment of the present application with reference to the accompanying drawings.
Fig. 6 is a schematic diagram of a monitoring device of a file system according to an embodiment of the present application. As shown in fig. 6, the apparatus 2000 includes a processing unit 2001, an acquisition unit 2002, and a transmission unit 2003. The device 2000 may be integrated in an electronic device such as a mobile phone, a tablet computer, a touch screen notebook computer, a server, etc.
The apparatus 2000 can be used to perform the steps of any of the file system monitoring methods above. For example, the processing unit 2001 may be used to perform steps S301 and S303, the acquisition unit 2002 may be used to perform step S302, and the transmission unit 2003 may be used to perform step S304. For another example, the processing unit 2001 may be used to perform steps S402 to S404, the acquisition unit 2002 may be used to perform step S401, and the transmission unit 2003 may be used to perform step S405. For another example, the processing unit 2001 may be used to perform steps S501, S503, and S504, the acquisition unit 2002 may be used to perform step S502, and the transmission unit 2003 may be used to perform step S505.
In one implementation, the apparatus 2000 may further include a storage unit to store related data. The memory unit may be integrated in any one of the above units, or may be a unit independent of all the above units.
Fig. 7 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present application. As shown in fig. 7, the electronic apparatus 3000 includes: at least one processor 3001 (only one shown in fig. 7), a memory 3002, and a computer program 3003 stored in the memory 3002 and executable on the at least one processor 3001, the processor 3001 implementing steps in any one of the methods described above when executing the computer program 3003.
It will be appreciated by those skilled in the art that fig. 7 is merely an example of an electronic device and is not meant to be limiting, and that in practice an electronic device may include more or fewer components than shown, or may combine certain components, or different components, such as may also include input-output devices, network access devices, etc.
The processor 3001 may be a central processing unit (central processing unit, CPU), other general purpose processor, digital signal processor (digital signal processor, DSP), application specific integrated circuit (application specific integrated circuit, ASIC), off-the-shelf programmable gate array (field-programmable gate array, FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
Memory 3002 may be an internal storage unit of electronic device 3000 in some embodiments, such as a hard disk or memory of electronic device 3000. The memory 3002 may also be an external storage device of the electronic device 3000 in other embodiments, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a flash card (flash card) or the like, which are provided on the electronic device 3000. Optionally, the memory 3002 may also include both internal storage units and external storage devices of the electronic device 3000. The memory 3002 is used for storing an operating system, application programs, boot loader programs, data, and other programs, etc., such as program codes of the computer programs. The memory 3002 may also be used to temporarily store data that has been output or is to be output.
Fig. 8 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present application. As shown in fig. 8, the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (universal serial bus, USB) interface 130, a charge management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, keys 190, a motor 191, an indicator 192, a camera 193, a display 194, a user identification module (subscriber identification module, SIM) card interface 195, and the like. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, and the like.
It should be understood that the illustrated structure of the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the application, electronic device 100 may include more or fewer components than shown, or certain components may be combined, or certain components may be split, or different arrangements of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
Illustratively, the processor 110 shown in FIG. 8 may include one or more processing units, such as: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a memory, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and/or a neural network processor (neural-network processing unit, NPU), etc. Wherein the different processing units may be separate devices or may be integrated in one or more processors.
The controller may be a neural hub and a command center of the electronic device 100, among others. The controller can generate operation control signals according to the instruction operation codes and the time sequence signals to finish the control of instruction fetching and instruction execution.
A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may hold instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to reuse the instruction or data, it can be called directly from the memory. Repeated accesses are avoided and the latency of the processor 110 is reduced, thereby improving the efficiency of the system.
In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous receiver transmitter (universal asynchronous receiver/transmitter, UART) interface, a mobile industry processor interface (mobile industry processor interface, MIPI), a general-purpose input/output (GPIO) interface, a subscriber identity module (subscriber identity module, SIM) interface, and/or a universal serial bus (universal serial bus, USB) interface, among others.
In some embodiments, the I2C interface is a bi-directional synchronous serial bus including a serial data line (SDA) and a serial clock line (derail clock line, SCL). The processor 110 may contain multiple sets of I2C buses. The processor 110 may be coupled to the touch sensor 180K, charger, flash, camera 193, etc., respectively, through different I2C bus interfaces. For example, the processor 110 may couple the touch sensor 180K through an I2C interface, causing the processor 110 to communicate with the touch sensor 180K through an I2C bus interface, implementing the touch function of the electronic device 100.
In some embodiments, the I2S interface may be used for audio communication. The processor 110 may contain multiple sets of I2S buses. The processor 110 may be coupled to the audio module 170 via an I2S bus to enable communication between the processor 110 and the audio module 170.
In some embodiments, the audio module 170 may transmit an audio signal to the wireless communication module 160 through the I2S interface, to implement a function of answering a call through the bluetooth headset.
In some embodiments, the PCM interface may also be used for audio communication, sampling, quantizing and encoding analog signals. The audio module 170 and the wireless communication module 160 may be coupled through a PCM bus interface.
In some embodiments, the audio module 170 may also transmit audio signals to the wireless communication module 160 through the PCM interface to implement a function of answering a call through the bluetooth headset. It should be appreciated that both the I2S interface and the PCM interface may be used for audio communication.
In some embodiments, the UART interface is a universal serial data bus for asynchronous communications. The bus may be a bi-directional communication bus. It converts the data to be transmitted between serial communication and parallel communication. UART interfaces are typically used to connect the processor 110 with the wireless communication module 160. For example, the processor 110 communicates with a bluetooth module in the wireless communication module 160 through a UART interface to implement a bluetooth function. In some embodiments, the audio module 170 may transmit an audio signal to the wireless communication module 160 through a UART interface, to implement a function of playing music through a bluetooth headset.
In some embodiments, a MIPI interface may be used to connect the processor 110 with peripheral devices such as a display 194, a camera 193, and the like. The MIPI interfaces include camera serial interfaces (camera serial interface, CSI), display serial interfaces (display serial interface, DSI), and the like. Processor 110 and camera 193 communicate through a CSI interface to implement the photographing function of electronic device 100. The processor 110 and the display 194 communicate via a DSI interface to implement the display functionality of the electronic device 100.
In some embodiments, the GPIO interface may be configured by software. The GPIO interface may be configured as a control signal or as a data signal. GPIO interfaces may be used to connect processor 110 with camera 193, display 194, wireless communication module 160, audio module 170, sensor module 180, and the like. The GPIO interface may also be configured as an I2C interface, an I2S interface, a UART interface, an MIPI interface, etc.
Illustratively, the USB interface 130 is an interface conforming to the USB standard specification, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, or the like. The USB interface 130 may be used to connect a charger to charge the electronic device 100, and may also be used to transfer data between the electronic device 100 and a peripheral device. And can also be used for connecting with a headset, and playing audio through the headset. The interface may also be used to connect other electronic devices, such as AR devices, etc.
It should be understood that the interfacing relationship between the modules illustrated in the embodiments of the present application is only illustrative, and is not meant to limit the structure of the electronic device 100. In other embodiments of the present application, the electronic device 100 may also employ different interfacing manners in the above embodiments, or a combination of multiple interfacing manners.
The charge management module 140 is configured to receive a charge input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charge management module 140 may receive a charging input of a wired charger through the USB interface 130. In some wireless charging embodiments, the charge management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. The charging management module 140 may also supply power to the electronic device through the power management module 141 while charging the battery 142.
The power management module 141 is used for connecting the battery 142, and the charge management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and/or the charge management module 140 and provides power to the processor 110, the internal memory 121, the external memory, the display 194, the camera 193, the wireless communication module 160, and the like. The power management module 141 may also be configured to monitor battery capacity, battery cycle number, battery health (leakage, impedance) and other parameters. In other embodiments, the power management module 141 may also be provided in the processor 110. In other embodiments, the power management module 141 and the charge management module 140 may be disposed in the same device.
The wireless communication function of the electronic device 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, a modem processor, a baseband processor, and the like.
The antennas 1 and 2 are used for transmitting and receiving electromagnetic wave signals. Each antenna in the electronic device 100 may be used to cover a single or multiple communication bands. Different antennas may also be multiplexed to improve the utilization of the antennas. For example, the antenna 1 may be multiplexed into a diversity antenna of a wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
The mobile communication module 150 may provide a solution for wireless communication applied on the electronic device 100, such as at least one of the following: second generation (2th generation,2G) mobile communications solutions, third generation (3 g) mobile communications solutions, fourth generation (4th generation,5G) mobile communications solutions, fifth generation (5th generation,5G) mobile communications solutions. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (low noise amplifier, LNA), etc. The mobile communication module 150 may receive electromagnetic waves from the antenna 1, perform processes such as filtering and amplifying the received electromagnetic waves, and then transmit the electromagnetic waves to a modem processor for demodulation. The mobile communication module 150 may further amplify the signal modulated by the modem processor, and the amplified signal is converted into electromagnetic waves by the antenna 1 and radiated. In some embodiments, at least some of the functional modules of the mobile communication module 150 may be disposed in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 may be provided in the same device as at least some of the modules of the processor 110.
The modem processor may include a modulator and a demodulator. The modulator is used for modulating the low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used for demodulating the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low frequency baseband signal to the baseband processor for processing. The low frequency baseband signal is processed by the baseband processor and then transferred to the application processor. The application processor outputs sound signals through an audio device (not limited to the speaker 170A, the receiver 170B, etc.), or displays images or video through the display screen 194. In some embodiments, the modem processor may be a stand-alone device. In other embodiments, the modem processor may be provided in the same device as the mobile communication module 150 or other functional module, independent of the processor 110.
The wireless communication module 160 may provide solutions for wireless communication including wireless local area network (wireless local area networks, WLAN) (e.g., wireless fidelity (wireless fidelity, wi-Fi) network), bluetooth (BT), global navigation satellite system (global navigation satellite system, GNSS), frequency modulation (frequency modulation, FM), near field wireless communication technology (near field communication, NFC), infrared technology (IR), etc., applied to the electronic device 100. The wireless communication module 160 may be one or more devices that integrate at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the electromagnetic wave signals, filters the electromagnetic wave signals, and transmits the processed signals to the processor 110. The wireless communication module 160 may also receive a signal to be transmitted from the processor 110, frequency modulate it, amplify it, and convert it to electromagnetic waves for radiation via the antenna 2.
In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150 and antenna 2 of electronic device 100 is coupled to wireless communication module 160 such that electronic device 100 may communicate with networks and other electronic devices via wireless communication techniques. The wireless communication technology may include at least one of the following communication technologies: global system for mobile communications (global system for mobile communications, GSM), general packet radio service (general packet radio service, GPRS), code division multiple access (code division multiple access, CDMA), wideband code division multiple access (wideband code division multiple access, WCDMA), time division code division multiple access (time-division code division multiple access, TD-SCDMA), long term evolution (long term evolution, LTE), BT, GNSS, WLAN, NFC, FM, IR technologies. The GNSS may include at least one of the following positioning techniques: global satellite positioning system (global positioning system, GPS), global navigation satellite system (global navigation satellite system, GLONASS), beidou satellite navigation system (beidou navigation satellite system, BDS), quasi zenith satellite system (quasi-zenith satellite system, QZSS), satellite based augmentation system (satellite based augmentation systems, SBAS).
The electronic device 100 implements display functions through a GPU, a display screen 194, an application processor, and the like. The GPU is a microprocessor for image processing, and is connected to the display 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
The display screen 194 is used to display images, videos, and the like. The display 194 includes a display panel. The display panel may employ a liquid crystal display (liquid crystal display, LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (flex-emitting diode), mini-Led, micro-OLED, a quantum dot light-emitting diode (QLED), or the like. In some embodiments, the electronic device 100 may include 1 or N display screens 194, N being a positive integer greater than 1.
The electronic device 100 may implement photographing functions through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, and the like.
The ISP is used to process data fed back by the camera 193. For example, when photographing, the shutter is opened, light is transmitted to the camera photosensitive element through the lens, the optical signal is converted into an electric signal, and the camera photosensitive element transmits the electric signal to the ISP for processing and is converted into an image visible to naked eyes. ISP can also optimize the noise, brightness and skin color of the image. The ISP can also optimize parameters such as exposure, color temperature and the like of a shooting scene. In some embodiments, the ISP may be provided in the camera 193.
The camera 193 is used to capture still images or video. The object generates an optical image through the lens and projects the optical image onto the photosensitive element. The photosensitive element may be a charge coupled device (charge coupled device, CCD) or a Complementary Metal Oxide Semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, which is then transferred to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV, or the like format. In some embodiments, electronic device 100 may include 1 or N cameras 193, N being a positive integer greater than 1.
The digital signal processor is used for processing digital signals, and can process other digital signals besides digital image signals. For example, when the electronic device 100 selects a frequency bin, the digital signal processor is used to fourier transform the frequency bin energy, or the like.
Video codecs are used to compress or decompress digital video. The electronic device 100 may support one or more video codecs. In this way, the electronic device 100 may play or record video in a variety of encoding formats, such as: dynamic picture experts group (moving picture experts group, MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
The NPU is a neural-network (NN) computing processor, and can rapidly process input information by referencing a biological neural network structure, for example, referencing a transmission mode between human brain neurons, and can also continuously perform self-learning. Applications such as intelligent awareness of the electronic device 100 may be implemented through the NPU, for example: image recognition, face recognition, speech recognition, text understanding, etc.
The external memory interface 120 may be used to connect an external memory card, such as a Secure Digital (SD) card, to enable expanding the memory capabilities of the electronic device 100. The external memory card communicates with the processor 110 through an external memory interface 120 to implement data storage functions. For example, files such as music, video, etc. are stored in an external memory card.
The internal memory 121 may be used to store computer executable program code including instructions. The processor 110 executes various functional applications of the electronic device 100 and data processing by executing instructions stored in the internal memory 121. The internal memory 121 may include a storage program area and a storage data area. The storage program area may store an application program (such as a sound playing function, an image playing function, etc.) required for at least one function of the operating system, etc. The storage data area may store data created during use of the electronic device 100 (e.g., audio data, phonebook, etc.), and so on. In addition, the internal memory 121 may include a high-speed random access memory, and may further include a nonvolatile memory such as at least one magnetic disk storage device, a flash memory device, a universal flash memory (universal flash storage, UFS), and the like.
The electronic device 100 may implement audio functions through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, an application processor, and the like. Such as music playing, recording, etc.
The audio module 170 is used to convert digital audio information into an analog audio signal output and also to convert an analog audio input into a digital audio signal. The audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be disposed in the processor 110, or a portion of the functional modules of the audio module 170 may be disposed in the processor 110.
The speaker 170A, also referred to as a "horn," is used to convert audio electrical signals into sound signals. The electronic device 100 may listen to music, or to hands-free conversations, through the speaker 170A.
A receiver 170B, also referred to as a "earpiece", is used to convert the audio electrical signal into a sound signal. When electronic device 100 is answering a telephone call or voice message, voice may be received by placing receiver 170B in close proximity to the human ear.
Microphone 170C, also referred to as a "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or transmitting voice information, the user can sound near the microphone 170C through the mouth, inputting a sound signal to the microphone 170C. The electronic device 100 may be provided with at least one microphone 170C. In other embodiments, the electronic device 100 may be provided with two microphones 170C, and may implement a noise reduction function in addition to collecting sound signals. In other embodiments, the electronic device 100 may also be provided with three, four, or more microphones 170C to enable collection of sound signals, noise reduction, identification of sound sources, directional recording functions, etc.
The earphone interface 170D is used to connect a wired earphone. The headset interface 170D may be a USB interface 130 or a 3.5mm open mobile electronic device platform (open mobile terminal platform, OMTP) standard interface, a american cellular telecommunications industry association (cellular telecommunications industry association of the USA, CTIA) standard interface.
The pressure sensor 180A is used to sense a pressure signal, and may convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A may be disposed on the display screen 194. The pressure sensor 180A is of various types, such as a resistive pressure sensor, an inductive pressure sensor, a capacitive pressure sensor, and the like. The capacitive pressure sensor may be a capacitive pressure sensor comprising at least two parallel plates with conductive material. The capacitance between the electrodes changes when a force is applied to the pressure sensor 180A. The electronic device 100 determines the strength of the pressure from the change in capacitance. When a touch operation is applied to the display screen 194, the electronic apparatus 100 detects the touch operation intensity according to the pressure sensor 180A. The electronic device 100 may also calculate the location of the touch based on the detection signal of the pressure sensor 180A. In some embodiments, touch operations that act on the same touch location, but at different touch operation strengths, may correspond to different operation instructions. For example, when a touch operation with a touch operation intensity smaller than a first pressure threshold acts on the short message application icon, an instruction to view the short message is executed. And executing an instruction for newly creating the short message when the touch operation with the touch operation intensity being greater than or equal to the first pressure threshold acts on the short message application icon.
The gyro sensor 180B may be used to determine a motion gesture of the electronic device 100. In some embodiments, the angular velocity of electronic device 100 about three axes (i.e., x, y, and z axes) may be determined by gyro sensor 180B. The gyro sensor 180B may be used for photographing anti-shake. Illustratively, when the shutter is pressed, the gyro sensor 180B detects the shake angle of the electronic device 100, calculates the distance to be compensated by the lens module according to the angle, and makes the lens counteract the shake of the electronic device 100 through the reverse motion, thereby realizing anti-shake. The gyro sensor 180B may also be used for navigating, somatosensory game scenes.
The air pressure sensor 180C is used to measure air pressure. In some embodiments, electronic device 100 calculates altitude from barometric pressure values measured by barometric pressure sensor 180C, aiding in positioning and navigation.
The magnetic sensor 180D includes a hall sensor. The electronic device 100 may detect the opening and closing of the flip cover using the magnetic sensor 180D. In some embodiments, when the electronic device 100 is a flip machine, the electronic device 100 may detect the opening and closing of the flip according to the magnetic sensor 180D; and setting the characteristics of automatic unlocking of the flip cover and the like according to the detected opening and closing state of the leather sheath or the detected opening and closing state of the flip cover.
The acceleration sensor 180E may detect the magnitude of acceleration of the electronic device 100 in various directions (typically three axes). The magnitude and direction of gravity may be detected when the electronic device 100 is stationary. The electronic equipment gesture recognition method can also be used for recognizing the gesture of the electronic equipment, and is applied to horizontal and vertical screen switching, pedometers and other applications.
The distance sensor 180F is used to measure a distance. The electronic device 100 may measure the distance by infrared or laser. In some embodiments, the electronic device 100 may range using the distance sensor 180F to achieve quick focus.
The proximity light sensor 180G may include, for example, a light-emitting diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device 100 emits infrared light outward through the light emitting diode. The electronic device 100 detects infrared reflected light from nearby objects using a photodiode. When sufficient reflected light is detected, it may be determined that there is an object in the vicinity of the electronic device 100. When insufficient reflected light is detected, the electronic device 100 may determine that there is no object in the vicinity of the electronic device 100. The electronic device 100 can detect that the user holds the electronic device 100 close to the ear by using the proximity light sensor 180G, so as to automatically extinguish the screen for the purpose of saving power. The proximity light sensor 180G may also be used in holster mode, pocket mode to automatically unlock and lock the screen.
The ambient light sensor 180L is used to sense ambient light level. The electronic device 100 may adaptively adjust the brightness of the display 194 based on the perceived ambient light level. The ambient light sensor 180L may also be used to automatically adjust white balance when taking a photograph. Ambient light sensor 180L may also cooperate with proximity light sensor 180G to detect whether electronic device 100 is in a pocket to prevent false touches.
The fingerprint sensor 180H is used to collect a fingerprint. The electronic device 100 may utilize the collected fingerprint feature to unlock the fingerprint, access the application lock, photograph the fingerprint, answer the incoming call, etc.
The temperature sensor 180J is for detecting temperature. In some embodiments, the electronic device 100 performs a temperature processing strategy using the temperature detected by the temperature sensor 180J. For example, when the temperature reported by temperature sensor 180J exceeds a threshold, electronic device 100 performs a reduction in the performance of a processor located in the vicinity of temperature sensor 180J in order to reduce power consumption to implement thermal protection. In other embodiments, when the temperature is below another threshold, the electronic device 100 heats the battery 142 to avoid the low temperature causing the electronic device 100 to be abnormally shut down. In other embodiments, when the temperature is below a further threshold, the electronic device 100 performs boosting of the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperatures.
The touch sensor 180K, also referred to as a "touch panel". The touch sensor 180K may be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, which is also called a "touch screen". The touch sensor 180K is for detecting a touch operation acting thereon or thereabout. The touch sensor may communicate the detected touch operation to the application processor to determine the touch event type. Visual output related to touch operations may be provided through the display 194. In other embodiments, the touch sensor 180K may also be disposed on the surface of the electronic device 100 at a different location than the display 194.
The bone conduction sensor 180M may acquire a vibration signal. In some embodiments, bone conduction sensor 180M may acquire a vibration signal of a human vocal tract vibrating bone pieces. The bone conduction sensor 180M may also contact the pulse of the human body to receive the blood pressure pulsation signal. In some embodiments, bone conduction sensor 180M may also be provided in a headset, in combination with an osteoinductive headset. The audio module 170 may analyze the voice signal based on the vibration signal of the sound portion vibration bone block obtained by the bone conduction sensor 180M, so as to implement a voice function. The application processor may analyze the heart rate information based on the blood pressure beat signal acquired by the bone conduction sensor 180M, so as to implement a heart rate detection function.
The keys 190 include a power-on key, a volume key, etc. The keys 190 may be mechanical keys. Or may be a touch key. The electronic device 100 may receive key inputs, generating key signal inputs related to user settings and function controls of the electronic device 100.
The motor 191 may generate a vibration cue. The motor 191 may be used for incoming call vibration alerting as well as for touch vibration feedback. For example, touch operations acting on different applications (e.g., photographing, audio playing, etc.) may correspond to different vibration feedback effects. The motor 191 may also correspond to different vibration feedback effects by touching different areas of the display screen 194. Different application scenarios (such as time reminding, receiving information, alarm clock, game, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect may also support customization.
The indicator 192 may be an indicator light, may be used to indicate a state of charge, a change in charge, a message indicating a missed call, a notification, etc.
The SIM card interface 195 is used to connect a SIM card. The SIM card may be inserted into the SIM card interface 195, or removed from the SIM card interface 195 to enable contact and separation with the electronic device 100. The electronic device 100 may support 1 or N SIM card interfaces, N being a positive integer greater than 1. The SIM card interface 195 may support Nano SIM cards, micro SIM cards, and the like. The same SIM card interface 195 may be used to insert multiple cards simultaneously. The types of the plurality of cards may be the same or different. The SIM card interface 195 may also be compatible with different types of SIM cards. The SIM card interface 195 may also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to realize functions such as communication and data communication. In some embodiments, the electronic device 100 employs esims, i.e.: an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.
It should be noted that, because the content of information interaction and execution process between the above devices/units is based on the same concept as the method embodiment of the present application, specific functions and technical effects thereof may be referred to in the method embodiment section, and will not be described herein.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions. The functional units and modules in the embodiment may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit, where the integrated units may be implemented in a form of hardware or a form of a software functional unit. In addition, the specific names of the functional units and modules are only for distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working process of the units and modules in the above system may refer to the corresponding process in the foregoing method embodiment, which is not described herein again.
The embodiment of the application also provides electronic equipment, which comprises: at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor, which when executed by the processor causes the electronic device to perform the steps of any of the methods described above.
Embodiments of the present application also provide a computer-readable storage medium storing a computer program that, when executed by an electronic device, performs the steps of the method embodiments described above.
Embodiments of the present application provide a computer program product comprising a computer program for performing the steps of the method embodiments described above when the computer program is executed by an electronic device.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the present application may implement all or part of the flow of the method of the above embodiments, and may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, and when the computer program is executed by a processor, the computer program may implement the steps of each of the method embodiments described above. Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable medium may include at least: any entity or device capable of carrying computer program code to a photographing device/electronic apparatus, recording medium, computer memory, read-only memory (ROM), random access memory (random access memory, RAM), electrical carrier signals, telecommunications signals, and software distribution media. Such as a U-disk, removable hard disk, magnetic or optical disk, etc. In some jurisdictions, computer readable media may not be electrical carrier signals and telecommunications signals in accordance with legislation and patent practice.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/device and method may be implemented in other manners. For example, the apparatus/device embodiments described above are merely illustrative, e.g., the division of the modules or units is merely a logical functional division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection via interfaces, devices or units, which may be in electrical, mechanical or other forms.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
It should be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in the present specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
Furthermore, the terms "first," "second," "third," and the like in the description of the present specification and in the appended claims, are used for distinguishing between descriptions and not necessarily for indicating or implying a relative importance.
Reference in the specification to "one embodiment" or "some embodiments" or the like means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," and the like in the specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments" unless expressly specified otherwise. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless expressly specified otherwise.
The above embodiments are only for illustrating the technical solution of the present application, and not for limiting the same; although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application, and are intended to be included in the scope of the present application.

Claims (16)

1. A method for monitoring a file system, comprising:
creating a storage container comprising file information of a plurality of files, wherein the files in the storage container are ordered from large to small, and the size of each file in the storage container is larger than the sizes of other files in a partition where the storage container is located; the file system includes a plurality of partitions; when a software product runs on an operating system of the electronic equipment, a file stored in the file system is subjected to reading, writing, shifting, opening and closing operations according to a service task to be executed, wherein the writing operation and the shifting operation are operations which can increase the file;
acquiring the size of a first file in a file system when the first file performs writing operation or offset operation every time;
updating the file information stored in the storage container according to the size of the first file to obtain updated file information;
uploading the updated file information to a server so that the server displays the updated file information;
the updating the file information stored in the storage container according to the size of the first file includes:
When the first file is included in the plurality of files in the storage container, updating the size of the first file stored in the storage container to the size of the first file acquired at the current time, and reordering the plurality of files in the storage container in order from large to small.
2. The method of claim 1, wherein updating the file information stored in the storage container according to the size of the first file comprises:
when the first file is not included in the plurality of files in the storage container, updating file information stored in the storage container according to the relation between the size of the first file and the size of the smallest file in the storage container.
3. The method of claim 2, wherein updating the file information stored in the storage container according to a relationship between the size of the first file and the size of the smallest file in the storage container when the first file is not included in the plurality of files in the storage container, comprises:
when the size of the first file is larger than the size of the minimum file, deleting the minimum file in the storage container, adding the first file into a plurality of files in the storage container, and reordering all files in the storage container in order from large to small; or,
When the size of the first file is smaller than or equal to the size of the minimum file, file information in the storage container is not changed.
4. A method according to any one of claims 1 to 3, further comprising:
acquiring the accumulated operation times of a second file in a file system, wherein the accumulated operation times are times of writing operation and/or offset operation on the second file in a preset statistical period;
uploading the accumulated operation times of the second file to the server so that the server displays the accumulated operation times of the second file.
5. The method of claim 4, wherein the obtaining the cumulative number of operations for the second file in the file system comprises:
creating a counter of the second file, wherein the initial value of the counter is zero;
in the preset statistical period, adding one to the value of the counter every time a write operation or an offset operation to the second file is detected;
after the preset statistical period is finished, determining the numerical value of the counter as the accumulated operation times of the second file, and resetting the numerical value of the counter.
6. The method of claim 4, wherein uploading the accumulated number of operations of the second file to the server to cause the server to display the accumulated number of operations of the second file comprises:
comparing the relation between the accumulated operation times of the second file and a preset time threshold, wherein the preset time threshold is a time threshold corresponding to the preset statistical period;
and uploading the accumulated operation times of the second file to a server when the accumulated operation times of the second file are greater than or equal to the preset times threshold.
7. A method according to any one of claims 1 to 3, further comprising:
acquiring the accumulated operation times of each file in a file system, wherein the accumulated operation times are the times of writing operation and/or offset operation on each file in a preset statistical period;
uploading the accumulated operation times of the files with the accumulated operation times of M previous files in the file system within the preset statistical period to the server, so that the server displays the accumulated operation times of the files with the accumulated operation times of M previous files in the file system, wherein M is an integer larger than 1.
8. A method according to any one of claims 1 to 3, further comprising:
acquiring the accumulated operation times of each file of a first partition in a file system, wherein the accumulated operation times are the times of writing operation and/or offset operation on each file in a preset statistical period; the first partition is any partition in a file system;
uploading the accumulated operation times of the P files with the accumulated operation times of P being the previous P in the preset statistical period in the first partition to the server, so that the server displays the accumulated operation times of the P files with the previous P in the first partition, wherein P is an integer larger than 1.
9. A method according to any one of claims 1 to 3, further comprising:
acquiring an nth operation duration of a third file in a file system, wherein the nth operation duration is used for indicating a time-consuming duration for executing an nth writing operation or an offset operation, and N is a positive integer;
and uploading the operation duration of the nth time of the third file to the server after the operation duration of the nth time of the third file is numbered in sequence by 'N', so that the server displays the operation duration of the nth time of the third file according to the sequence number.
10. The method of claim 9, wherein the obtaining the nth time duration of the operation on the third file in the file system comprises:
recording a system time when execution of an nth write operation or an offset operation to the third file starts and a system time when execution is completed;
and determining the difference value between the system time when the execution is completed and the system time when the execution is started as the N-th operation duration of the third file.
11. The method of claim 9, wherein the step of sequentially numbering the nth time period of the third file with "N" and uploading the nth time period of the third file to the server so that the server displays the nth time period of the third file according to the sequential numbering includes:
comparing the relation between the N-th operation duration of the third file and a preset duration threshold;
and when the operation time length of the nth time of the third file is greater than or equal to the preset time length threshold, uploading the operation time length of the nth time of the third file to the server after carrying out sequence numbering by using N.
12. A method according to any one of claims 1 to 3, further comprising:
Acquiring an nth time operation duration of each file in a file system, wherein the nth time operation duration is used for indicating a time-consuming duration for executing an nth writing operation or an offset operation on each file, and N is a positive integer;
when each preset uploading period is finished, the N-th operation time length of the K files with the N-th operation time length of the previous K in the file system is sequentially numbered by N and then uploaded to the server, so that the server displays the N-th operation time length of the previous K files in the file system according to the sequential numbering; k is an integer greater than 1.
13. A method according to any one of claims 1 to 3, further comprising:
acquiring the N-time operation duration of each file in a second partition in a file system, wherein the N-time operation duration is used for indicating the time-consuming duration of executing the N-time writing operation or the offset operation on each file, and N is a positive integer; the second partition is any partition in the file system;
when each preset uploading period is finished, the N-th operation time length of the L files with the N-th operation time length of the first L in the second partition is sequentially numbered by N and then uploaded to the server, so that the server displays the N-th operation time length of the first L files in the second partition according to the sequential numbering; l is an integer greater than 1.
14. A monitoring device for a file system, comprising:
the processing unit is used for creating a storage container comprising file information of a plurality of files, the files in the storage container are ordered from large to small, and the size of each file in the storage container is larger than the sizes of other files in a partition where the storage container is located; the file system includes a plurality of partitions; when a software product runs on an operating system of the electronic equipment, a file stored in the file system is subjected to reading, writing, shifting, opening and closing operations according to a service task to be executed, wherein the writing operation and the shifting operation are operations which can increase the file;
the device comprises an acquisition unit, a storage unit and a storage unit, wherein the acquisition unit is used for acquiring the size of a first file in a file system when the first file performs a write operation or an offset operation every time;
the processing unit is further configured to update file information stored in the storage container according to the size of the first file, to obtain updated file information;
the sending unit is used for uploading the updated file information to a server so that the server displays the updated file information;
The processing unit is specifically configured to update a size of the first file stored in the storage container to a size of the first file acquired at the current time when the first file is included in the plurality of files in the storage container, and reorder the plurality of files in the storage container in order from large to small.
15. An electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein execution of the computer program by the processor causes the electronic device to implement the method of any one of claims 1 to 13.
16. A computer readable storage medium storing a computer program, characterized in that the computer program, when executed by an electronic device, implements the method of any one of claims 1 to 13.
CN202311086278.0A 2023-08-28 2023-08-28 File system monitoring method and device Active CN116775419B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311086278.0A CN116775419B (en) 2023-08-28 2023-08-28 File system monitoring method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311086278.0A CN116775419B (en) 2023-08-28 2023-08-28 File system monitoring method and device

Publications (2)

Publication Number Publication Date
CN116775419A CN116775419A (en) 2023-09-19
CN116775419B true CN116775419B (en) 2023-12-05

Family

ID=88012045

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311086278.0A Active CN116775419B (en) 2023-08-28 2023-08-28 File system monitoring method and device

Country Status (1)

Country Link
CN (1) CN116775419B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103473343A (en) * 2013-09-23 2013-12-25 深圳市金立通信设备有限公司 File management method, device and terminal
CN103810235A (en) * 2012-11-14 2014-05-21 佳能株式会社 Information processing apparatus, method for controlling the same, and storage medium therefor
US9268832B1 (en) * 2010-05-18 2016-02-23 Netapp, Inc. Sorting a data set by using a limited amount of memory in a processing system
US10437470B1 (en) * 2015-06-22 2019-10-08 Amazon Technologies, Inc. Disk space manager
CN111414332A (en) * 2020-03-27 2020-07-14 湖南化工职业技术学院(湖南工业高级技工学校) Intelligent management system and method for computer files
CN112560030A (en) * 2019-09-09 2021-03-26 北京奇虎科技有限公司 File monitoring method and device, electronic equipment and computer readable storage medium
CN113992652A (en) * 2021-10-15 2022-01-28 珠海金山办公软件有限公司 Cross-terminal file synchronization method and device
CN114090593A (en) * 2020-07-30 2022-02-25 中移(苏州)软件技术有限公司 Data synchronous display method, device, terminal and storage medium
CN114880289A (en) * 2022-04-14 2022-08-09 统信软件技术有限公司 File grouping display method and computing device

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9268832B1 (en) * 2010-05-18 2016-02-23 Netapp, Inc. Sorting a data set by using a limited amount of memory in a processing system
CN103810235A (en) * 2012-11-14 2014-05-21 佳能株式会社 Information processing apparatus, method for controlling the same, and storage medium therefor
CN103473343A (en) * 2013-09-23 2013-12-25 深圳市金立通信设备有限公司 File management method, device and terminal
US10437470B1 (en) * 2015-06-22 2019-10-08 Amazon Technologies, Inc. Disk space manager
CN112560030A (en) * 2019-09-09 2021-03-26 北京奇虎科技有限公司 File monitoring method and device, electronic equipment and computer readable storage medium
CN111414332A (en) * 2020-03-27 2020-07-14 湖南化工职业技术学院(湖南工业高级技工学校) Intelligent management system and method for computer files
CN114090593A (en) * 2020-07-30 2022-02-25 中移(苏州)软件技术有限公司 Data synchronous display method, device, terminal and storage medium
CN113992652A (en) * 2021-10-15 2022-01-28 珠海金山办公软件有限公司 Cross-terminal file synchronization method and device
CN114880289A (en) * 2022-04-14 2022-08-09 统信软件技术有限公司 File grouping display method and computing device

Also Published As

Publication number Publication date
CN116775419A (en) 2023-09-19

Similar Documents

Publication Publication Date Title
CN110347269B (en) Empty mouse mode realization method and related equipment
CN113254409B (en) File sharing method, system and related equipment
CN113395382B (en) Method for data interaction between devices and related devices
CN114422340B (en) Log reporting method, electronic equipment and storage medium
CN114880251B (en) Memory cell access method, memory cell access device and terminal equipment
CN113542580A (en) Method and device for removing light spots of glasses and electronic equipment
CN114490174A (en) File system detection method, electronic device and computer readable storage medium
CN113438643A (en) Terminal capability reporting system, method, electronic equipment and storage medium
CN116389884B (en) Thumbnail display method and terminal equipment
CN114968543A (en) Method for processing document page and related device
CN116055859B (en) Image processing method and electronic device
CN113542574A (en) Shooting preview method under zooming, terminal, storage medium and electronic equipment
CN114173286B (en) Method and device for determining test path, electronic equipment and readable storage medium
CN116775419B (en) File system monitoring method and device
CN114466238B (en) Frame demultiplexing method, electronic device and storage medium
CN114116610A (en) Method, device, electronic equipment and medium for acquiring storage information
CN116719376B (en) Voltage control method, device, equipment and storage medium
CN116708656B (en) Card punching method and card punching system
CN116048769B (en) Memory recycling method and device and terminal equipment
CN116048831B (en) Target signal processing method and electronic equipment
CN116048772B (en) Method and device for adjusting frequency of central processing unit and terminal equipment
CN115734323B (en) Power consumption optimization method and device
CN116345147B (en) Antenna tuning method and terminal equipment
CN115619628B (en) Image processing method and terminal equipment
CN116055870B (en) Photographing method and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant