1282242Sgnn#!/usr/sbin/dtrace -s 2282242Sgnn/*- 3282242Sgnn * Copyright (c) 2015 George V. Neville-Neil 4282242Sgnn * All rights reserved. 5282242Sgnn * 6282242Sgnn * Redistribution and use in source and binary forms, with or without 7282242Sgnn * modification, are permitted provided that the following conditions 8282242Sgnn * are met: 9282242Sgnn * 1. Redistributions of source code must retain the above copyright 10282242Sgnn * notice, this list of conditions and the following disclaimer. 11282242Sgnn * 2. Redistributions in binary form must reproduce the above copyright 12282242Sgnn * notice, this list of conditions and the following disclaimer in the 13282242Sgnn * documentation and/or other materials provided with the distribution. 14282242Sgnn * 15282242Sgnn * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16282242Sgnn * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17282242Sgnn * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18282242Sgnn * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19282242Sgnn * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20282242Sgnn * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21282242Sgnn * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22282242Sgnn * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23282242Sgnn * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24282242Sgnn * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25282242Sgnn * SUCH DAMAGE. 26282242Sgnn * 27282242Sgnn * $FreeBSD: releng/11.0/share/dtrace/siftr 282242 2015-04-29 18:07:58Z gnn $ 28282242Sgnn * 29282242Sgnn * The siftr D script collects data from the SIFTR kernel module. 30282242Sgnn * 31282242Sgnn * Usage: siftr 32282242Sgnn */ 33282242Sgnn 34282242Sgnn#pragma D option quiet 35282242Sgnntcp:kernel::siftr 36282242Sgnn{ 37282242Sgnn printf("direction %s state %s local %d remote %d\n", 38282242Sgnn siftr_dir_string[args[0]->direction], 39282242Sgnn tcp_state_string[args[0]->conn_state], 40282242Sgnn args[0]->tcp_localport, 41282242Sgnn args[0]->tcp_foreignport); 42282242Sgnn printf("snd_cwnd %d snd_wnd %d rcv_wnd %d snd_bwnd %d snd_ssthresh %d\n", 43282242Sgnn args[0]->snd_cwnd, 44282242Sgnn args[0]->snd_wnd, 45282242Sgnn args[0]->rcv_wnd, 46282242Sgnn args[0]->snd_bwnd, 47282242Sgnn args[0]->snd_ssthresh); 48282242Sgnn printf("\tmax_seg_size %u smoothed_rtt %d sack_enabled %d\n", 49282242Sgnn args[0]->max_seg_size, 50282242Sgnn args[0]->smoothed_rtt, 51282242Sgnn args[0]->sack_enabled); 52282242Sgnn printf("\tsnd_scale %d rcv_scale %d flags 0x%x rxt_length %d\n", 53282242Sgnn args[0]->snd_scale, 54282242Sgnn args[0]->rcv_scale, 55282242Sgnn args[0]->flags, 56282242Sgnn args[0]->rxt_length); 57282242Sgnn printf("\tsnd_buf_hiwater %u snd_buf_cc %u rcv_buf_hiwater %u\n", 58282242Sgnn args[0]->snd_buf_hiwater, 59282242Sgnn args[0]->snd_buf_cc, 60282242Sgnn args[0]->rcv_buf_hiwater); 61282242Sgnn printf("\trcv_buf_cc %u sent_inflight_bytes %u t_segqlen %d\n", 62282242Sgnn args[0]->rcv_buf_cc, 63282242Sgnn args[0]->sent_inflight_bytes, 64282242Sgnn args[0]->t_segqlen); 65282242Sgnn printf("\tflowid %u flowtype %u\n", 66282242Sgnn args[0]->flowid, 67282242Sgnn args[0]->flowtype); 68282242Sgnn} 69