[DTrace-devel] min() and max() aggregation map initialization

david.mclean at oracle.com david.mclean at oracle.com
Wed Dec 2 19:46:42 PST 2020


I noticed during my testing that min() and max() need to be initialized 
to non-zero values before they are used.
For example, it is a problem if the initialized value is zero for max() 
and after that only negative values are fed to max() -- the result will 
be a value of zero falsely populating the final mapped values with an 
incorrectly large value.

Eugene pointed me to using dt_bpf_map_update() to populate these 
initialization values, but I don't know where in the code base I would 
want to issue the function to initialize the values.  I've been spending 
my time in the aggs and _impl functions and I don't know my way around 
enough to easily find the preferred place for the call.

My guess is I should add something toward the end of 
dt_bpf_gmap_create(), maybe right after the other dt_bpf_map_update() 
call, and find a way to detect which maps belong to min() or max() 
aggregations.

I figure for min() I would want to initialize to the highest value 
(0x7FFFFFFFFFFFFFFF) and for max() I should initialize the lowest value 
(0x8000000000000000).

Some guidance to speed this up would be appreciated.



More information about the DTrace-devel mailing list