1*9fe48b80SGeorge V. Neville-Neil#!/usr/sbin/dtrace -s 2*9fe48b80SGeorge V. Neville-Neil/*- 3*9fe48b80SGeorge V. Neville-Neil * Copyright (c) 2015 George V. Neville-Neil 4*9fe48b80SGeorge V. Neville-Neil * All rights reserved. 5*9fe48b80SGeorge V. Neville-Neil * 6*9fe48b80SGeorge V. Neville-Neil * Redistribution and use in source and binary forms, with or without 7*9fe48b80SGeorge V. Neville-Neil * modification, are permitted provided that the following conditions 8*9fe48b80SGeorge V. Neville-Neil * are met: 9*9fe48b80SGeorge V. Neville-Neil * 1. Redistributions of source code must retain the above copyright 10*9fe48b80SGeorge V. Neville-Neil * notice, this list of conditions and the following disclaimer. 11*9fe48b80SGeorge V. Neville-Neil * 2. Redistributions in binary form must reproduce the above copyright 12*9fe48b80SGeorge V. Neville-Neil * notice, this list of conditions and the following disclaimer in the 13*9fe48b80SGeorge V. Neville-Neil * documentation and/or other materials provided with the distribution. 14*9fe48b80SGeorge V. Neville-Neil * 15*9fe48b80SGeorge V. Neville-Neil * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16*9fe48b80SGeorge V. Neville-Neil * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17*9fe48b80SGeorge V. Neville-Neil * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18*9fe48b80SGeorge V. Neville-Neil * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19*9fe48b80SGeorge V. Neville-Neil * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20*9fe48b80SGeorge V. Neville-Neil * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21*9fe48b80SGeorge V. Neville-Neil * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22*9fe48b80SGeorge V. Neville-Neil * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23*9fe48b80SGeorge V. Neville-Neil * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24*9fe48b80SGeorge V. Neville-Neil * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25*9fe48b80SGeorge V. Neville-Neil * SUCH DAMAGE. 26*9fe48b80SGeorge V. Neville-Neil * 27*9fe48b80SGeorge V. Neville-Neil * $FreeBSD$ 28*9fe48b80SGeorge V. Neville-Neil * 29*9fe48b80SGeorge V. Neville-Neil * The siftr D script collects data from the SIFTR kernel module. 30*9fe48b80SGeorge V. Neville-Neil * 31*9fe48b80SGeorge V. Neville-Neil * Usage: siftr 32*9fe48b80SGeorge V. Neville-Neil */ 33*9fe48b80SGeorge V. Neville-Neil 34*9fe48b80SGeorge V. Neville-Neil#pragma D option quiet 35*9fe48b80SGeorge V. Neville-Neiltcp:kernel::siftr 36*9fe48b80SGeorge V. Neville-Neil{ 37*9fe48b80SGeorge V. Neville-Neil printf("direction %s state %s local %d remote %d\n", 38*9fe48b80SGeorge V. Neville-Neil siftr_dir_string[args[0]->direction], 39*9fe48b80SGeorge V. Neville-Neil tcp_state_string[args[0]->conn_state], 40*9fe48b80SGeorge V. Neville-Neil args[0]->tcp_localport, 41*9fe48b80SGeorge V. Neville-Neil args[0]->tcp_foreignport); 42*9fe48b80SGeorge V. Neville-Neil printf("snd_cwnd %d snd_wnd %d rcv_wnd %d snd_bwnd %d snd_ssthresh %d\n", 43*9fe48b80SGeorge V. Neville-Neil args[0]->snd_cwnd, 44*9fe48b80SGeorge V. Neville-Neil args[0]->snd_wnd, 45*9fe48b80SGeorge V. Neville-Neil args[0]->rcv_wnd, 46*9fe48b80SGeorge V. Neville-Neil args[0]->snd_bwnd, 47*9fe48b80SGeorge V. Neville-Neil args[0]->snd_ssthresh); 48*9fe48b80SGeorge V. Neville-Neil printf("\tmax_seg_size %u smoothed_rtt %d sack_enabled %d\n", 49*9fe48b80SGeorge V. Neville-Neil args[0]->max_seg_size, 50*9fe48b80SGeorge V. Neville-Neil args[0]->smoothed_rtt, 51*9fe48b80SGeorge V. Neville-Neil args[0]->sack_enabled); 52*9fe48b80SGeorge V. Neville-Neil printf("\tsnd_scale %d rcv_scale %d flags 0x%x rxt_length %d\n", 53*9fe48b80SGeorge V. Neville-Neil args[0]->snd_scale, 54*9fe48b80SGeorge V. Neville-Neil args[0]->rcv_scale, 55*9fe48b80SGeorge V. Neville-Neil args[0]->flags, 56*9fe48b80SGeorge V. Neville-Neil args[0]->rxt_length); 57*9fe48b80SGeorge V. Neville-Neil printf("\tsnd_buf_hiwater %u snd_buf_cc %u rcv_buf_hiwater %u\n", 58*9fe48b80SGeorge V. Neville-Neil args[0]->snd_buf_hiwater, 59*9fe48b80SGeorge V. Neville-Neil args[0]->snd_buf_cc, 60*9fe48b80SGeorge V. Neville-Neil args[0]->rcv_buf_hiwater); 61*9fe48b80SGeorge V. Neville-Neil printf("\trcv_buf_cc %u sent_inflight_bytes %u t_segqlen %d\n", 62*9fe48b80SGeorge V. Neville-Neil args[0]->rcv_buf_cc, 63*9fe48b80SGeorge V. Neville-Neil args[0]->sent_inflight_bytes, 64*9fe48b80SGeorge V. Neville-Neil args[0]->t_segqlen); 65*9fe48b80SGeorge V. Neville-Neil printf("\tflowid %u flowtype %u\n", 66*9fe48b80SGeorge V. Neville-Neil args[0]->flowid, 67*9fe48b80SGeorge V. Neville-Neil args[0]->flowtype); 68*9fe48b80SGeorge V. Neville-Neil} 69