mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 15:48:19 +00:00
Measurement framework is ready for testing.
- New, expanded API. - Calculations moved into plugins. - Scripts using measurement framework ported. - Updated the script-land queue implementation to make it more generic. -
This commit is contained in:
parent
93eca70e6b
commit
b477d2b02d
11 changed files with 183 additions and 186 deletions
|
@ -1,3 +1,4 @@
|
|||
@load base/utils/queue
|
||||
|
||||
module Measurement;
|
||||
|
||||
|
@ -29,7 +30,10 @@ hook add_to_reducer_hook(r: Reducer, val: double, data: DataPoint, rv: ResultVal
|
|||
{
|
||||
if ( ! rv?$sample_queue )
|
||||
rv$sample_queue = Queue::init([$max_len=r$samples]);
|
||||
Queue::push(rv$sample_queue, data$str);
|
||||
if ( ! rv?$samples )
|
||||
rv$samples = vector();
|
||||
Queue::put(rv$sample_queue, data);
|
||||
Queue::get_vector(rv$sample_queue, rv$samples);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,12 @@ function sum_threshold(data_id: string): threshold_function
|
|||
};
|
||||
}
|
||||
|
||||
hook init_resultval_hook(r: Reducer, rv: ResultVal)
|
||||
{
|
||||
if ( SUM in r$apply && ! rv?$sum )
|
||||
rv$sum = 0;
|
||||
}
|
||||
|
||||
hook add_to_reducer_hook(r: Reducer, val: double, data: DataPoint, rv: ResultVal)
|
||||
{
|
||||
if ( SUM in r$apply )
|
||||
|
|
|
@ -10,7 +10,7 @@ export {
|
|||
redef record ResultVal += {
|
||||
## If cardinality is being tracked, the number of unique
|
||||
## items is tracked here.
|
||||
unique: count &optional;
|
||||
unique: count &default=0;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue