Summary of the invention
One object of the present invention is to provide the method for the behavior of two kinds of filters, these two kinds of methods are used for the non-characteristic behavior of the program that filtered out before the behavior of monitoring or routine analyzer, to reduce of the interference of non-characteristic behavior to monitoring or analysis, reduce the treatment capacity of computing machine, the accuracy that improves monitoring and analyze.
For this reason, the method of the behavior of first kind of filter provided by the invention, may further comprise the steps: step S1, structure behavior sample storehouse, described behavior sample storehouse comprise the weight that the frequency of occurrences based on this kind behavior sample of behavior sample from some program sample collections, each behavior sample is calculated; Step S2, obtain pending program behavior, judge whether described behavior sample storehouse exists the behavior sample identical with described program behavior,, just keep described program behavior if there be not the behavior sample identical with described program behavior in described behavior sample storehouse; If described behavior sample stock at the behavior sample identical with described program behavior, just judges whether the weight of described behavior sample falls into default filtration threshold range, just filter out described program behavior if fall into, otherwise, just keep described program behavior.
Compared with prior art, the present invention is before monitoring or analyzer behavior, according to the behavior sample in the behavior sample storehouse, default filtration threshold range to filtering out non-characteristic behavior wherein, reduced of the interference of non-characteristic behavior to monitoring or analysis, reduced the treatment capacity of computing machine, the accuracy that has improved monitoring and analyzed
In described behavior sample storehouse, the frequency of occurrences of each behavior sample is the ratio that the total amount of the quantity of program sample of this kind behavior sample and all program samples occurs, or the occurrence number of this kind behavior sample in all program samples and the ratio of the behavior sample total amount that comprises of all program samples; The weight of behavior sample is the frequency of occurrences of this kind behavior sample; The step whether described weight of judging behavior sample falls into default filtration threshold range is specially: if the frequency of occurrences of described behavior sample just is judged to be and falls into described default filtration threshold range greater than default filtration threshold value lower limit.In this preferred version, judge according to the frequency of occurrences whether certain program behavior belongs to the non-characteristic behavior that needs filter out, because the excessive behavior of the frequency of occurrences belongs to the non-characteristic behavior with classification or analysis significance usually, therefore, this preferred version filters out these non-characteristic behaviors according to default filtration threshold value lower limit.This preferred version is simple, and calculated amount is little, realizes easily.
The difference of the method for the behavior of the method for the behavior of second kind of filter provided by the invention and first kind of filter is: in described behavior sample storehouse, the frequency of occurrences of each behavior sample is the ratio that the total amount of the quantity of program sample of this kind behavior sample and all program samples occurs, or the occurrence number of this kind behavior sample in all program samples and the ratio of the behavior sample total amount that comprises of all program samples; The weight of behavior sample is the inverse document frequency of this kind behavior sample, and the inverse document frequency of behavior sample equals the logarithm of inverse of the frequency of occurrences of this kind behavior sample; The step whether described weight of judging behavior sample falls into default filtration threshold range is specially: if the inverse document frequency of described behavior sample just is judged to be and falls into described default filtration threshold range less than default filtration upper threshold.In this preferred version, judge according to inverse document frequency whether certain behavior belongs to the non-characteristic behavior that needs filter out, in field of statistics, inverse document frequency is a kind of important parameter of measuring correlativity, value of generally acknowledging.Usually, the too small behavior of inverse document frequency belongs to the non-characteristic behavior with classification or analysis significance usually, and therefore, this preferred version filters out these non-characteristic behaviors according to default filtration upper threshold.This preferred version adopts inverse document frequency to discern and filter out " non-characteristic behavior ", better effects if, and filter result is more reliable.
Preferably, in the method for the behavior of the method for the behavior of first kind of filter and second kind of filter, described behavior sample storehouse also comprises the total amount of all program samples, the total amount of all behavior samples; Described method also comprises upgrades described behavior sample storehouse, described renewal comprises: if there be not the behavior sample identical with described program behavior in the behavior sample storehouse described in the step S2, then after step S2, described program behavior is added in the described behavior sample storehouse as new behavior sample, upgrade the program sample in described behavior sample storehouse total amount, behavior sample total amount and recomputate the weight of each behavior sample.In this preferred version, according to current disposition behavior sample to be upgraded timely, the content that makes the behavior sample storehouse comprise is wider, more comprehensively and more accurate, thereby further improved the accuracy of filtering.
Preferably, described renewal also comprises: if the behavior sample stock is at the behavior sample identical with described program behavior described in the step S2, then after step S2, upgrade the program sample in described behavior sample storehouse total amount, behavior sample total amount and recomputate the weight of each behavior sample.Similarly, in this preferred version, according to current disposition behavior sample is upgraded timely, the content that makes the behavior sample storehouse comprise is wider, more comprehensively and more accurate, thereby further improved the accuracy of filtering.
On the other hand, another goal of the invention of the present invention is to provide the method for the behavior of two kinds of watchdog routines, and these two kinds of methods can filter out the non-characteristic behavior of program, to reduce non-characteristic behavior to monitoring or the interference analyzed, reduce the treatment capacity of computing machine, the accuracy that improves monitoring and analyze.
For this reason, the method for the behavior of first kind of watchdog routine provided by the invention comprises: step S0: the program behavior of collecting monitored program; Step S4: analyze and monitor described program behavior; Between described step S0 and step S4, further comprising the steps of: step S1, structure behavior sample storehouse, described behavior sample storehouse comprise the weight that the frequency of occurrences based on this kind behavior sample of behavior sample from some program sample collections, each behavior sample is calculated; Step S2, obtain the program behavior of described monitored program, judge whether described behavior sample storehouse exists the behavior sample identical with described program behavior, if there be not the behavior sample identical with described program behavior in described behavior sample storehouse, just keep described program behavior; If described behavior sample stock at the behavior sample identical with described program behavior, just judges whether the weight of described behavior sample falls into default filtration threshold range, just filter out described program behavior if fall into, otherwise, just keep described program behavior.
Similarly, compared with prior art, the method of the behavior of watchdog routine provided by the invention is before the behavior of monitoring or routine analyzer, according to the behavior sample in the behavior sample storehouse, default filtration threshold range the behavior of program is compared, filter out non-characteristic behavior, thereby, reduced the treatment capacity of computing machine to reduce of the interference of non-characteristic behavior to monitoring or analysis, the accuracy that has improved monitoring and analyzed
In described behavior sample storehouse, the frequency of occurrences of each behavior sample is the ratio that the total amount of the quantity of program sample of this kind behavior sample and all program samples occurs, or the occurrence number of this kind behavior sample in all program samples and the ratio of the behavior sample total amount that comprises of all program samples; The weight of behavior sample is the frequency of occurrences of this kind behavior sample; The step whether described weight of judging behavior sample falls into default filtration threshold range is specially: if the frequency of occurrences of described behavior sample just is judged to be and falls into described default filtration threshold range greater than default filtration threshold value lower limit.In this preferred version, judge according to the frequency of occurrences whether certain behavior belongs to " non-characteristic behavior " that needs filter out, because the excessive behavior of the frequency of occurrences belongs to " the non-characteristic behavior " with classification or analysis significance usually, therefore, this preferred version filters out these non-characteristic behaviors according to default filtration threshold value lower limit.This preferred version is simple, and calculated amount is little, realizes easily.
The difference of the method for the behavior of the method for the behavior of second kind of watchdog routine provided by the invention and first kind of watchdog routine is: in described behavior sample storehouse, the frequency of occurrences of each behavior sample is the ratio that the total amount of the quantity of program sample of this kind behavior sample and all program samples occurs, or the occurrence number of this kind behavior sample in all program samples and the ratio of the behavior sample total amount that comprises of all program samples; The weight of behavior sample is the inverse document frequency of this kind behavior sample, and the inverse document frequency of behavior sample equals the logarithm of inverse of the frequency of occurrences of this kind behavior sample; The step whether described weight of judging behavior sample falls into default filtration threshold range is specially: if the inverse document frequency of described behavior sample just is judged to be and falls into described default filtration threshold range less than default filtration upper threshold.In this preferred version, judge according to inverse document frequency whether certain behavior belongs to the non-characteristic behavior that needs filter out, in field of statistics, inverse document frequency is a kind of important parameter of measuring correlativity, value of generally acknowledging.Usually, the too small behavior of inverse document frequency belongs to the non-characteristic behavior with classification or analysis significance usually, and therefore, this preferred version filters out these non-characteristic behaviors according to default filtration upper threshold.This preferred version adopts inverse document frequency to discern and filter out " non-characteristic behavior ", better effects if, and filter result is more reliable.
Preferably, in the method for the behavior of the method for the behavior of first kind of watchdog routine and second kind of watchdog routine, described behavior sample storehouse also comprises the total amount of all program samples, the total amount of all behavior samples; Described method also comprises upgrades described behavior sample storehouse, described renewal comprises: if there be not the behavior sample identical with described program behavior in the behavior sample storehouse described in the step S2, then after step S2, described program behavior is added in the described behavior sample storehouse as new behavior sample, upgrade the program sample in described behavior sample storehouse total amount, behavior sample total amount and recomputate the weight of each behavior sample.In this preferred version, according to current disposition behavior sample to be upgraded timely, the content that makes the behavior sample storehouse comprise is wider, more comprehensively and more accurate, thereby further improved the accuracy of filtering.
Preferably, described renewal also comprises: if the behavior sample stock is at the behavior sample identical with described program behavior described in the step S2, then after step S2, upgrade the program sample in described behavior sample storehouse total amount, behavior sample total amount and recomputate the weight of each behavior sample.Similarly, in this preferred version, according to current disposition behavior sample is upgraded timely, the content that makes the behavior sample storehouse comprise is wider, more comprehensively and more accurate, thereby further improved the accuracy of filtering.
Embodiment
The present invention relates to monitor or the behavioral approach of routine analyzer, especially relate to the method that before the behavior of monitoring or routine analyzer, filters out the non-characteristic behavior of program.Implement the present invention, can reduce of the interference of non-characteristic behavior, reduce the treatment capacity of computing machine, the accuracy that improves monitoring and analyze monitoring or analysis.
For this reason, at first construct the behavior sample storehouse, described behavior sample storehouse comprises the weight that the frequency of occurrences based on this kind behavior sample of behavior sample from some program sample collections, each behavior sample is calculated.Wherein, the weight of behavior sample is used for representing value, correlativity or the importance of this behavior.Weight can be but the probability of occurrence that is not limited to the frequency of occurrences, estimates according to the frequency of occurrences, perhaps inverse document frequency.Further, the frequency of occurrences of behavior sample can be the ratio that the total amount of the quantity of program sample of this kind behavior sample and all program samples occurs.For example, if in the process in structure behavior sample storehouse, collected the behavior sample of 100 program samples, if there are 30 program samples behavior sample A to occur, so, the frequency of occurrences of behavior sample A is 30/100=30%.Alternatively, the frequency of occurrences of behavior sample also can be the occurrence number of this kind behavior sample in all program samples and the ratio of the behavior sample total amount that comprises of all program samples, for example, in above-mentioned example, if described 100 program samples have 9000 behavior samples altogether, and the occurrence number of behavior sample A is 2500 times, and so, the frequency of occurrences of behavior sample A is 2500/9000 ≈ 27.8%.
After construct in the behavior sample storehouse, can be used for program behavior is filtered.Particularly, obtain pending program behavior earlier, judge whether described behavior sample storehouse exists the behavior sample identical with described program behavior,, just keep described program behavior if there be not the behavior sample identical with described program behavior in described behavior sample storehouse; If described behavior sample stock at the behavior sample identical with described program behavior, just judges whether the weight of described behavior sample falls into default filtration threshold range, just filter out described program behavior if fall into, otherwise, just keep described program behavior.
Below in conjunction with accompanying drawing the present invention is set forth in more detail.
Embodiment one
Fig. 1 is the process flow diagram in structure behavior sample storehouse in the one embodiment of the invention, and Fig. 2 uses the process flow diagram that filter the behavior of program in behavior sample storehouse shown in Figure 1.
As shown in Figure 1, after the beginning step S100, in step S102, collect the behavior of a large amount of program samples, obtain a large amount of behavior samples, and write down the total amount D of collected behavior sample.According to Principle of Statistics, the scale of sample is big more, and the statistics that obtains is more near actual value.Therefore, in the process in structure behavior sample storehouse, preferably collect the behavior sample of program sample as much as possible.Those skilled in the art will realize that the existing technology of utilizing, can collect the behavior of a large amount of program samples by modes such as intercept point are set, for example to file read-write operation, to the registration table read-write operation etc.
Then, among the step S104, calculate the occurrence number D of behavior sample
Wi, wherein, D
WiRepresent the number of times of i kind behavior sample in appearing at described behavior sample storehouse, obviously, D
WiThe number of the behavior sample identical in the as many as behavior sample storehouse with i kind behavior sample.
Then, among the step S106, calculate the frequency of occurrences f of behavior sample
i, wherein, f
iRepresent the frequency of i kind behavior sample in appearing at described behavior sample storehouse, the frequency f of behavior sample among the i
iEqual the occurrence number D of this kind behavior sample
WiWith the ratio of the total amount D of behavior sample in the behavior sample storehouse, i.e. f
i=D
Wi/ D.As mentioned above, frequency of occurrences fi is as a kind of manifestation mode of behavior sample, is used to represent correlativity, importance of this behavior sample etc.Obviously, 0≤fi≤1, and f
iThe frequency of occurrences or the probability of occurrence of big more this kind of expression behavior sample are high more.As mentioned above, though in this embodiment, with certain behavior sample in all program samples occurrence number and the ratio of the behavior sample total amount that comprises of all program samples as the frequency of occurrences of this kind behavior sample, but the ratio of total amount that the quantity of program sample of certain behavior sample and all program samples also will occur is as the frequency of occurrences of this kind behavior sample.
Calculated the frequency of occurrences f of all behavior samples
iAfterwards, preserve total amount D, the occurrence number D of each behavior sample of above-mentioned behavior sample
WiAnd frequency of occurrences f
i, just finished the structure in behavior sample storehouse, shown in step S108.
Then, as shown in Figure 2, when practical application, after beginning step S200, in step S201, collect or read the program behavior that needs processing.Equally, those skilled in the art will realize that the existing technology of utilizing, can collect the behavior of a large amount of program samples by modes such as intercept point are set, for example to file read-write operation, to the registration table read-write operation etc.
Then, among the step S202, judge whether described behavior sample storehouse exists the behavior sample identical with described program behavior.If there is no, just illustrate that this program behavior is a kind of new program behavior or the lower program behavior of the frequency of occurrences, do not belong to non-characteristic behavior, therefore, keep this program behavior, so that in the subsequent step this program behavior is handled (for example monitor, analyze or monitor), shown in step S205.
Otherwise, if find among the step S202 that the behavior sample stock at the behavior sample identical with described program behavior, just further reads the frequency of occurrences of this identical behavior sample, as step S203.
Then, after the step S203, judge in step S204 whether this frequency of occurrences falls into default filtration threshold range.As mentioned above, because the high more program behavior of frequency just may belong to non-characteristic behavior more, therefore, if the frequency of occurrences of certain program behavior is greater than default filtration threshold value lower limit, shown in step S206, just can filter out this program behavior with this program behavior as non-characteristic behavior.Like this, in the follow-up treatment scheme, no longer need to this program behavior analyze, monitor, monitoring etc., reduced the treatment capacity in later stage effectively, and reduced this non-characteristic behavior monitoring or the interference analyzed, the accuracy that has improved monitoring and analyzed.
On the contrary, if in step S204, the frequency of occurrences of finding this this program behavior does not fall into default filtration threshold range, that is to say, if this frequency of occurrences is less than default filtration threshold value lower limit, the frequency of occurrences that this program behavior just is described is lower, do not belong to non-characteristic behavior, therefore, flow process enters step S205, in step S205, keep this program behavior, so that in the subsequent step this program behavior is handled (for example monitor, analyze or monitor).
Step S205 and step S206 end at step S207, and so far, whole filtering process finishes.
In this embodiment, judge according to the frequency of occurrences whether certain behavior belongs to the non-characteristic behavior that needs filter out, if program behavior belongs to non-characteristic behavior, just filters out this program behavior,, improve the accuracy of subsequent treatment to alleviate follow-up treatment capacity.This scheme is simple, and calculated amount is little, realizes easily.
Embodiment two
Fig. 3 is the process flow diagram in structure behavior sample storehouse in the another embodiment of the present invention; Fig. 4 uses the process flow diagram that filter the behavior of program in behavior sample storehouse shown in Figure 3.
The flow process in structure behavior sample storehouse shown in Figure 3 and structure flow process shown in Figure 1 are similar.More specifically, step S300 shown in Figure 3 is identical to step S104 with step S100 shown in Figure 1 to step S304, be respectively the beginning step, collect a large amount of behavior samples and write down behavior sample total amount D, calculate the occurrence number D of each behavior sample
Wi
Then, among the step S306, calculate the inverse document frequency (IDF) of each behavior sample.As mentioned above, inverse document frequency is a kind of important parameter of measuring correlativity, value of generally acknowledging.The inverse document frequency IDF (i) of i kind behavior sample equals the logarithm of the inverse of the frequency of occurrences of this i kind behavior sample in behavior sample storehouse, that is:
Wherein, D is the total amount of the behavior sample in the behavior sample storehouse; D
WiIt is the number of times that the behavior of i kind occurred in behavior sample storehouse.Obviously, the IDF of certain behavior sample (i) and its frequency of occurrences (D
Wi/ D) be inversely proportional to, particularly, if i kind behavior sample occurs very frequently, the contrary text index IDF (i) of this behavior sample will be more little, and the minimum value of IDF (i) equals 0.Otherwise if i kind behavior sample occurs seldom, its IDF (i) will be high more.Therefore, when ID F (i) is lower than certain default filtration threshold value, can think that this behavior sample belongs to non-characteristic behavior, can be filtered.
Constructed after the behavior sample storehouse, just can utilize the behavior sample storehouse behavior of program is discerned and to be judged.Specifically as shown in Figure 4.
Step S400 shown in Figure 4 is basic identical to step S207 to step S407 and step S200 shown in Figure 2, and distinguishing slightly place is step S403 and step S404.Particularly, in step S403, what read is the IDF value of behavior sample identical with pending program sample in the behavior sample storehouse.And in step S404, if this IDF value less than default filtration upper threshold, just illustrates that this IDF value falls into default filtration threshold range, correspondingly, this program behavior belongs to non-characteristic behavior, can filter out (step S406); Otherwise flow process enters step S405 from step S404, promptly keep this program behavior, waits until follow-up processing (analyze, monitor or monitoring) etc.
In the scheme that present embodiment adopts, judge according to inverse document frequency whether certain behavior belongs to the non-characteristic behavior that needs filter out, in field of statistics, inverse document frequency is a kind of important parameter of measuring correlativity, value of generally acknowledging.Usually, the too small behavior of inverse document frequency belongs to the non-characteristic behavior with classification or analysis significance usually, and therefore, this preferred version filters out these non-characteristic behaviors according to default filtration upper threshold.This preferred version adopts inverse document frequency to discern and filter out non-characteristic behavior, better effects if, and filter result is more reliable.
In conjunction with the accompanying drawings the present invention is set forth above.Should recognize that the present invention not only can be used to filter out non-characteristic behavior, can also be applied in the monitoring to program, for example is applied in the fail-safe software.Particularly, after fail-safe software utilizes existing technology to obtain the behavior of monitored program, can utilize above-mentioned filter method to filter out wherein non-characteristic behavior, and then remaining program behavior be monitored according to existing method for supervising.Compared with prior art, the method of the behavior of this watchdog routine provided by the invention is before the behavior of monitoring or routine analyzer, according to the behavior sample in the behavior sample storehouse, default filtration threshold range the behavior of program is compared, filter out non-characteristic behavior, thereby to reduce of the interference of non-characteristic behavior to monitoring or analysis, reduced the treatment capacity of computing machine, the accuracy that has improved monitoring and analyzed.
As a kind of improvement to above-mentioned various embodiment, can also be termly or upgrade the behavior sample storehouse in real time.In order to upgrade the behavior sample storehouse better, the total amount of program sample, the information such as total amount D of behavior sample should stored in described behavior sample storehouse.When implementing, for example, if find that in step S202 shown in Figure 2 there be not the behavior sample identical with described program behavior in the behavior sample storehouse, so, can after flow process finishes, add to described program behavior in the described behavior sample storehouse as new behavior sample, the total amount of refresh routine sample, the information such as total amount D of described behavior sample, and recomputate the frequency of occurrences of each behavior sample.Again for example, if find that in step S402 shown in Figure 4 there be not the behavior sample identical with described program behavior in the behavior sample storehouse, so, can after flow process finishes, described program behavior be added in the described behavior sample storehouse as new behavior sample, upgrade the total amount D of described behavior sample and recomputate the inverse document frequency IDF of each behavior sample.Like this, by behavior sample is upgraded timely, the content that makes the behavior sample storehouse comprise is wider, more comprehensively and more accurate, thereby further improved the accuracy of filtering.
Similarly, if find among the step S202 shown in Figure 2 that the behavior sample stock is at the behavior sample identical with described program behavior, so, after flow process finishes, can upgrade the frequency of occurrences of the total amount D and the described identical behavior sample of described behavior sample, and recomputate the frequency of occurrences of each behavior sample.Similarly, if find among the step S402 shown in Figure 4 that the behavior sample stock is at the behavior sample identical with described program behavior, so, after flow process finishes, can upgrade the total amount D of described behavior sample and the inverse document frequency IDF of described identical behavior sample.In this preferred version, according to current disposition behavior sample to be upgraded timely, the content that makes the behavior sample storehouse comprise is wider, more comprehensively and more accurate, thereby further improved the accuracy of filtering.
Above-described embodiment of the present invention does not constitute the qualification to protection domain of the present invention.Any modification of being done within the spirit and principles in the present invention, be equal to and replace and improvement etc., all should be included within the claim protection domain of the present invention.