From 0b84437953783e7d5eac0e4d1fde15f86a7c273a Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Sun, 15 May 2016 12:09:26 +0200 Subject: [PATCH 089/325] share/dtrace: Add geli-request-monitor ... which shows the BIO commands GELI received, their bio lengths from the caller's point of view and the maximum number of commands in flight. Obtained from: ElectroBSD --- share/dtrace/Makefile | 1 + share/dtrace/geli-request-monitor | 91 +++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100755 share/dtrace/geli-request-monitor diff --git a/share/dtrace/Makefile b/share/dtrace/Makefile index 1297a3317dc8..2705e9a87e9b 100644 --- a/share/dtrace/Makefile +++ b/share/dtrace/Makefile @@ -10,6 +10,7 @@ SCRIPTS= blocking \ disklatencycmd \ fbt-time \ geli-key-monitor \ + geli-request-monitor \ hotopen \ look-who-is-reaping \ nfsattrstats \ diff --git a/share/dtrace/geli-request-monitor b/share/dtrace/geli-request-monitor new file mode 100755 index 000000000000..70336060057d --- /dev/null +++ b/share/dtrace/geli-request-monitor @@ -0,0 +1,91 @@ +#!/usr/sbin/dtrace -s + +/*************************************************************************** + * geli-request-monitor + * + * Shows the length distribution of various GELI commands from + * the callers point of view (that is, without geli overhead). + * + * Copyright (c) 2016-2017 Fabian Keil + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + ***************************************************************************/ + +#pragma D option quiet + +dtrace:::BEGIN +{ + bio_command[0x01] = "BIO_READ"; + bio_command[0x02] = "BIO_WRITE"; + bio_command[0x03] = "BIO_DELETE"; + bio_command[0x04] = "BIO_GETATTR"; + bio_command[0x05] = "BIO_FLUSH"; + bio_command[0x06] = "BIO_CMD0"; + bio_command[0x07] = "BIO_CMD1"; + bio_command[0x08] = "BIO_CMD2"; + bio_command[0x09] = "BIO_ZONE"; +} + +fbt::g_eli_auth_run:entry, +fbt::g_eli_crypto_run:entry +{ + this->bp = (struct bio *)arg1; + this->sc = (struct g_eli_softc *)this->bp->bio_to->geom->softc; + + this->geom_name = stringof(this->sc->sc_geom->name); + this->length = this->bp->bio_length; + this->inflight = this->sc->sc_inflight; + + this->bio_command = (bio_command[this->bp->bio_cmd] != NULL) ? + bio_command[this->bp->bio_cmd] : "Unregistered command"; + + @inflight_max[this->geom_name] = max(this->inflight); + @inflight_max_total[this->geom_name] = max(this->inflight); + + @length[this->geom_name, this->bio_command] = + lquantize(this->length, 4096, 1052672, 4096); + @length_total[this->geom_name, this->bio_command] = + lquantize(this->length, 4096, 1052672, 4096); +/* + printf("%s: Length: %d, Inflight: %d", this->bio_command, + this->length, this->inflight); +*/ + + stats_available = 1; +} + +tick-60s +/stats_available/ +{ + printf("------------------------------\n"); + printf("Max requests inflight:\n"); + printa(@inflight_max); + printf("\nbp->bio_length:\n"); + printa(@length); + trunc(@length); + trunc(@inflight_max); + stats_available = 0; +} + +END +{ + /* Explicitly ditch interval stats so they aren't printed */ + trunc(@length); + trunc(@inflight_max); + + printf("\n------------------------------\n"); + printf("Max requests inflight:\n"); + printa(@inflight_max_total); + printf("\nbp->bio_length:\n"); + printa(@length_total); +} -- 2.32.0