diff options
author | Martin Matuska <mm@FreeBSD.org> | 2012-07-18 09:16:47 +0000 |
---|---|---|
committer | Martin Matuska <mm@FreeBSD.org> | 2012-07-18 09:16:47 +0000 |
commit | 77225241cd47b9d06c05bd568fc057328c0c65e5 (patch) | |
tree | 7b21d952f88eed0f80743c1b974b35495a428e72 /lib/libdtrace/common/dt_aggregate.c | |
parent | 5bb19a17c049cd92ccbd811a6bd0daf69ac899c1 (diff) | |
parent | 93a00b0821525e25814cd720fafd04d600811c28 (diff) |
Notes
Diffstat (limited to 'lib/libdtrace/common/dt_aggregate.c')
-rw-r--r-- | lib/libdtrace/common/dt_aggregate.c | 89 |
1 files changed, 1 insertions, 88 deletions
diff --git a/lib/libdtrace/common/dt_aggregate.c b/lib/libdtrace/common/dt_aggregate.c index bb766f71c466..2e66250b88d7 100644 --- a/lib/libdtrace/common/dt_aggregate.c +++ b/lib/libdtrace/common/dt_aggregate.c @@ -24,9 +24,7 @@ * Use is subject to license terms. */ -/* - * Copyright (c) 2011, Joyent, Inc. All rights reserved. - */ +#pragma ident "%Z%%M% %I% %E% SMI" #include <stdlib.h> #include <strings.h> @@ -206,83 +204,6 @@ dt_aggregate_lquantizedcmp(int64_t *lhs, int64_t *rhs) return (0); } -static void -dt_aggregate_llquantize(int64_t *existing, int64_t *new, size_t size) -{ - int i; - - for (i = 1; i < size / sizeof (int64_t); i++) - existing[i] = existing[i] + new[i]; -} - -static long double -dt_aggregate_llquantizedsum(int64_t *llquanta) -{ - int64_t arg = *llquanta++; - uint16_t factor = DTRACE_LLQUANTIZE_FACTOR(arg); - uint16_t low = DTRACE_LLQUANTIZE_LOW(arg); - uint16_t high = DTRACE_LLQUANTIZE_HIGH(arg); - uint16_t nsteps = DTRACE_LLQUANTIZE_NSTEP(arg); - int bin = 0, order; - int64_t value = 1, next, step; - long double total; - - assert(nsteps >= factor); - assert(nsteps % factor == 0); - - for (order = 0; order < low; order++) - value *= factor; - - total = (long double)llquanta[bin++] * (long double)(value - 1); - - next = value * factor; - step = next > nsteps ? next / nsteps : 1; - - while (order <= high) { - assert(value < next); - total += (long double)llquanta[bin++] * (long double)(value); - - if ((value += step) != next) - continue; - - next = value * factor; - step = next > nsteps ? next / nsteps : 1; - order++; - } - - return (total + (long double)llquanta[bin] * (long double)value); -} - -static int -dt_aggregate_llquantizedcmp(int64_t *lhs, int64_t *rhs) -{ - long double lsum = dt_aggregate_llquantizedsum(lhs); - long double rsum = dt_aggregate_llquantizedsum(rhs); - int64_t lzero, rzero; - - if (lsum < rsum) - return (DT_LESSTHAN); - - if (lsum > rsum) - return (DT_GREATERTHAN); - - /* - * If they're both equal, then we will compare based on the weights at - * zero. If the weights at zero are equal, then this will be judged a - * tie and will be resolved based on the key comparison. - */ - lzero = lhs[1]; - rzero = rhs[1]; - - if (lzero < rzero) - return (DT_LESSTHAN); - - if (lzero > rzero) - return (DT_GREATERTHAN); - - return (0); -} - static int dt_aggregate_quantizedcmp(int64_t *lhs, int64_t *rhs) { @@ -661,10 +582,6 @@ hashnext: h->dtahe_aggregate = dt_aggregate_lquantize; break; - case DTRACEAGG_LLQUANTIZE: - h->dtahe_aggregate = dt_aggregate_llquantize; - break; - case DTRACEAGG_COUNT: case DTRACEAGG_SUM: case DTRACEAGG_AVG: @@ -932,10 +849,6 @@ dt_aggregate_valcmp(const void *lhs, const void *rhs) rval = dt_aggregate_lquantizedcmp(laddr, raddr); break; - case DTRACEAGG_LLQUANTIZE: - rval = dt_aggregate_llquantizedcmp(laddr, raddr); - break; - case DTRACEAGG_COUNT: case DTRACEAGG_SUM: case DTRACEAGG_MIN: |