Summary of the invention
The technical matters that the present invention will solve is; A kind of file look ahead dynamic quantitative indicating means and device are proposed; Not only can indicate the current file state of behavior of looking ahead, and can indicate the file recently continuous history performance of behavior of looking ahead, simple, intuitive; Computing is simple, and conserve storage effectively.
In order to solve the problems of the technologies described above, the present invention proposes a kind of file dynamic quantitative indicating means of looking ahead, and comprising:
Judging whether current candidate predicts the outcome predicts the outcome identically with last candidate, if identical, then current count value carried out accumulating operation or tired and subtracts computing; If inequality, then current count value is changed to preset value.
Further, said method also can have following characteristics:
Said candidate predicts the outcome and comprises that the candidate predicts correct and candidate's prediction error;
Judging that current candidate predicts the outcome to the candidate predicts correctly, and predicting the outcome when identical, to current count value execution accumulating operation with last candidate; Be candidate's prediction error judging that current candidate predicts the outcome, and predict the outcome when identical, current count value is carried out the tired computing that subtracts with last candidate; Perhaps
Judging that current candidate predicts the outcome to the candidate predicts correctly, and predicting the outcome when identical, current count value is carried out to tire out subtracting computing with last candidate; Be candidate's prediction error judging that current candidate predicts the outcome, and predict the outcome when identical, current count value is carried out accumulating operation with last candidate.
Further, said method also can have following characteristics:
Said preset value comprises that a candidate predicts the initial value of correct initial value and candidate's prediction error;
Judging that current candidate predicts the outcome to the candidate predicts correctly, and predicting the outcome when inequality, then current count value is being changed to said candidate and predicts correct initial value with last candidate; Be candidate's prediction error judging that current candidate predicts the outcome, and predict the outcome when inequality, then current count value is changed to the initial value of said candidate's prediction error with last candidate.
Further, said method also can have following characteristics:
Predict the outcome and predict the outcome identically when then carrying out accumulating operation with last candidate in that current candidate is set, it is 0 or one positive number that the initial value that this candidate predicts the outcome is set;
Predict the outcome to predict the outcome with last candidate and identically then carry out tiredly when subtracting computing in that current candidate is set, it is 0 or one negative that the initial value that this candidate predicts the outcome is set;
The initial value that different candidates predict the outcome is different.
Further, said method also can have following characteristics:
The incremental gradient of said accumulating operation is identical or different with the said tired gradient of successively decreasing that subtracts computing.
In order to solve the problems of the technologies described above, the present invention also proposes a kind of file dynamic quantitative indicating device of looking ahead, and comprises a judge module and a counting module, wherein:
Said judge module predicts the outcome identically in order to judge that whether current candidate predicts the outcome with last candidate, and judged result is sent to said counting module;
Said counting module in order to predicting the outcome when identical with last candidate knowing that current candidate predicts the outcome, is carried out accumulating operation or tired to current count value and is subtracted computing; And, current count value is changed to preset value knowing that current candidate predicts the outcome and last candidate predicts the outcome when inequality.
Further, said apparatus also can have following characteristics:
Said candidate predicts the outcome and comprises that the candidate predicts correct and candidate's prediction error;
Said counting module is knowing that current candidate predicts the outcome to the candidate predicts correctly, and predicts the outcome when identical with last candidate, and current count value is carried out accumulating operation; Be candidate's prediction error knowing that current candidate predicts the outcome, and predict the outcome when identical, current count value is carried out the tired computing that subtracts with last candidate; Perhaps
Said counting module is knowing that current candidate predicts the outcome to the candidate predicts correctly, and predicts the outcome when identical with last candidate, and current count value is carried out the tired computing that subtracts; Be candidate's prediction error knowing that current candidate predicts the outcome, and predict the outcome when identical, current count value is carried out accumulating operation with last candidate.
Further, said apparatus also can have following characteristics:
Said preset value comprises that a candidate predicts the initial value of correct initial value and candidate's prediction error;
Said counting module is knowing that current candidate predicts the outcome to the candidate predicts correctly, and predicts the outcome when inequality with last candidate, current count value is changed to said candidate predicts correct initial value; Be candidate's prediction error knowing that current candidate predicts the outcome, and predict the outcome when inequality, current count value is changed to the initial value of said candidate's prediction error with last candidate.
Further, said apparatus also can have following characteristics:
Said counting module predicts the outcome and predicts the outcome identically when then carrying out accumulating operation with last candidate in that current candidate is set, and it is 0 or one positive number that the initial value that this candidate predicts the outcome is set; And predict the outcome to predict the outcome with last candidate and identically then carry out tiredly when subtracting computing in that current candidate is set, it is 0 or one negative that the initial value that this candidate predicts the outcome is set; The initial value that different candidates predict the outcome is different.
Further, said apparatus also can have following characteristics:
The incremental gradient of said accumulating operation is identical or different with the said tired gradient of successively decreasing that subtracts computing.
A kind of file that the present invention proposes look ahead dynamic quantitative indicating means and device; Not only can indicate the current file state of behavior of looking ahead, and can indicate the file recently continuous history performance of behavior of looking ahead, simple, intuitive; Computing is simple, and conserve storage effectively.
Embodiment
At first, the concept that relates in the embodiment of the invention is made an explanation:
The candidate predicts (Candidate Prediction): the prediction about the follow-up access file of a file that is meant that certain file prediction algorithm provides.Said certain file prediction algorithm can be the prediction algorithm of choosing as required, specifically can be Last Successor algorithm, Static Successor algorithm, RecentPopularity algorithm or the like.
Confidence level counting (Reliable Count): be meant certain candidate is predicted P
AB(the follow-up access file of for example predicting the A file is B) correct or wrong number of times is counted.Certain candidate predicts P
ABBe meant that correctly the candidate predicts P
ABConform to the actual access sequence of file, promptly the follow-up access file of A is B really.Otherwise, if the candidate predicts P
ABDo not conform to the actual access sequence of file, promptly the follow-up access file of A is not B, then thinks P
ABPrediction error.
Degree of confidence: certain the instantaneous value that is the confidence level counting.In embodiments of the present invention, degree of confidence has reflected that the candidate predicts P
ABCurrent estimated performance comprises P
ABCurrent predicting the outcome and the continuous historical performance in a period of time recently.
To combine accompanying drawing to specify embodiment of the present invention below.
Referring to Fig. 1, the figure shows a kind of file of embodiment of the invention dynamic quantitative indicating means of looking ahead, comprise the steps:
Step S101: judge current candidate whether predict the outcome with last candidate predict the outcome identical, if identical, execution in step S102 then; If inequality, execution in step S103 then;
Step S102: current count value is carried out accumulating operation or tired subtract computing;
Step S103: current count value is changed to preset value.
Said candidate predicts the outcome and comprises that the candidate predicts correct and candidate's prediction error.Specifically, can be:
Judging that current candidate predicts the outcome to the candidate predicts correctly, and predicting the outcome when identical, to current count value execution accumulating operation with last candidate; Be candidate's prediction error judging that current candidate predicts the outcome, and predict the outcome when identical, current count value is carried out the tired computing that subtracts with last candidate; Perhaps
Judging that current candidate predicts the outcome to the candidate predicts correctly, and predicting the outcome when identical, current count value is carried out to tire out subtracting computing with last candidate; Be candidate's prediction error judging that current candidate predicts the outcome, and predict the outcome when identical, current count value is carried out accumulating operation with last candidate.
Preferably, said preset value comprises that a candidate predicts the initial value of correct initial value and candidate's prediction error.Judging that current candidate predicts the outcome to the candidate predicts correctly, and predicting the outcome when inequality, then current count value is being changed to said candidate and predicts correct initial value with last candidate; Be candidate's prediction error judging that current candidate predicts the outcome, and predict the outcome when inequality, then current count value is changed to the initial value of said candidate's prediction error with last candidate.
Preferably, can predict the outcome and predict the outcome identically when then carrying out accumulating operation with last candidate in that current candidate is set, it is 0 or one positive number that the initial value that this candidate predicts the outcome is set; And predict the outcome to predict the outcome with last candidate and identically then carry out tiredly when subtracting computing in that current candidate is set, it is 0 or one negative that the initial value that this candidate predicts the outcome is set.Wherein, the initial value that predicts the outcome of different candidates is different.
Preferably, the incremental gradient of said accumulating operation is identical or different with the said tired gradient of successively decreasing that subtracts computing.
Adopt the above-mentioned file of the present invention dynamic quantitative indicating means of looking ahead; When carrying out the confidence level counting, be not to carry out according to the file prediction result simply to add up or tiredly subtract computing, but predict the outcome when identical with last predicting the outcome through ingenious design; Execution adds up or tires out and subtracts computing; When inequality, directly saltus step is a preset value, thereby directly both can indicate current file prediction result through degree of confidence; Can indicate the file prediction result in recently continuous history performance again, but also reach the effect of conserve storage.
Referring to Fig. 2, the figure shows the look ahead a kind of concrete implementation algorithm of dynamic quantitative indicating means of file of the present invention.Predict P for a candidate
AB, adopt these computing method to indicate P with degree of confidence
ABCurrent working condition and recently continuous history performance: the confidence level counting of new candidate's prediction is changed to 0 expression original state, correct P continuously
ABTo cause reliable_count to increase progressively, wrong continuously P
ABTo cause reliable_count to successively decrease.Increase progressively or successively decrease and all represent a kind of constant trend, therefore promptly correct continuously or mistake continuously, can indicate current candidate to predict the outcome and recent history performance through degree of confidence.For example, degree of confidence equals 5, then indicates current candidate to predict correctly, and continuous 5 predictions all are correct, need not take too much storage space and indicate nearest 5 prediction result respectively.In the method, if continuous correct P
ABOnce mistake occurred, its reliable_count is changed to-1 rapidly so, expression P
ABWrong continuously number of times is 1; If wrong continuously P
ABOccurred once correctly, its reliable_count is changed to 1 so, expression P
ABCorrect number of times is 1 continuously.
Quantitative evaluation is carried out in each prediction that the present invention can provide the file prefetching algorithm (LS (Last Successor), SS (StaticSuccessor), RP (Recent Popularity) etc.) of current main-stream.Degree of confidence is to the look ahead basis of behavior modeling of file, has important directive significance for look ahead modeling and improvement in performance of file.In addition, the present invention not only can implement to the prediction algorithm of file granularity, and the present invention can also have important directive significance for the modeling of other behaviors of looking ahead (other field beyond the file prefetching algorithm of other granularities or the field of filesystems).
In order to realize said method, the present invention also provides a kind of file dynamic quantitative indicating device of looking ahead, and is as shown in Figure 3, comprises a judge module and a counting module, wherein:
Said judge module predicts the outcome identically in order to judge that whether current candidate predicts the outcome with last candidate, and judged result is sent to said counting module;
Said counting module in order to predicting the outcome when identical with last candidate knowing that current candidate predicts the outcome, is carried out accumulating operation or tired to current count value and is subtracted computing; And, current count value is changed to preset value knowing that current candidate predicts the outcome and last candidate predicts the outcome when inequality.
Further:
Said candidate predicts the outcome and comprises that the candidate predicts correct and candidate's prediction error.
Said counting module is knowing that current candidate predicts the outcome to the candidate predicts correctly, and predicts the outcome when identical with last candidate, and current count value is carried out accumulating operation; Be candidate's prediction error knowing that current candidate predicts the outcome, and predict the outcome when identical, current count value is carried out the tired computing that subtracts with last candidate; Perhaps
Said counting module is knowing that current candidate predicts the outcome to the candidate predicts correctly, and predicts the outcome when identical with last candidate, and current count value is carried out the tired computing that subtracts; Be candidate's prediction error knowing that current candidate predicts the outcome, and predict the outcome when identical, current count value is carried out accumulating operation with last candidate.
Further, said preset value comprises that a candidate predicts the initial value of correct initial value and candidate's prediction error.Said counting module is knowing that current candidate predicts the outcome to the candidate predicts correctly, and predicts the outcome when inequality with last candidate, current count value is changed to said candidate predicts correct initial value; Be candidate's prediction error knowing that current candidate predicts the outcome, and predict the outcome when inequality, current count value is changed to the initial value of said candidate's prediction error with last candidate.
Further, said counting module predicts the outcome and predicts the outcome identically when then carrying out accumulating operation with last candidate in that current candidate is set, and it is 0 or one positive number that the initial value that this candidate predicts the outcome is set; And predict the outcome to predict the outcome with last candidate and identically then carry out tiredly when subtracting computing in that current candidate is set, it is 0 or one negative that the initial value that this candidate predicts the outcome is set; The initial value that different candidates predict the outcome is different.
Further, the incremental gradient of said accumulating operation is identical or different with the said tired gradient of successively decreasing that subtracts computing.
The present invention gives following concrete application example and further specifies said method of the present invention:
Application example 1
The confidence level counting is set to 0 expression original state.The candidate predicts that correct initial value is 1, and the initial value of candidate's prediction error is-1.Continue to judge that correctly and whether whether current candidate's prediction predict the outcome identically with last candidate, carries out according to judged result: current candidate predicts correctly in judgement, and predicts the outcome when identical with last candidate, confidence level is counted add 1; Judging current candidate's prediction error, and predicting the outcome when identical, the confidence level counting is being subtracted 1 with last candidate.Judging that current candidate predicts correctly, and predicting the outcome not simultaneously, the confidence level counting is being changed to-1 with last candidate; Judging current candidate's prediction error, and predicting the outcome not simultaneously, the confidence level counting is being changed to 1 with last candidate.
For example, degree of confidence equals 5, then indicates current candidate to predict correctly, and continuous 5 predictions all are correct, need not take too much storage space and indicate nearest 5 prediction result respectively.Again for example, degree of confidence is-1, then indicates current candidate's prediction error, and the number of times of prediction error is 1 continuously.
Application example 2
The confidence level counting is set to 0 expression original state.The candidate predicts that correct initial value is-1, and the initial value of candidate's prediction error is 1.Continue to judge that correctly and whether whether current candidate's prediction predict the outcome identically with last candidate, carries out according to judged result: current candidate predicts correctly in judgement, and predicts the outcome when identical with last candidate, confidence level is counted subtract 1; Judging current candidate's prediction error, and predicting the outcome when identical, the confidence level counting is being added 1 with last candidate.Judging that current candidate predicts correctly, and predicting the outcome not simultaneously, the confidence level counting is being changed to 1 with last candidate; Judging current candidate's prediction error, and predicting the outcome not simultaneously, the confidence level counting is being changed to-1 with last candidate.
For example, degree of confidence equals 5, then indicates current candidate's prediction error, and continuous 5 predictions all are wrong, need not take too much storage space and indicate nearest 5 prediction result respectively.Again for example, degree of confidence is-1, then indicates current candidate to predict correctly, predicts that continuously correct number of times is 1.
Application example 3
The confidence level counting is set to 0 expression original state.The candidate predicts that correct and wrong initial value is 0.Continue to judge that correctly and whether whether current candidate's prediction predict the outcome identically with last candidate, carries out according to judged result: current candidate predicts correctly in judgement, and predicts the outcome when identical with last candidate, confidence level is counted add 1; Judging current candidate's prediction error, and predicting the outcome when identical, the confidence level counting is being subtracted 1 with last candidate.Judging that current candidate predicts correctly, and predicting the outcome not simultaneously, the confidence level counting is being changed to 0 with last candidate; Judging current candidate's prediction error, and predicting the outcome not simultaneously, the confidence level counting is being changed to 0 with last candidate.
For example, degree of confidence equals 5, then indicates current candidate to predict correctly, and continuous 6 predictions all are correct, need not take too much storage space and indicate nearest 6 prediction result respectively.Again for example, degree of confidence is 0, then indicates current candidate to predict the outcome and last candidate predicts the outcome inequality.
Application example 4
The confidence level counting is set to 0 expression original state.The candidate predicts that correct initial value is 2, and the initial value of candidate's prediction error is-2.Continue to judge that correctly and whether whether current candidate's prediction predict the outcome identically with last candidate, carries out according to judged result: current candidate predicts correctly in judgement, and predicts the outcome when identical with last candidate, confidence level is counted add 2; Judging current candidate's prediction error, and predicting the outcome when identical, the confidence level counting is being subtracted 2 with last candidate.Judging that current candidate predicts correctly, and predicting the outcome not simultaneously, the confidence level counting is being changed to-2 with last candidate; Judging current candidate's prediction error, and predicting the outcome not simultaneously, the confidence level counting is being changed to 2 with last candidate.
For example, degree of confidence equals 6, then indicates current candidate to predict correctly, and continuous 3 predictions all are correct, need not take too much storage space and indicate nearest 3 prediction result respectively.Again for example, degree of confidence is-2, then indicates current candidate's prediction error, and the number of times of prediction error is 1 continuously.
Certainly; The present invention also can have other various embodiments; Under the situation that does not deviate from spirit of the present invention and essence thereof; Those skilled in the art work as can make various corresponding changes and distortion according to the present invention, but these corresponding changes and distortion all should belong to the protection domain of the appended claim of the present invention.