CN105893394B - Large file simulation method and device - Google Patents

Large file simulation method and device Download PDF

Info

Publication number
CN105893394B
CN105893394B CN201510038843.5A CN201510038843A CN105893394B CN 105893394 B CN105893394 B CN 105893394B CN 201510038843 A CN201510038843 A CN 201510038843A CN 105893394 B CN105893394 B CN 105893394B
Authority
CN
China
Prior art keywords
hard disk
disk space
target
file
operating system
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
CN201510038843.5A
Other languages
Chinese (zh)
Other versions
CN105893394A (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.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies 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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201510038843.5A priority Critical patent/CN105893394B/en
Publication of CN105893394A publication Critical patent/CN105893394A/en
Application granted granted Critical
Publication of CN105893394B publication Critical patent/CN105893394B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a large file simulation method and device, and belongs to the field of computers. The large file simulating method and device provided by the invention calculate the target occupation capacity of the hard disk space through the target occupancy rate of the hard disk space, the total capacity of the hard disk space and the used capacity of the hard disk space included in the test parameters of the operating system, then modify the size of the target file in the hard disk space according to the target occupation capacity to ensure that the occupancy rate of the hard disk space reaches the target occupation capacity, so that the occupancy rate of the current hard disk space is consistent with the target occupancy rate of the hard disk space in the test parameters of the operating system, the process of modifying the size of the target file only takes dozens of milliseconds, and the large file is not required to be written into the hard disk for a plurality of hours, so that the operating system can determine that the size of the current hard disk space reaches the test requirement.

Description

Large file simulation method and device
Technical Field
The invention relates to the field of computers, in particular to a large file simulation method and device.
Background
As operating systems are applied more and more widely, the requirement on stability of the operating systems is higher and higher. Therefore, in developing the operating system, the stability of the operating system needs to be tested. In the process of testing the stability of the operating system, the operating system to be tested is set in different hardware running states, such as: the Central Processing Unit (abbreviated as CPU) occupancy rate is 100%, the memory occupancy rate is 90%, the hard disk space occupancy rate is 100% or the hard disk space occupancy rate is 90%, and the like, and then the operating system is operated to obtain the faults of the operating system in the operating states, solve the faults and improve the stability of the operating system.
In general, in order to obtain failures of an operating system under different hard disk space occupancy rates, before the operating system performs a stability test, a large file is written into a hard disk space of a computer where the operating system is located, and the hard disk space occupancy rate of the computer reaches a size required by the test in a manner of storing the large file, so as to perform a subsequent stability test on the operating system, wherein the large file refers to a single file with a size of Gigabytes (GB) or more.
When writing a large file into a hard disk space of a computer, even when the large file is written into a solid state disk (the read-write speed is 300 mega/s), if the capacity of the solid state disk is 1 Terabyte (TB), the solid state disk needs to be fully filled, which takes 1 hour to implement, and then the stability test can be performed on an operating system. If the hard disk space of the computer is a solid state disk with a size of several TB, or the hard disk of the computer where the operating system is located is a mechanical hard disk with a capacity of 1 terabyte (the read/write speed is 80 mb/sec), the hard disk will be used for several hours if it is full, which will make the test time very long, resulting in low test efficiency.
disclosure of Invention
In order to solve the problems in the prior art, embodiments of the present invention provide a method and an apparatus for simulating a large file. The technical scheme is as follows:
In a first aspect, an embodiment of the present invention provides a large file simulation method, where the method includes:
Obtaining operating system test parameters, wherein the operating system test parameters comprise a hard disk space target occupancy rate, a total hard disk space capacity and a used hard disk space capacity, and the hard disk space target occupancy rate is a hard disk space occupancy rate required to be achieved when the hard disk space is used for testing the performance of the operating system;
Calculating the target occupation capacity of the hard disk space according to the target occupation rate of the hard disk space and the total capacity of the hard disk space;
And modifying the size of a target file in the hard disk space according to the target occupied capacity to enable the occupied capacity of the hard disk space to reach the target occupied capacity, wherein the target file is any file in the hard disk space.
in a first possible implementation manner of the first aspect, the modifying, according to the target occupied capacity, the size of the target file in the hard disk space includes:
Obtaining the variable quantity of the size of the target file according to the target occupied capacity of the hard disk space and the used capacity of the hard disk space;
And modifying the size of the target file according to the obtained variable quantity of the size of the target file.
In a second possible implementation manner of the first aspect, the method further includes:
and when the occupancy rate of the hard disk space reaches 100%, returning the prompt code of which the hard disk space is full.
With reference to the second possible implementation manner of the first aspect, in a third possible implementation manner of the first aspect, the step of returning the prompt code indicating that the hard disk space is full when the occupancy rate of the hard disk space reaches 100% includes:
Acquiring a file write operation instruction;
if the file write operation instruction is not responded within the preset time, judging that the occupancy rate of the hard disk space is 100%;
And returning the prompt code of which the hard disk space is full.
With reference to the first aspect and the first to third possible implementation manners of the first aspect, in a fourth possible implementation manner of the first aspect, the method further includes: and modifying the file type of the target file according to the test requirement of the operating system performance.
With reference to the first aspect and the first to third possible implementation manners of the first aspect, in a fifth possible implementation manner of the first aspect, after the performance of the operating system completes the test under the condition of the target occupancy rate of the hard disk space, the target file is restored to the original size, or the target file is deleted.
In a second aspect, an embodiment of the present invention provides a large file simulation apparatus, where the apparatus includes:
the system comprises a parameter acquisition module, a parameter acquisition module and a parameter analysis module, wherein the parameter acquisition module is used for acquiring operating system test parameters, the operating system test parameters comprise a hard disk space target occupancy rate, a hard disk space total capacity and a hard disk space used capacity, and the hard disk space target occupancy rate is a hard disk space occupancy rate required to be achieved when the hard disk space is used for testing the performance of the operating system;
The calculation module is used for calculating the target occupation capacity of the hard disk space according to the target occupation rate of the hard disk space and the total capacity of the hard disk space, which are acquired by the parameter acquisition module;
and the target file size modifying module is used for modifying the size of the target file in the hard disk space according to the target occupied capacity calculated by the calculating module so that the occupied capacity of the hard disk space reaches the target occupied capacity, and the target file is any file in the hard disk space.
In a first possible implementation manner of the second aspect, the target file size modification module includes:
A target file variation determining unit, configured to obtain a variation of the size of the target file according to the target occupied capacity of the hard disk space calculated by the calculating module and the used capacity of the hard disk space obtained by the parameter obtaining module;
and the modifying unit is used for modifying the size of the target file according to the variable quantity of the size of the target file obtained by the variable quantity determining unit of the target file.
In a second possible implementation manner of the second aspect, the apparatus further includes:
And the return module is used for returning the prompt code of which the hard disk space is full when the occupancy rate of the hard disk space is 100 percent.
With reference to the second possible implementation manner of the second aspect, in a third possible implementation manner of the second aspect, the returning module includes:
the acquisition unit is used for acquiring a file write operation instruction;
The judging unit is used for judging that the occupancy rate of the hard disk space is 100% when the file writing operation instruction acquired by the acquiring unit does not respond within the preset time;
and the return unit is used for returning the prompt code of which the hard disk space is full when the judgment unit judges that the occupancy rate of the hard disk space is 100 percent.
with reference to the second aspect and the second to third possible implementation manners of the second aspect, in a fourth possible implementation manner of the second aspect, the apparatus further includes:
And the target file type modification module is used for modifying the file type of the target file according to the test requirement of the performance of the operating system.
with reference to the second aspect and the second to third possible implementation manners of the second aspect, in a fifth possible implementation manner of the second aspect, the recovery module is configured to recover the size of the target file or delete the target file after the performance of the operating system is tested under the condition of the target occupancy rate of the hard disk space.
the technical scheme provided by the embodiment of the invention has the following beneficial effects:
the large file simulating method and device provided by the embodiment of the invention calculate the target occupation capacity of the hard disk space through the target occupancy rate of the hard disk space, the total capacity of the hard disk space and the used capacity of the hard disk space included in the test parameters of the operating system, then modify the size of the target file in the hard disk space according to the target occupation capacity to ensure that the occupation capacity of the hard disk space reaches the target occupation capacity and the current occupancy rate of the hard disk space is consistent with the target occupancy rate of the hard disk space in the test parameters of the operating system, only dozens of milliseconds are needed in the process of modifying the size of the target file, and a large file is not needed to be written into the hard disk for spending a plurality of hours, so that the operating system can determine that the current occupancy rate of the hard disk space reaches the test requirement, the test of the stability of the operating system can be carried out immediately, and the test, the test efficiency of the stability of the operating system is improved.
drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
fig. 1 is a schematic structural diagram of an implementation environment related to a large file simulation method provided by an embodiment of the present invention;
FIG. 2 is a flowchart of a large file simulation method according to an embodiment of the present invention;
FIG. 3 is a flowchart of a large file simulation method according to a second embodiment of the present invention;
fig. 4 is a flowchart of verifying that the hard disk space is full in the large file simulation method according to the second embodiment of the present invention;
Fig. 5 is a schematic structural diagram of a large file simulation apparatus according to a third embodiment of the present invention;
fig. 6 is a schematic structural diagram of a large file simulation apparatus according to a fourth embodiment of the present invention;
Fig. 7 is a schematic structural diagram of a large file simulation apparatus according to a fifth embodiment of the present invention.
Detailed Description
in order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Unless defined otherwise, technical or scientific terms used herein shall have the ordinary meaning as understood by one of ordinary skill in the art to which this invention belongs. The use of "first," "second," and similar terms in the description and claims of the present application do not denote any order, quantity, or importance, but rather the terms are used to distinguish one element from another.
Referring to fig. 1, it shows a schematic structural diagram of an implementation environment related to a large file simulation method provided by the embodiment of the present invention, where the system includes: a computer hardware system 10 and an operating system 11 running on the computer hardware system.
The computer hardware system 10 constitutes a hardware test environment for stability testing of the operating system 11.
Example one
Referring to fig. 2, the present embodiment provides a large file simulation method, which includes the following steps:
Step 100, the operating system obtains operating system test parameters, wherein the operating system test parameters comprise a hard disk space target occupancy rate, a hard disk space total capacity and a hard disk space used capacity, and the hard disk space target occupancy rate is a hard disk space occupancy rate required to be achieved when the hard disk space is used for testing the performance of the operating system.
The target occupancy rate of the hard disk space is only one of a plurality of operating system test parameters, and according to the stability test requirement of the operating system, a plurality of operating system test parameters can be provided, such as: target memory space occupancy rate, target CPU utilization rate, etc., which are not described in detail herein.
Step 101, according to the target occupancy rate of the hard disk space and the total capacity of the hard disk space, the operating system calculates the target occupancy capacity of the hard disk space.
The operating system can obtain the size of the target file by reading the file information of the target file.
Step 102, according to the target occupied capacity, the operating system modifies the size of the target file in the hard disk space, so that the occupied capacity of the hard disk space reaches the target occupied capacity, and the target file is any file in the hard disk space.
The size of the large file is determined according to the target occupied capacity of the hard disk space and the used capacity of the hard disk space, and the size is usually above Gigabytes (GB).
through the above description, the target occupation capacity of the hard disk space is calculated through the target occupancy rate of the hard disk space, the total capacity of the hard disk space and the used capacity of the hard disk space included in the test parameters of the operating system, and then the size of the target file in the hard disk space is modified according to the target occupation capacity, so that the occupation capacity of the hard disk space reaches the target occupation capacity, the occupancy rate of the current hard disk space is consistent with the target occupancy rate of the hard disk space in the test parameters of the operating system, the process of modifying the size of the target file only takes tens of milliseconds, and a large file is not required to be written into the hard disk for hours, and the operating system can determine that the size of the current hard disk space reaches the test requirement.
Example two
referring to fig. 3, the present embodiment provides a large file simulation method, which includes the following steps:
step 200, the operating system obtains operating system test parameters, wherein the operating system test parameters comprise a hard disk space target occupancy rate, a hard disk space total capacity and a hard disk space used capacity, and the hard disk space target occupancy rate is a hard disk space occupancy rate required to be achieved when the hard disk space is used for testing the performance of the operating system.
The operating system is any operating system with a Linux kernel, such as: an operating system Mac OS X used on the apple computer, an android system used on the mobile terminal and the like.
the operating system can obtain two parameters of the total capacity of the hard disk space and the used capacity of the hard disk space by reading the system information of the computer. The parameter of the target occupancy rate of the hard disk space is a parameter meeting the stability test requirement of the current operating system, and can be input into the operating system by a tester through input equipment of a computer hardware system; or the test result may be recorded in a hardware requirement table set in a hard disk of the computer hardware system in advance, before the test, a tester may open the hardware requirement table through an input device of the computer hardware system, and select a parameter of the current operating system stability test requirement in the hardware requirement table.
The target occupancy rate of the hard disk space is only one of a plurality of operating system test required parameters recorded in the hardware requirement table, and a plurality of operating system test parameters are also recorded in the hardware requirement table, which is not described in detail herein.
The hardware requirement table can be opened by a tester in the form of a table or a program on the operating system, so that the tester can select the operating system test parameters meeting the stability test requirement of the current operating system from a plurality of operating system test parameters.
the operating system test parameters may include any parameter for operating system stability test, in addition to the target occupancy rate of the hard disk space, the total capacity of the hard disk space, and the used capacity of the hard disk space, which is not described herein any more.
Wherein, the parameter range of the target occupancy rate of the hard disk space is 0% to 100%.
Step 201, according to the target occupancy rate of the hard disk space and the total capacity of the hard disk space, the operating system calculates the target occupancy capacity of the hard disk space.
Specifically, after acquiring two parameters, namely the target occupancy rate of the hard disk space and the total capacity of the hard disk space, the operating system calls a processing process of the CPU to calculate the product of the target occupancy rate of the hard disk space and the total capacity of the hard disk space, and the result obtained by calculation is used as the target occupancy capacity of the hard disk space.
the target occupied capacity of the hard disk space obtained through calculation is the used capacity of the hard disk space meeting the stability test requirement of the current operating system.
Such as: the target occupancy rate of the hard disk space is 92%, the total capacity of the hard disk space is 500GB, and then the target occupancy capacity of the hard disk space obtained through calculation is 460 GB.
Step 202, according to the target occupied capacity, the operating system modifies the size of the target file in the hard disk space, so that the occupied capacity of the hard disk space reaches the target occupied capacity, and the target file is any file in the hard disk space.
Specifically, the flow of step 202 is specifically described by step 2021-step 2022.
Step 2021, according to the target occupied capacity of the hard disk space and the used capacity of the hard disk space, the operating system obtains the variable quantity of the size of the target file.
specifically, the operating system calls a processing process of the CPU to calculate a difference value between the target occupied capacity of the hard disk space and the used capacity of the hard disk space according to the target occupied capacity of the hard disk space and the used capacity of the hard disk space, and uses the calculated difference value as a variable quantity of the size of the target file.
If the variable quantity of the size of the target file is a positive value, the target occupied capacity of the hard disk space is larger than the used capacity of the hard disk space, and the obtained variable quantity of the size of the target file is to increase the used capacity of the hard disk space where the target file is located, so that the requirement of the target occupied capacity of the hard disk is met; if the variable quantity of the target file size is a negative value, the target occupied capacity of the hard disk space is smaller than the used capacity of the hard disk space, and the obtained variable quantity of the target file size is to reduce the used capacity of the hard disk space where the target file is located, so that the requirement of the target occupied capacity of the hard disk is met.
The target file size is a variable amount, which is the target file size to be modified, and is usually a value between several tens of GB and several hundreds of GB.
The size of the target file can be set to be larger, even can exceed the hard disk space by a large amount, but the maximum value of the target occupancy rate of the hard disk space is 100%.
Step 2022, according to the obtained variation of the size of the target file, the operating system modifies the size of the target file.
Specifically, the operating system obtains the size of the target file from the file information of the target file, modifies the size of the target file according to the previously obtained variation of the size of the target file to enable the occupied capacity of the hard disk space to reach the target occupied capacity, and enables the target file to rapidly simulate the large file by modifying the size parameter of the target file.
furthermore, after the size of the target file is modified, when the operating system reads the file information of the target file, the size of the target file recorded in the file information of the target file is the size modified according to the variable quantity of the size of the target file, and then the operating system automatically modifies the used capacity of the hard disk space, so that the occupied capacity of the hard disk space reaches the target occupied capacity.
in the specific implementation process, the size of the target file has no absolute size relationship with the size to be modified.
In some cases, in order to discover the effect of large files formed by different types of target files on the stability of the operating system, the file types of the target files may be modified for related tests.
Further, in the embodiment provided by the present invention, the large file simulation method further includes the following steps:
Step 203, according to the test requirement of the operating system performance, the operating system modifies the file type of the target file.
The file types of the target file include, but are not limited to: audio, video, pictures, documents, etc. The file types of the audio include: WAV, MP3, APE, WMA, etc.; the file types of the video include: wmv, asf, asx, rm, rmvb, mpg, mpeg, mpe, 3gp, mov, mp4, m4v, avi, dat, mkv, flv, vob, etc.; the file types of the pictures include: BMP, PCX, JPEG, GIF, TIFF, etc.; the file types of the document include: pdf, word, ppt, txt, etc.
The size of the file is modified, the type of the file is modified, and the performance of an operating system can be simulated when the occupancy rates of different types of files in a specified hard disk are reduced.
optionally, the large file simulation method further includes the following steps:
And step 204, after the performance of the operating system is tested under the condition of the target occupancy rate of the hard disk space, the operating system recovers the size of the target file or deletes the target file.
in some cases, in order to find out the failure of the operating system under the condition that the hardware environment of the computer is relatively extreme, the stability of the operating system is tested when the hard disk space of the computer where the operating system is located is full, but before the test, the hard disk space needs to be verified.
Further, in the embodiment of the present invention, referring to fig. 4, the method for performing hard disk space full verification includes the following steps:
Step 301, the operating system obtains a file write operation instruction.
Specifically, after the operating system modifies the used capacity of the hard disk space to the capacity of the hard disk space, the operating system obtains a file write operation instruction, where the file write operation instruction is used to write a specified file of any size into the hard disk space.
the file writing operation instruction is an instruction sent to an operating system by a tester through input equipment of a computer.
the specific file is pre-stored in any other storage device in the non-hardware test environment, such as: u disk or mobile hard disk.
Step 302, if the file write operation instruction is not responded within the preset time, the operating system determines that the occupancy rate of the hard disk space is 100%.
specifically, the flow of step 302 is specifically described by step 3021 to step 3023.
step 3021, the operating system determines whether the file write operation command is responded within a preset time.
if the operating system judges that the file writing operation instruction is not responded in the preset time, step 3022 is executed.
If the operating system judges that the file writing operation instruction is responded within the preset time, step 3023 is executed.
Specifically, after the operating system obtains the file write operation instruction, the file write operation instruction is transmitted to a hard disk controller of the computer hardware system, and the hard disk controller writes the specified file into the hard disk space according to the file write operation instruction. If the specified file is not written into the hard disk space within the preset time, judging that the file writing operation instruction is not responded; and if the specified file is successfully written into the hard disk space, judging that the file writing operation instruction is responded.
step 3022, if it is determined that the file writing operation instruction is not responded within the preset time, the hard disk controller of the computer determines that the occupancy rate of the hard disk space is 100%, and the step 303 is returned.
Step 3023, if it is determined that the file write operation instruction is responded within the preset time, determining that the hard disk controller of the computer does not determine that the occupancy rate of the hard disk space is 100%.
If the specified file is written into the hard disk space within the preset time, it indicates that the hard disk space does not meet the hardware test requirement of the stability test, and the file size of a certain file in the hard disk space and the used capacity of the hard disk space need to be continuously modified to enable the occupancy rate of the hard disk space to reach 100%.
The length of the preset time can be set differently according to the stability test condition, and is generally any time length from 0 millisecond to 100 milliseconds.
step 303, the hard disk controller of the computer returns the hint code that the hard disk space is full to the operating system.
specifically, if the specified file is not written into the hard disk space within the preset time, the hard disk controller generates a prompt code indicating that the hard disk space is full, then the prompt code indicating that the hard disk space is full is returned to the operating system, and after the operating system obtains the prompt code indicating that the hard disk space is full, the operating system displays the prompt code indicating that the hard disk space is full on a display of the computer in a form of a message popup window so as to inform a tester that the hard disk space of the computer is full at this time, so that the stability of the operating system can be tested.
Optionally, after obtaining the prompt code indicating that the hard disk space is full, the operating system is not limited to notifying the tester in the form of a message popup window, and may also notify the tester that the hard disk space is full in any other manner, which is not described herein any more.
through the description of steps 301 to 303, before the stability test of the operating system is performed, it is verified whether the current hard disk space is full, and when it is determined that the hard disk space is full, the stability test of the operating system is performed, so that the hardware environment for performing the test can meet the test requirement, and the test accuracy is improved.
the contents of the present embodiment are further described by the following examples.
In any operating system with a Linux kernel, in order to test the stability of the operating system when the hard disk is full, the operating system modifies the size of the target file to make the hard disk space where the operating system is located full.
The process of the operating system for modifying the size of the target file comprises the following steps: presetting a first trigger function for calling file information of an acquired target file and a first callback function corresponding to the first trigger function, wherein the first callback function is set with variable quantity of the size of the target file; when the operation of modifying the size of the target file is carried out, the operating system firstly calls a first trigger function to obtain the size of the target file, and after the size of the target file is obtained, the first callback function is executed to modify the size of the target file, so that the usable space of the hard disk space after the size of the target file is modified is 0.
then, in order to ensure that the hard disk space where the operating system is located is full, it is necessary to verify whether the hard disk space is full.
the process of verifying whether the hard disk space is full is as follows: the method comprises the steps of presetting a second trigger function for triggering a file writing instruction and a second callback function corresponding to the second trigger function, wherein the second callback function is used for returning a prompt code indicating that the hard disk space is full, calling the second trigger function by an operating system to trigger the file writing instruction when the operation of verifying whether the hard disk space is full is carried out, and executing the second callback function to return the prompt code indicating that the hard disk space is full when the file cannot be written into the hard disk space, so as to confirm that the hard disk space is full.
the first trigger function may be a vfs _ gettat function, the first callback function may be a vfs _ gettat _ handler function, the second trigger function may be an rw _ verify _ area function, and the second callback function may be an rw _ verify _ area _ handler function.
based on the above description, the large file simulation method provided in this embodiment calculates the target occupation capacity of the hard disk space through the target occupancy rate of the hard disk space, the total capacity of the hard disk space, and the used capacity of the hard disk space included in the operating system test parameters, and then modifies the size of the target file in the hard disk space according to the target occupation capacity, so that the occupancy rate of the hard disk space reaches the target occupation capacity, and the current occupancy rate of the hard disk space is consistent with the target occupancy rate of the hard disk space in the operating system test parameters, and the process of modifying the size of the target file only takes tens of milliseconds, and does not take several hours to write the large file into the hard disk, so that the operating system can determine that the current occupancy rate of the hard disk space has reached the test requirement, and can immediately perform the test of the stability of the operating system, thereby greatly saving the test time of the stability, the test efficiency of the stability of the operating system is improved.
EXAMPLE III
Referring to fig. 5, the present embodiment provides a large file simulation apparatus, including: a parameter acquisition module 400, a calculation module 401 and a target file size modification module 402.
Specifically, the parameter obtaining module 400 is configured to obtain operating system test parameters, where the operating system test parameters include a target occupancy rate of a hard disk space, a total capacity of the hard disk space, and a used capacity of the hard disk space, and the target occupancy rate of the hard disk space is a hard disk space occupancy rate that needs to be achieved when the hard disk space is used for testing performance of the operating system; a calculating module 401, configured to calculate a target occupied capacity of the hard disk space according to the target occupancy rate of the hard disk space and the total capacity of the hard disk space, which are acquired by the parameter acquiring module 400; a target file size modifying module 402, configured to modify the size of the target file in the hard disk space according to the target occupied capacity calculated by the calculating module 401, so that the occupied capacity of the hard disk space reaches the target occupied capacity, and the target file is any file in the hard disk space.
based on the above description, the large file simulation apparatus provided in this embodiment calculates the target occupation capacity of the hard disk space through the target occupancy rate of the hard disk space, the total capacity of the hard disk space, and the used capacity of the hard disk space included in the operating system test parameters, and then modifies the size of the target file in the hard disk space according to the target occupation capacity, so that the occupancy rate of the hard disk space reaches the target occupation capacity, and the current occupancy rate of the hard disk space is consistent with the target occupancy rate of the hard disk space in the operating system test parameters, and the process of modifying the size of the target file only takes tens of milliseconds, and does not take several hours to write the large file into the hard disk, so that the operating system can determine that the current occupancy rate of the hard disk space has reached the test requirement, and can immediately perform the test of the stability of the operating system, thereby greatly saving the test time of the stability, the test efficiency of the stability of the operating system is improved.
Example four
Referring to fig. 6, the present embodiment provides a large file simulation apparatus, including: the system comprises a parameter acquisition module 500, a calculation module 501, a target file size modification module 502, a target file type modification module 503, a return module 504 and a recovery module 505.
Specifically, the parameter obtaining module 500 is configured to obtain operating system test parameters, where the operating system test parameters include a target occupancy rate of a hard disk space, a total capacity of the hard disk space, and a used capacity of the hard disk space, and the target occupancy rate of the hard disk space is a hard disk space occupancy rate that needs to be achieved when the hard disk space is used for testing performance of the operating system; a calculating module 501, configured to calculate a target occupied capacity of the hard disk space according to the target occupancy rate of the hard disk space and the total capacity of the hard disk space, which are acquired by the parameter acquiring module 500; a target file size modification module 502, configured to modify the size of a target file in the hard disk space according to the target occupied capacity calculated by the calculation module 501, so that the occupied capacity of the hard disk space reaches the target occupied capacity, where the target file is any file in the hard disk space; a target file type modification module 503, configured to modify the file type of the target file according to a test requirement of the performance of the operating system when the target file size modification module modifies the size of the target file in the hard disk space; a returning module 504, configured to return a prompt code indicating that the hard disk space is full when the hard disk space occupancy rate is 100% after the target file size is modified by the target file size modification module 502; and the recovery module 505 is configured to recover the size of the target file or delete the target file after the performance of the operating system is tested under the condition of the target occupancy rate of the hard disk space.
Specifically, the target file size modification module 502 includes:
The target file variation determining unit 5021 is used for obtaining the variation of the size of the target file according to the target occupied capacity of the hard disk space calculated by the calculating module and the used capacity of the hard disk space obtained by the parameter obtaining module;
And the modifying unit 5022 is used for modifying the size of the target file according to the variable quantity of the size of the target file obtained by the variable quantity determining unit of the target file.
Specifically, the return module 504 includes:
a obtaining unit 5041, configured to obtain a file write operation instruction;
the judging unit 5042 is configured to judge that the occupancy rate of the hard disk space is 100% when the file write operation instruction acquired by the acquiring unit does not respond within a preset time;
a returning unit 5043, configured to return a prompt code indicating that the hard disk space is full when the determining unit determines that the occupancy rate of the hard disk space is 100%.
Based on the above description, the large file simulation apparatus provided in this embodiment calculates the target occupation capacity of the hard disk space through the target occupancy rate of the hard disk space, the total capacity of the hard disk space, and the used capacity of the hard disk space included in the operating system test parameters, and then modifies the size of the target file in the hard disk space according to the target occupation capacity, so that the occupancy rate of the hard disk space reaches the target occupation capacity, and the current occupancy rate of the hard disk space is consistent with the target occupancy rate of the hard disk space in the operating system test parameters, and the process of modifying the size of the target file only takes tens of milliseconds, and does not take several hours to write the large file into the hard disk, so that the operating system can determine that the current occupancy rate of the hard disk space has reached the test requirement, and can immediately perform the test of the stability of the operating system, thereby greatly saving the test time of the stability, the test efficiency of the stability of the operating system is improved.
EXAMPLE five
Referring to fig. 7, an embodiment of the present invention provides a virtual machine processing apparatus, including a memory 600, a processor 700, a transceiver 800, and one or more programs, where the one or more programs are stored in the memory 600 and configured to be executed by the processor 700, and the one or more programs include instructions for performing the following operations, and the transceiver 800 is configured to receive a file write operation instruction:
Obtaining operating system test parameters, wherein the operating system test parameters comprise a hard disk space target occupancy rate, a hard disk space total capacity and a hard disk space used capacity, and the hard disk space target occupancy rate is a hard disk space occupancy rate required to be achieved when the hard disk space is used for testing the performance of an operating system;
Calculating the target occupation capacity of the hard disk space according to the target occupancy rate of the hard disk space and the total capacity of the hard disk space;
And modifying the size of the target file in the hard disk space according to the target occupied capacity to enable the occupied capacity of the hard disk space to reach the target occupied capacity, wherein the target file is any file in the hard disk space.
based on the above description, the large file simulation apparatus provided in this embodiment calculates the target occupation capacity of the hard disk space through the target occupancy rate of the hard disk space, the total capacity of the hard disk space, and the used capacity of the hard disk space included in the operating system test parameters, and then modifies the size of the target file in the hard disk space according to the target occupation capacity, so that the occupancy rate of the hard disk space reaches the target occupation capacity, and the current occupancy rate of the hard disk space is consistent with the target occupancy rate of the hard disk space in the operating system test parameters, and the process of modifying the size of the target file only takes tens of milliseconds, and does not take several hours to write the large file into the hard disk, so that the operating system can determine that the current occupancy rate of the hard disk space has reached the test requirement, and can immediately perform the test of the stability of the operating system, thereby greatly saving the test time of the stability, the test efficiency of the stability of the operating system is improved.
It should be noted that: in the large file simulation apparatus provided in the foregoing embodiment, when simulating a large file, only the division of the functional modules is illustrated, and in practical applications, the function distribution may be completed by different functional modules according to needs, that is, the internal structure of the apparatus is divided into different functional modules to complete all or part of the functions described above. In addition, the large file simulation apparatus provided by the above embodiment and the large file simulation method embodiment belong to the same concept, and specific implementation processes thereof are detailed in the method embodiment and are not described herein again.
the above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (8)

1. A large file simulation method, the method comprising:
Obtaining operating system test parameters, wherein the operating system test parameters comprise a hard disk space target occupancy rate, a total hard disk space capacity and a used hard disk space capacity, and the hard disk space target occupancy rate is a hard disk space occupancy rate required to be achieved when the hard disk space is used for testing the performance of the operating system;
Calculating the target occupation capacity of the hard disk space according to the target occupation rate of the hard disk space and the total capacity of the hard disk space;
Modifying the size of a target file in the hard disk space according to the target occupied capacity to enable the occupied capacity of the hard disk space to reach the target occupied capacity, wherein the target file is any file in the hard disk space;
Wherein the method further comprises:
acquiring a file write operation instruction;
If the file write operation instruction is not responded within the preset time, judging that the occupancy rate of the hard disk space is 100%;
And returning the prompt code of which the hard disk space is full.
2. The method according to claim 1, wherein the step of modifying the size of the target file in the hard disk space according to the target occupied capacity comprises:
Obtaining the variable quantity of the size of the target file according to the target occupied capacity of the hard disk space and the used capacity of the hard disk space;
And modifying the size of the target file according to the obtained variable quantity of the size of the target file.
3. The large file simulation method according to claim 1 or 2, wherein the method further comprises: and modifying the file type of the target file according to the test requirement of the operating system performance.
4. the large file simulation method according to claim 1 or 2, wherein the method further comprises: and after the performance of the operating system is tested under the condition of the target occupancy rate of the hard disk space, restoring the target file to the original size or deleting the target file.
5. A large document simulation apparatus, the apparatus comprising:
The system comprises a parameter acquisition module, a parameter acquisition module and a parameter analysis module, wherein the parameter acquisition module is used for acquiring operating system test parameters, the operating system test parameters comprise a hard disk space target occupancy rate, a hard disk space total capacity and a hard disk space used capacity, and the hard disk space target occupancy rate is a hard disk space occupancy rate required to be achieved when the hard disk space is used for testing the performance of the operating system;
The calculation module is used for calculating the target occupation capacity of the hard disk space according to the target occupation rate of the hard disk space and the total capacity of the hard disk space, which are acquired by the parameter acquisition module;
A target file size modification module, configured to modify the size of a target file in the hard disk space according to the target occupied capacity calculated by the calculation module, so that the occupied capacity of the hard disk space reaches the target occupied capacity, where the target file is any file in the hard disk space;
Wherein the apparatus further comprises:
The acquisition unit is used for acquiring a file write operation instruction;
the judging unit is used for judging that the occupancy rate of the hard disk space is 100% when the file writing operation instruction acquired by the acquiring unit does not respond within the preset time;
And the return unit is used for returning the prompt code of which the hard disk space is full when the judgment unit judges that the occupancy rate of the hard disk space is 100 percent.
6. the large file simulation apparatus of claim 5, wherein the target file size modification module comprises:
a target file variation determining unit, configured to obtain a variation of the size of the target file according to the target occupied capacity of the hard disk space calculated by the calculating module and the used capacity of the hard disk space obtained by the parameter obtaining module;
And the modifying unit is used for modifying the size of the target file according to the variable quantity of the size of the target file obtained by the variable quantity determining unit of the target file.
7. the large document simulation apparatus according to claim 5 or 6, wherein the apparatus further comprises:
And the target file type modification module is used for modifying the file type of the target file according to the test requirement of the performance of the operating system.
8. the large document simulation apparatus according to claim 5 or 6, wherein the apparatus further comprises:
And the recovery module is used for recovering the target file to the original size or deleting the target file after the performance of the operating system is tested under the condition of the target occupancy rate of the hard disk space.
CN201510038843.5A 2015-01-26 2015-01-26 Large file simulation method and device Active CN105893394B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510038843.5A CN105893394B (en) 2015-01-26 2015-01-26 Large file simulation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510038843.5A CN105893394B (en) 2015-01-26 2015-01-26 Large file simulation method and device

Publications (2)

Publication Number Publication Date
CN105893394A CN105893394A (en) 2016-08-24
CN105893394B true CN105893394B (en) 2019-12-06

Family

ID=56999220

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510038843.5A Active CN105893394B (en) 2015-01-26 2015-01-26 Large file simulation method and device

Country Status (1)

Country Link
CN (1) CN105893394B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111813673A (en) * 2020-07-06 2020-10-23 珠海西山居移动游戏科技有限公司 Hard disk filling test method and system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2357604A (en) * 1999-12-24 2001-06-27 Inventec Corp Cloning computer file system using bitmap file
CN1968057A (en) * 2006-06-30 2007-05-23 华为技术有限公司 A testing method for communication device
CN101373446A (en) * 2007-08-24 2009-02-25 英业达股份有限公司 Method for testing pressure of file system
CN102970575A (en) * 2012-10-12 2013-03-13 中央电视台 Playing and memorizing device type selection testing method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2357604A (en) * 1999-12-24 2001-06-27 Inventec Corp Cloning computer file system using bitmap file
CN1968057A (en) * 2006-06-30 2007-05-23 华为技术有限公司 A testing method for communication device
CN101373446A (en) * 2007-08-24 2009-02-25 英业达股份有限公司 Method for testing pressure of file system
CN102970575A (en) * 2012-10-12 2013-03-13 中央电视台 Playing and memorizing device type selection testing method

Also Published As

Publication number Publication date
CN105893394A (en) 2016-08-24

Similar Documents

Publication Publication Date Title
CN102419727A (en) Automatic test method and device
CN107608609B (en) Event object sending method and device
US20170139813A1 (en) Method and device for checking influence of deleting cache file, and mobile terminal
US11436188B2 (en) Resource optimization and update method, server, and device
JP6715334B2 (en) GPU resource reconstruction method, user device, system and storage medium
CN104461641A (en) Data burning and writing method, system and equipment and target equipment
CN104063284B (en) The method and apparatus running application program
CN104021058A (en) Method for quickly starting test board card
US20150112946A1 (en) Computing device and data recovery method for distributed file system
CN105893394B (en) Large file simulation method and device
CN107357717B (en) Method, device and equipment for detecting configuration errors
US20110202903A1 (en) Apparatus and method for debugging a shared library
CN111367710B (en) eMMC problem reduction method and device
CN106909484B (en) System and method for simulating bad disk test in storage environment
CN106611138B (en) GHOST file security check method and device
CN106254806A (en) A kind of Video data guard method and device
CN111370049B (en) eMMC chip testing method and device
CN110413800B (en) Method and equipment for providing novel information
CN114356218A (en) Data error correction method, device and medium for Flash memory
CN111260401B (en) Method and device for displaying presentation information on reading page
CN103593290B (en) A kind of method and device testing software stability
CN111966545A (en) PCIe deconcentrator hot plug test method, device, equipment and storage medium
CN113835912B (en) Crash information processing method and device for application program
CN105102083A (en) Data processing method, apparatus and system
CN111367540B (en) eMMC firmware upgrading method and device

Legal Events

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