Processing Aggregation Data in DTrace

Aggregations have two sets of records: the key (or keys) and the value corresponding to the key (or keys). The following example shows a sample dtrace_aggdesc_t structure.

typedef struct dtrace_aggdesc {
        DTRACE_PTR(char, dtagd_name);           /* not filled in by kernel */
        dtrace_aggvarid_t dtagd_varid;          /* not filled in by kernel */
        int dtagd_flags;                        /* not filled in by kernel */
        dtrace_aggid_t dtagd_id;                /* aggregation ID */
        dtrace_epid_t dtagd_epid;               /* enabled probe ID */
        uint32_t dtagd_size;                    /* size in bytes */
        int dtagd_nrecs;                        /* number of records */
        uint32_t dtagd_pad;                     /* explicit padding */
        dtrace_recdesc_t dtagd_rec[1];          /* record descriptions */
} dtrace_aggdesc_t;

The dtagd_nrecs member of this structure specifies the number of record descriptions in the dtagd_rec array. dtagd_rec[1] through dtagd_rec[dtagd_nrecs - 2] contains the record description for the keys. The dtagd_rec[0] does not contain a key. The final record in this array, dtagd_rec[dtagd_nrecs - 1], is the record description for the value. The values for these aggregations are stored as simple values. The formats for the different value types are as follows:

count()

dtrd_action == DTRACEAGG_COUNT

sum()

dtrd_action == DTRACEAGG_SUM

min()

dtrd_action == DTRACEAGG_MIN

max()

dtrd_action == DTRACEAGG_MAX