mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 16:48:19 +00:00
Small updates to hopefully correct reporter errors leading to lost memory.
This commit is contained in:
parent
a615601269
commit
e93fd69cf2
4 changed files with 16 additions and 12 deletions
|
@ -293,14 +293,19 @@ function add_data(id: string, key: Key, point: DataPoint)
|
|||
key = r$normalize_key(copy(key));
|
||||
|
||||
local m = measurement_store[r$mid];
|
||||
local results = result_store[m$id];
|
||||
|
||||
if ( r$mid !in result_store )
|
||||
result_store[m$id] = table();
|
||||
local results = result_store[r$mid];
|
||||
|
||||
if ( key !in results )
|
||||
results[key] = table();
|
||||
if ( id !in results[key] )
|
||||
results[key][id] = init_resultval(r);
|
||||
|
||||
local result = results[key];
|
||||
|
||||
if ( id !in result )
|
||||
result[id] = init_resultval(r);
|
||||
local result_val = result[id];
|
||||
|
||||
++result_val$num;
|
||||
# Continually update the $end field.
|
||||
result_val$end=network_time();
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue