Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In the DTrace port to BPF, the initial support for aggregations had the kernel maintaining aggregations in a per-CPU BPF map that was statically allocated and managed. Each aggregation had its own region of per-CPU memory. That is, run-time aggregation keys were not supported. To support aggregation keys, switch to a per-CPU BPF hash map. The hash map key comprises: *) the aggregation variable ID *) the aggregation keys (if any) *) a 64-bit zero (to conform to dynamic variable "tuples") On the producer (dt_cg.c) side: *) Use the existing dt_cg_arglist() to process the aggregation keys and produce the BPF hash map key. *) Call the new dt_get_agg() to get a pointer to the aggregation data in the BPF hash map. The function call will create the element if needed, increment the data counter, and advance the pointer to the actual data. *) Push this pointer to the stack. *) Call the aggregation function: compute the value to be aggregated and pop the stack for the pointer to where the aggregation data is. *) Record the aggregation description (e.g., sizes of keys and data) if not already done. This step is performed during code generation, though it does not generate code per se. On the consumer (dt_aggregate.c) side, to snapshot aggregation data: *) Use dt_bpf_map_next_key() to walk the keys of the BPF hash map. *) For each hash map key, read the aggregation data on all CPUs. *) For each CPU with a nonzero data counter value, check dt_aggregate's user-space hash table for this key-specific aggregation. Initialize or aggregate the user-space data accordingly. Signed-off-by: Eugene Loh <eugene.loh@oracle.com> Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com> Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
- Loading branch information