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_consume.c | |
parent | 5bb19a17c049cd92ccbd811a6bd0daf69ac899c1 (diff) | |
parent | 93a00b0821525e25814cd720fafd04d600811c28 (diff) |
Notes
Diffstat (limited to 'lib/libdtrace/common/dt_consume.c')
-rw-r--r-- | lib/libdtrace/common/dt_consume.c | 186 |
1 files changed, 3 insertions, 183 deletions
diff --git a/lib/libdtrace/common/dt_consume.c b/lib/libdtrace/common/dt_consume.c index d3a554c1c6b7b..564189a000adb 100644 --- a/lib/libdtrace/common/dt_consume.c +++ b/lib/libdtrace/common/dt_consume.c @@ -23,11 +23,6 @@ * Use is subject to license terms. */ -/* - * Copyright (c) 2011, Joyent, Inc. All rights reserved. - * Copyright (c) 2011 by Delphix. All rights reserved. - */ - #include <stdlib.h> #include <strings.h> #include <errno.h> @@ -686,121 +681,6 @@ dt_print_lquantize(dtrace_hdl_t *dtp, FILE *fp, const void *addr, return (0); } -int -dt_print_llquantize(dtrace_hdl_t *dtp, FILE *fp, const void *addr, - size_t size, uint64_t normal) -{ - int i, first_bin, last_bin, bin = 1, order, levels; - uint16_t factor, low, high, nsteps; - const int64_t *data = addr; - int64_t value = 1, next, step; - char positives = 0, negatives = 0; - long double total = 0; - uint64_t arg; - char c[32]; - - if (size < sizeof (uint64_t)) - return (dt_set_errno(dtp, EDT_DMISMATCH)); - - arg = *data++; - size -= sizeof (uint64_t); - - factor = DTRACE_LLQUANTIZE_FACTOR(arg); - low = DTRACE_LLQUANTIZE_LOW(arg); - high = DTRACE_LLQUANTIZE_HIGH(arg); - nsteps = DTRACE_LLQUANTIZE_NSTEP(arg); - - /* - * We don't expect to be handed invalid llquantize() parameters here, - * but sanity check them (to a degree) nonetheless. - */ - if (size > INT32_MAX || factor < 2 || low >= high || - nsteps == 0 || factor > nsteps) - return (dt_set_errno(dtp, EDT_DMISMATCH)); - - levels = (int)size / sizeof (uint64_t); - - first_bin = 0; - last_bin = levels - 1; - - while (first_bin < levels && data[first_bin] == 0) - first_bin++; - - if (first_bin == levels) { - first_bin = 0; - last_bin = 1; - } else { - if (first_bin > 0) - first_bin--; - - while (last_bin > 0 && data[last_bin] == 0) - last_bin--; - - if (last_bin < levels - 1) - last_bin++; - } - - for (i = first_bin; i <= last_bin; i++) { - positives |= (data[i] > 0); - negatives |= (data[i] < 0); - total += dt_fabsl((long double)data[i]); - } - - if (dt_printf(dtp, fp, "\n%16s %41s %-9s\n", "value", - "------------- Distribution -------------", "count") < 0) - return (-1); - - for (order = 0; order < low; order++) - value *= factor; - - next = value * factor; - step = next > nsteps ? next / nsteps : 1; - - if (first_bin == 0) { - (void) snprintf(c, sizeof (c), "< %lld", value); - - if (dt_printf(dtp, fp, "%16s ", c) < 0) - return (-1); - - if (dt_print_quantline(dtp, fp, data[0], normal, - total, positives, negatives) < 0) - return (-1); - } - - while (order <= high) { - if (bin >= first_bin && bin <= last_bin) { - if (dt_printf(dtp, fp, "%16lld ", (long long)value) < 0) - return (-1); - - if (dt_print_quantline(dtp, fp, data[bin], - normal, total, positives, negatives) < 0) - return (-1); - } - - assert(value < next); - bin++; - - if ((value += step) != next) - continue; - - next = value * factor; - step = next > nsteps ? next / nsteps : 1; - order++; - } - - if (last_bin < bin) - return (0); - - assert(last_bin == bin); - (void) snprintf(c, sizeof (c), ">= %lld", value); - - if (dt_printf(dtp, fp, "%16s ", c) < 0) - return (-1); - - return (dt_print_quantline(dtp, fp, data[bin], normal, - total, positives, negatives)); -} - /*ARGSUSED*/ static int dt_print_average(dtrace_hdl_t *dtp, FILE *fp, caddr_t addr, @@ -828,7 +708,7 @@ dt_print_stddev(dtrace_hdl_t *dtp, FILE *fp, caddr_t addr, /*ARGSUSED*/ int dt_print_bytes(dtrace_hdl_t *dtp, FILE *fp, caddr_t addr, - size_t nbytes, int width, int quiet, int forceraw) + size_t nbytes, int width, int quiet) { /* * If the byte stream is a series of printable characters, followed by @@ -841,9 +721,6 @@ dt_print_bytes(dtrace_hdl_t *dtp, FILE *fp, caddr_t addr, if (nbytes == 0) return (0); - if (forceraw) - goto raw; - if (dtp->dt_options[DTRACEOPT_RAWBYTES] != DTRACEOPT_UNSET) goto raw; @@ -1520,9 +1397,6 @@ dt_print_datum(dtrace_hdl_t *dtp, FILE *fp, dtrace_recdesc_t *rec, case DTRACEAGG_LQUANTIZE: return (dt_print_lquantize(dtp, fp, addr, size, normal)); - case DTRACEAGG_LLQUANTIZE: - return (dt_print_llquantize(dtp, fp, addr, size, normal)); - case DTRACEAGG_AVG: return (dt_print_average(dtp, fp, addr, size, normal)); @@ -1554,7 +1428,7 @@ dt_print_datum(dtrace_hdl_t *dtp, FILE *fp, dtrace_recdesc_t *rec, (uint32_t)normal); break; default: - err = dt_print_bytes(dtp, fp, addr, size, 50, 0, 0); + err = dt_print_bytes(dtp, fp, addr, size, 50, 0); break; } @@ -1709,7 +1583,6 @@ dt_consume_cpu(dtrace_hdl_t *dtp, FILE *fp, int cpu, dtrace_bufdesc_t *buf, int quiet = (dtp->dt_options[DTRACEOPT_QUIET] != DTRACEOPT_UNSET); int rval, i, n; dtrace_epid_t last = DTRACE_EPIDNONE; - uint64_t tracememsize = 0; dtrace_probedata_t data; uint64_t drops; caddr_t addr; @@ -1878,13 +1751,6 @@ again: } } - if (act == DTRACEACT_TRACEMEM_DYNSIZE && - rec->dtrd_size == sizeof (uint64_t)) { - /* LINTED - alignment */ - tracememsize = *((unsigned long long *)addr); - continue; - } - rval = (*rfunc)(&data, rec, arg); if (rval == DTRACE_CONSUME_NEXT) @@ -1976,35 +1842,6 @@ again: goto nextrec; } - /* - * If this is a DIF expression, and the record has a - * format set, this indicates we have a CTF type name - * associated with the data and we should try to print - * it out by type. - */ - if (act == DTRACEACT_DIFEXPR) { - const char *strdata = dt_strdata_lookup(dtp, - rec->dtrd_format); - if (strdata != NULL) { - n = dtrace_print(dtp, fp, strdata, - addr, rec->dtrd_size); - - /* - * dtrace_print() will return -1 on - * error, or return the number of bytes - * consumed. It will return 0 if the - * type couldn't be determined, and we - * should fall through to the normal - * trace method. - */ - if (n < 0) - return (-1); - - if (n > 0) - goto nextrec; - } - } - nofmt: if (act == DTRACEACT_PRINTA) { dt_print_aggdata_t pd; @@ -2073,23 +1910,6 @@ nofmt: goto nextrec; } - if (act == DTRACEACT_TRACEMEM) { - if (tracememsize == 0 || - tracememsize > rec->dtrd_size) { - tracememsize = rec->dtrd_size; - } - - n = dt_print_bytes(dtp, fp, addr, - tracememsize, 33, quiet, 1); - - tracememsize = 0; - - if (n < 0) - return (-1); - - goto nextrec; - } - switch (rec->dtrd_size) { case sizeof (uint64_t): n = dt_printf(dtp, fp, @@ -2113,7 +1933,7 @@ nofmt: break; default: n = dt_print_bytes(dtp, fp, addr, - rec->dtrd_size, 33, quiet, 0); + rec->dtrd_size, 33, quiet); break; } |