Small updates to hopefully correct reporter errors leading to lost memory.

This commit is contained in:
Seth Hall 2013-04-12 09:28:38 -04:00
parent a615601269
commit e93fd69cf2
4 changed files with 16 additions and 12 deletions

View file

@ -4,16 +4,16 @@
module Measurement;
export {
redef record Reducer += {
## A number of sample DataPoints to collect.
samples: count &default=0;
};
redef record ResultVal += {
# This is the queue where samples
# are maintained. Use the :bro:see:`Measurement::get_samples`
## function to get a vector of the samples.
## This is the queue where samples
## are maintained. Use the
## :bro:see:`Measurement::get_samples` function
## to get a vector of the samples.
samples: Queue::Queue &optional;
};

View file

@ -11,7 +11,7 @@ export {
redef record ResultVal += {
## For numeric data, this calculates the standard deviation.
std_dev: double &optional;
std_dev: double &default=0.0;
};
}
@ -28,8 +28,6 @@ hook add_to_reducer_hook(r: Reducer, val: double, data: DataPoint, rv: ResultVal
{
if ( rv?$variance )
calc_std_dev(rv);
else
rv$std_dev = 0.0;
}
}

View file

@ -44,7 +44,8 @@ hook add_to_reducer_hook(r: Reducer, val: double, data: DataPoint, rv: ResultVal
# Reduced priority since this depends on the average
hook compose_resultvals_hook(result: ResultVal, rv1: ResultVal, rv2: ResultVal) &priority=-5
{
if ( rv1?$var_s && rv2?$var_s )
if ( rv1?$var_s && rv1?$average &&
rv2?$var_s && rv2?$average )
{
local rv1_avg_sq = (rv1$average - result$average);
rv1_avg_sq = rv1_avg_sq*rv1_avg_sq;