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_ip(4) $
6 # $Copyright: 2014-2018 Devin Teske. All rights reserved. $
9 ############################################################ DESCRIPTION
11 # Display interface name and bytes sent/received when IP I/O occurs
13 ############################################################ PROBE
16 ip) : ${PROBE:=ip:::send, ip:::receive} ;;
17 *) : ${PROBE:=ip:::${PROFILE#ip-}}
20 ############################################################ GLOBALS
23 # This profile does not support these dwatch features
24 # NB: They are disabled here so they have no effect when profile is loaded
26 unset EXECNAME # -k name
27 unset EXECREGEX # -z regex
28 unset GROUP # -g group
30 unset PSARGS # affects -d
34 ############################################################ ACTIONS
44 $PROBE /* probe ID $ID */
51 this->recv = probename == "receive" ? 1 : 0;
52 this->flow = this->recv ? "<-" : "->";
57 this->length = (uint32_t)args[2]->ip_plength;
58 this->local = this->recv ? args[2]->ip_daddr : args[2]->ip_saddr;
59 this->remote = this->recv ? args[2]->ip_saddr : args[2]->ip_daddr;
64 this->if_name = args[3]->if_name;
70 ############################################################ EVENT TAG
73 printf("%s: ", "$PROFILE");
75 EVENT_TAG=$( cat <&9 )
77 ############################################################ EVENT DETAILS
81 * Print network I/O details
83 printf("%s %s %s %s %u byte%s",
89 this->length == 1 ? "" : "s");
91 EVENT_DETAILS=$( cat <&9 )
93 ################################################################################
95 ################################################################################