[DTrace-devel] [PATCH 28/61] Complete the conversion of DTRACEAGG_* enums to DT_AGG_* enums
Kris Van Hees
kris.van.hees at oracle.com
Tue Aug 2 03:15:43 UTC 2022
On Fri, Jul 08, 2022 at 10:45:12AM -0400, eugene.loh--- via DTrace-devel wrote:
> From: Eugene Loh <eugene.loh at oracle.com>
>
> In commit 85c8512318e3
> ("Implement the support code for generating aggregation data"),
> the enums DT_AGG_* were introduced.
>
> In commit ecbe2271e2bb
> ("Implementation of the printa() action"),
> the DT_AGG_* were rebased to be offset from DTRACEACT_AGGREGATION.
>
> In commit ecbe2271e2bb
> ("Implementation of the printa() action"),
> the older DTRACEAGG_* enums that remained were said to be replaced
> by the newer DT_AGG_*.
>
> In fact, however, instances of DTRACEAGG_* remained. This was an
> issue since the enums were defined in different orders, causing
> corresponding values such as DT_AGG_QUANTIZE and DTRACEAGG_QUANTIZE
> to disagree. These problems were in code that was not yet active --
> e.g., to print two quantize() results for the same aggregation variable
> but with different keys.
>
> Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>
... queued for dev
> ---
> include/dtrace/actions_defines.h | 9 ---------
> libdtrace/dt_aggregate.c | 20 ++++++++++----------
> libdtrace/dt_cc.c | 6 +++---
> libdtrace/dt_printf.c | 2 +-
> 4 files changed, 14 insertions(+), 23 deletions(-)
>
> diff --git a/include/dtrace/actions_defines.h b/include/dtrace/actions_defines.h
> index 3dcf25cf..a58cec68 100644
> --- a/include/dtrace/actions_defines.h
> +++ b/include/dtrace/actions_defines.h
> @@ -97,15 +97,6 @@
> */
>
> #define DTRACEACT_AGGREGATION 0x0700
> -#define DTRACEAGG_COUNT (DTRACEACT_AGGREGATION + 1)
> -#define DTRACEAGG_MIN (DTRACEACT_AGGREGATION + 2)
> -#define DTRACEAGG_MAX (DTRACEACT_AGGREGATION + 3)
> -#define DTRACEAGG_AVG (DTRACEACT_AGGREGATION + 4)
> -#define DTRACEAGG_SUM (DTRACEACT_AGGREGATION + 5)
> -#define DTRACEAGG_STDDEV (DTRACEACT_AGGREGATION + 6)
> -#define DTRACEAGG_QUANTIZE (DTRACEACT_AGGREGATION + 7)
> -#define DTRACEAGG_LQUANTIZE (DTRACEACT_AGGREGATION + 8)
> -#define DTRACEAGG_LLQUANTIZE (DTRACEACT_AGGREGATION + 9)
>
> #define DTRACE_QUANTIZE_NBUCKETS \
> (((sizeof(uint64_t) * NBBY) - 1) * 2 + 1)
> diff --git a/libdtrace/dt_aggregate.c b/libdtrace/dt_aggregate.c
> index 1b875ea8..4a675366 100644
> --- a/libdtrace/dt_aggregate.c
> +++ b/libdtrace/dt_aggregate.c
> @@ -803,30 +803,30 @@ dt_aggregate_valcmp(const void *lhs, const void *rhs)
> raddr = (int64_t *)(uintptr_t)(rdata + rrec->dtrd_offset);
>
> switch (lrec->dtrd_action) {
> - case DTRACEAGG_AVG:
> + case DT_AGG_AVG:
> rval = dt_aggregate_averagecmp(laddr, raddr);
> break;
>
> - case DTRACEAGG_STDDEV:
> + case DT_AGG_STDDEV:
> rval = dt_aggregate_stddevcmp(laddr, raddr);
> break;
>
> - case DTRACEAGG_QUANTIZE:
> + case DT_AGG_QUANTIZE:
> rval = dt_aggregate_quantizedcmp(laddr, raddr);
> break;
>
> - case DTRACEAGG_LQUANTIZE:
> + case DT_AGG_LQUANTIZE:
> rval = dt_aggregate_lquantizedcmp(laddr, raddr);
> break;
>
> - case DTRACEAGG_LLQUANTIZE:
> + case DT_AGG_LLQUANTIZE:
> rval = dt_aggregate_llquantizedcmp(laddr, raddr);
> break;
>
> - case DTRACEAGG_COUNT:
> - case DTRACEAGG_SUM:
> - case DTRACEAGG_MIN:
> - case DTRACEAGG_MAX:
> + case DT_AGG_COUNT:
> + case DT_AGG_SUM:
> + case DT_AGG_MIN:
> + case DT_AGG_MAX:
> rval = dt_aggregate_countcmp(laddr, raddr);
> break;
>
> @@ -1094,7 +1094,7 @@ dt_aggwalk_rval(dtrace_hdl_t *dtp, dt_ahashent_t *h, int rval)
> size = rec->dtrd_size;
> data = &h->dtahe_data;
>
> - if (rec->dtrd_action == DTRACEAGG_LQUANTIZE) {
> + if (rec->dtrd_action == DT_AGG_LQUANTIZE) {
> offs = sizeof(uint64_t);
> size -= sizeof(uint64_t);
> }
> diff --git a/libdtrace/dt_cc.c b/libdtrace/dt_cc.c
> index 84cd5a9e..e3166647 100644
> --- a/libdtrace/dt_cc.c
> +++ b/libdtrace/dt_cc.c
> @@ -1071,7 +1071,7 @@ dt_compile_agg(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
> ap->dtad_kind = DTRACEACT_DIFEXPR;
> }
>
> - if (fid->di_id == DTRACEAGG_LQUANTIZE) {
> + if (fid->di_id == DT_AGG_LQUANTIZE) {
> /*
> * For linear quantization, we have between two and four
> * arguments in addition to the expression:
> @@ -1206,7 +1206,7 @@ dt_compile_agg(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
> argmax = 5;
> }
>
> - if (fid->di_id == DTRACEAGG_LLQUANTIZE) {
> + if (fid->di_id == DT_AGG_LLQUANTIZE) {
> /*
> * For log linear quantization, we have four
> * arguments in addition to the expression:
> @@ -1388,7 +1388,7 @@ dt_compile_agg(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
> argmax = 6;
> }
>
> - if (fid->di_id == DTRACEAGG_QUANTIZE) {
> + if (fid->di_id == DT_AGG_QUANTIZE) {
> incr = dnp->dn_aggfun->dn_args->dn_list;
> argmax = 2;
> }
> diff --git a/libdtrace/dt_printf.c b/libdtrace/dt_printf.c
> index 7e9c0982..f0c09178 100644
> --- a/libdtrace/dt_printf.c
> +++ b/libdtrace/dt_printf.c
> @@ -983,7 +983,7 @@ dt_printf_validate(dt_pfargv_t *pfv, uint_t flags,
> * an aggregation result conversion, which -- for all but count() --
> * is a signed quantity.
> */
> - if (kind != DTRACEAGG_COUNT)
> + if (kind != DT_AGG_COUNT)
> aggtype = "int64_t";
> else
> aggtype = "uint64_t";
> --
> 2.18.4
>
>
> _______________________________________________
> 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