1 # -*- tab-width: 4 -*- ;; Emacs
2 # vi: set filetype=sh tabstop=8 shiftwidth=8 noexpandtab :: Vi/ViM
3 ############################################################ IDENT(1)
5 # $Title: dwatch(8) module for dtrace_io(4) $
6 # $Copyright: 2014-2018 Devin Teske. All rights reserved. $
9 ############################################################ DESCRIPTION
11 # Display activity related to disk I/O
13 ############################################################ PROBE
16 io) : ${PROBE:=io:::start, io:::done} ;;
17 *) : ${PROBE:=io:::${PROFILE#io-}}
20 ############################################################ EVENT ACTION
22 [ "$CUSTOM_TEST" ] || EVENT_TEST='this->devinfo.dev_name != ""'
24 ############################################################ ACTIONS
27 this bufinfo_t bufinfo;
28 this devinfo_t devinfo;
32 this string bio_flags;
33 this string device_entry;
34 this string device_if;
35 this string device_type;
38 inline string append_bio_flag[int flags, int flag] = this->bio_flags =
39 strjoin(this->bio_flags,
40 strjoin(this->bio_flags == "" ? "" : (flags & flag) == flag ? "|" : "",
41 bio_flag_string[flags & flag]));
43 $PROBE /(struct bio *)args[0] != NULL/ /* probe ID $ID */
50 this->flow = probefunc == "done" ? "<-" : "->";
55 this->bufinfo = xlate <bufinfo_t> ((struct bio *)args[0]);
56 this->bio_cmd = bio_cmd_string[(int)this->bufinfo.b_cmd];
57 this->b_flags = (int)this->bufinfo.b_flags;
58 this->bio_flags = bio_flag_string[this->b_flags & BIO_ERROR];
59 this->bio_flags = strjoin(this->bio_flags, this->bufinfo.b_error ?
60 strjoin(this->bio_flags == "" ?
61 bio_flag_string[BIO_ERROR] : "",
62 strjoin("#", lltostr(this->bufinfo.b_error))) :
64 append_bio_flag[this->b_flags, BIO_DONE];
65 append_bio_flag[this->b_flags, BIO_ONQUEUE];
66 append_bio_flag[this->b_flags, BIO_ORDERED];
67 append_bio_flag[this->b_flags, BIO_UNMAPPED];
68 append_bio_flag[this->b_flags, BIO_TRANSIENT_MAPPING];
69 append_bio_flag[this->b_flags, BIO_VLIST];
70 this->bio_flags = this->bio_flags == "" ? "-" : this->bio_flags;
71 this->bio_length = (long)this->bufinfo.b_bcount;
76 this->devinfo = xlate <devinfo_t> ((struct devstat *)args[1]);
77 this->device_type = device_type[(int)this->devinfo.dev_type];
78 this->device_if = device_if[(int)this->devinfo.dev_type];
79 this->device_entry = strjoin(this->devinfo.dev_name,
80 lltostr(this->devinfo.dev_minor));
86 ############################################################ EVENT DETAILS
88 if [ ! "$CUSTOM_DETAILS" ]; then
91 * Print disk I/O details
93 printf("%s %s %s %s %s %s %d byte%s",
101 this->bio_length == 1 ? "" : "s");
103 EVENT_DETAILS=$( cat <&9 )
106 ################################################################################
108 ################################################################################