A kind of method and system assessing packaging file readwrite performance
Technical field
The present invention relates to the assessment of file read-write performance, a kind of method assessing packaging file readwrite performance and be
System.
Background technology
Existing software client resource generally uses packing manner to store, thus obtain that transmission is convenient, resource secrecy and
The more quickly advantage such as access speed.In packaging file, multiple package-in file can be stored, but these package-in files are in reality
The operating readwrite performance of program then lacks effective method and is estimated it, thus cannot know the reading effect of packaging file
Rate.If packaging file is after repeatedly updating, its reading efficiency the most more cannot be known.To this end, traditional approach is by calculating
In reading packaging file, the time of All Files is as the mode of assessment reading efficiency, but uses the computer of different performance to carry out
During assessment, the time result of calculating is inevitable different, hence it is evident that the fairness that impact judges.And, institute in this reading packaging file
Documentary mode is quite lost time, since it is desired that the file all solutions in all packaging files is pressed out.For this reason, it may be necessary to
A kind of new assessment mode.
Summary of the invention
For solving the problems referred to above, it is an object of the invention to provide a kind of method assessing packaging file readwrite performance and be
System, by the readwrite performance of file identification assessment packaging file, makes assessment objective and accurate.
The present invention solves its problem and be the technical scheme is that
The present invention uses a kind of method and system assessing packaging file readwrite performance, firstly generates a sequential file,
This sequential file includes the file identification being described described packaging file according to certain logical order, due to files-designated
Some mark in knowledge possibly cannot find in packaging file, some marks or repeat, accordingly, it would be desirable to sequence
The file identification that file is comprised arranges, and when arranging, deletes those files-designated that cannot find in packaging file
Know, delete those file identifications repeated simultaneously, when deleting the file identification repeated, deletion file identification sorts posterior
Mark.
After arranging the file identification included in sequential file, then the readwrite performance of needs assessment packaging file, beats
APMB package includes many files, is successively read file identification, in packaging file, find out the file of correspondence simultaneously, if
The file currently found out deviant in packaging file is equal to inclined in packaging file of the previous file found out
Shifting value and size sum thereof, then explanation file identification corresponding to current file is preferable mark;For first literary composition read
Part identifies, and judges whether it is preferable mark by the way of arranging initial value, if the file corresponding to this file identification exists
Deviant in packaging file is equal to initial value, illustrates that it is preferable mark.File identification therein can be unduplicated literary composition
Part name, file relative path, file absolute path or file path cryptographic Hash etc..
Finally, calculate ideal mark and account for the ratio of sequential file All Files mark, weigh packaging file with this ratio
Readwrite performance.
The invention has the beneficial effects as follows:
The present invention uses a kind of method and system assessing packaging file readwrite performance, by the files-designated in sequential file
Know the readwrite performance judging packaging file, more objective during calculating, will not be affected by computing power;Meanwhile, whole side
Method is simple, relatively time-consuming, and owing to file identification is generated in advance, therefore, the accuracy of result of calculation also compares
High.
Accompanying drawing explanation
The invention will be further described with example below in conjunction with the accompanying drawings.
Fig. 1 is the flow chart of the method for the invention.
Detailed description of the invention
Embodiment 1:
With reference to the flow chart of the method for the invention shown in Fig. 1, the invention provides a kind of assessment packaging file read-write property
The method of energy, firstly generates sequential file, and this sequential file contains and enters described packaging file according to certain logical order
The file identification of line description, these file identifications may pass through Program Generating, it is also possible to is actively entered by programmer, or passes through
HOOK program reads logic and generates.
File identification owing to generating may include repetition or unnecessary, so-called repetition, refers to same files-designated
Know more than one, so-called unnecessary, refer to that file identification cannot find in packaging file.Accordingly, it would be desirable to the files-designated generated
Know and arrange, delete file identification that is unnecessary and that repeat.For unnecessary file identification, All Files in scanning packaging file
File identification, by included in sequential file All Files identify make a look up in the file identification scanned, if
Do not find, then illustrate that it does not lies in packaging file, be deleted;When deleting the file identification repeated, due to file
Mark is according to certain reading order arrangement, sorts at file identification below accordingly, it would be desirable to delete, and before being retained in
File identification, and only retain one.When deleting the file identification of unnecessary and repetition, optimum order is first to delete to repeat
File identification, the workload of minimizing postorder that so can be preferential, time-consuming.
After file identification in sequential file is arranged, then need the property by these file identifications assessment packaging file
Energy.The file identification being successively read in sequential file, searches the file identification that read corresponding in packaging file simultaneously
File, if the deviant of the deviant of the current file found and the previous file found and size sum phase thereof
Deng, then recording the file identification corresponding to this current file is ideal mark.During owing to reading first file identification, there is no institute
The previous file mark of meaning, accordingly, it would be desirable to judge whether first file identification is preferable mark by arranging initial value, if
The deviant of the file corresponding to first file identification is equal to initial value, then illustrate that it is preferable mark.When implementing,
Two enumerators can be set, enumerator one for for ideal mark counting, enumerator two for record found current
The deviant of file and its size sum, arrange initial value for enumerator two, the file identification being successively read in sequential file, when
When reading first file identification, search the file that this file identification is corresponding in packaging file, if the file found exists
Deviant in packaging file is equal to initial value, then illustrate that it is preferable mark, then enumerator one adds 1, meanwhile, by enumerator two
Value be set to the deviant in packaging file of the file corresponding to first file identification and size sum thereof, afterwards, read
Second file identification, searches this file identification file in packaging file, if the deviant of the file found and meter
The value of number device two is equal, then second file identification of explanation is preferable mark, and enumerator one adds 1 again, arranges enumerator simultaneously
The value of two is deviant and the size sum of file corresponding to second file identification, the like, until all of files-designated
Recognition takes complete.
Finally, the number calculating ideal mark accounts for the ratio of the mark of All Files in sequential file, ratio value 0 to 1 it
Between, this numerical value has i.e. reacted the readwrite performance of packaging file, and data are the highest, then show that readwrite performance is the best.
For file identification, unduplicated filename, file relative path, file absolute path or file road can be selected
Footpath cryptographic Hash etc., as long as the mark of different file is unique.
The invention provides a kind of system assessing packaging file readwrite performance, including:
For the device of formation sequence file, described sequential file includes according to certain logical order described packing
The file identification that file is described;
For deleting the file identification that cannot find in packaging file in described sequential file, delete sequence literary composition simultaneously
The device of the file identification repeated in part, wherein, during the file identification repeated in deleting sequential file, deletes sequence posterior
File identification, retains the preceding file identification that sorts;
For the file identification being successively read in sequential file, search the file identification read in packaging file simultaneously
Corresponding file, if the deviant that the current file found is in packaging file is being beaten with the previous file found
Deviant and size sum thereof in APMB package are equal, then recording the file identification corresponding to this current file is preferable mark
Device, wherein, for first file identification read, judges read first literary composition by the way of arranging initial value
Part identifies whether to identify into ideal, if the deviant of read first file corresponding to file identification and initial value phase
With, then record it for ideal mark;
The device of the ratio of All Files mark in sequential file is accounted for for calculating preferable mark.
Wherein, the All Files in described packaging file is scanned, obtains the file identification of All Files, by inciting somebody to action
File identification in sequential file contrasts with acquired file identification, cannot pack to delete in described sequential file
The file identification found in file.
Described system uses the method identical with the above to be estimated packaging file, referring in particular in above method
Described content.
Embodiment 2:
Method in embodiment 1 is illustrated by the present embodiment by object lesson, and wherein sequential file is as follows:
This sequential file includes three file identifications successively, is followed successively by a.txt, b.txt, c.txt.In packaging file
The file comprised is as follows:
Wherein, deviant have recorded respective file offset address in packaging file, and file size indicates this file
Size.
After arranging the file identification in sequential file, file identification is followed successively by a.txt, b.txt, c.txt, because of it
In there is no repetition and unnecessary file identification.
The initial value of enumerator two is set to 0, and typically when packaging file stores, the deviant of its first file is
0, therefore, when arranging the initial value of enumerator two, it should at the beginning of carrying out according to the deviant of first file in packaging file
Beginningization.
The file identification being successively read in sequential file, first of reading is a.txt, finds its deviant and initial value
Identical, illustrate that it is preferable mark, enumerator one adds 1, by big with it for the deviant that the value of enumerator two is set to respective file
Little sum, i.e. " 0 "+" 100 ";Afterwards, reading second file identification b.txt, its deviant is in 100, with enumerator two
Be worth identical, illustrate that it is preferable mark, then enumerator one adds 1 again, the value of enumerator two is set to simultaneously " 100 "+
“200”;Reading the 3rd file identification c.txt, its deviant is that in 310, with enumerator two, the numerical value of 300 is unequal, explanation
It is not preferable mark, and the value of enumerator two is set to " 310 "+" 90 " simultaneously;So far, all of file identification has read
Finish, then the number calculating ideal mark accounts for the ratio of All Files mark, i.e. 2/3, therefore " assessment result "=2/3=0.66.
The above, simply presently preferred embodiments of the present invention, the invention is not limited in above-mentioned embodiment, as long as
It reaches the technique effect of the present invention with identical means, all should belong to protection scope of the present invention.