[DTrace-devel] [PATCH 5/6] Implement associative array support

Eugene Loh eugene.loh at oracle.com
Tue Mar 8 23:38:54 UTC 2022


I know you're working on a v2 but just in case you haven't yet run 
across this yet:

# dtrace -qn 'BEGIN { x["foo"] = 1234; x["bar"            ] = 56789; 
trace(x["foo"]); exit(0)}'
1234
# dtrace -qn 'BEGIN { x["foo"] = 1234; x["long key in use"] = 56789; 
trace(x["foo"]); exit(0)}'
0

On 3/7/22 2:50 PM, Kris Van Hees via DTrace-devel wrote:

> Associative arrays (global or TLS) are variables that are indexed with
> a tuple (one or more values).  The underlying storage is provided by
> the dvar (dynamic variables) BPF hash map.  Since dvar elements are
> indexed using a unique 64-bit ID, and given that it provides storage
> for both regular TLS variables and associate array elements, the
> algorithms to calculate the ID are designed to provide orthogonal
> value ranges.



More information about the DTrace-devel mailing list