From 9d3a3c02a79326c28e44419299f9ac0d8ca96c16 Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Fri, 25 Aug 2017 10:30:37 +0200 Subject: [PATCH 189/325] Add share/dtrace/iosched-monitor (unfinished WIP) so it no longer gets listed as 'untracked' Obtained from: ElectroBSD --- share/dtrace/iosched-monitor | 87 ++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100755 share/dtrace/iosched-monitor diff --git a/share/dtrace/iosched-monitor b/share/dtrace/iosched-monitor new file mode 100755 index 000000000000..dca024a49dc7 --- /dev/null +++ b/share/dtrace/iosched-monitor @@ -0,0 +1,87 @@ +#!/usr/sbin/dtrace -s + +/*************************************************************************** + * iosched-monitor + * + * Monitors the behavior of the Dynamic I/O scheduler. + * + * Copyright (c) 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::cam_iosched_bio_complete:entry +{ + this->isc = args[0]; + this->bp = args[1]; + + this->bio_command = (bio_command[this->bp->bio_cmd] != NULL) ? + bio_command[this->bp->bio_cmd] : "Unregistered command"; +} + +fbt::cam_iosched_bio_complete:return +/this->isc && this->bio_command == "BIO_DELETE"/ +{ + printf("%Y: cam_iosched_bio_complete returned for BIO_DELETE. Pending trims: %d\n", + walltimestamp, this->isc->trim_stats.pending); +} + +fbt::cam_iosched_trim_done:entry +{ + this->isc = args[0]; + printf("%Y: cam_iosched_trim_done called. Pending trims: %d\n", + walltimestamp, this->isc->trim_stats.pending); +} + +fbt::cam_iosched_put_back_trim:entry +{ + this->isc = args[0]; +} + +fbt::cam_iosched_put_back_trim:return +/this->isc/ +{ + printf("%Y: cam_iosched_put_back returned. Pending trims: %d\n", + walltimestamp, this->isc->trim_stats.pending); +} + +fbt::cam_iosched_next_trim:entry +{ + this->isc = args[0]; +} + +fbt::cam_iosched_next_trim:return +/this->isc/ +{ + printf("%Y: cam_iosched_next_trim returned. Pending trims: %d\n", + walltimestamp, this->isc->trim_stats.pending); +} + +END +{ +} -- 2.32.0