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

Eugene Loh eugene.loh at oracle.com
Wed Dec 2 21:01:20 PST 2020


Totally guessing here, but maybe it'll get you started.  Maybe where you 
describe, you can  dt_idhash_iter(dtp->dt_aggs,...). Then check the 
di_kind for each ident and look for DT_IDENT_AGG. If so, check di_id for 
what kind of aggregation it is.  If it's MIN or MAX, you can get the 
offset from di_offset, and then initialize both values (di_offset and 
di_offset + 8).  I've never done any of this, so I have no idea if it's 
right.


On 12/02/2020 07:46 PM, david.mclean at oracle.com wrote:
> 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.
>
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel




More information about the DTrace-devel mailing list