diff options
author | gnn <gnn@FreeBSD.org> | 2015-03-07 18:17:15 +0000 |
---|---|---|
committer | gnn <gnn@FreeBSD.org> | 2015-03-07 18:17:15 +0000 |
commit | 5ffbd45332b89a26ad6b93d0d0dfcf1e1712792c (patch) | |
tree | 1c0ab5527cd56021fc4b495f7eedeb4723b2001b /share/dtrace | |
parent | 353679f97c78213de44dad4afc0b2289ea1baa57 (diff) | |
download | FreeBSD-src-5ffbd45332b89a26ad6b93d0d0dfcf1e1712792c.zip FreeBSD-src-5ffbd45332b89a26ad6b93d0d0dfcf1e1712792c.tar.gz |
Add a TCP state tracking script based on FreeBSD TCP SDTs
Diffstat (limited to 'share/dtrace')
-rw-r--r-- | share/dtrace/Makefile | 3 | ||||
-rw-r--r-- | share/dtrace/tcpstate | 46 |
2 files changed, 48 insertions, 1 deletions
diff --git a/share/dtrace/Makefile b/share/dtrace/Makefile index 328f806..f39a18c 100644 --- a/share/dtrace/Makefile +++ b/share/dtrace/Makefile @@ -15,7 +15,8 @@ _toolkit= toolkit SCRIPTS= disklatency \ disklatencycmd \ hotopen \ - nfsclienttime + nfsclienttime \ + tcpstate SCRIPTSDIR= ${SHAREDIR}/dtrace diff --git a/share/dtrace/tcpstate b/share/dtrace/tcpstate new file mode 100644 index 0000000..4528bd7 --- /dev/null +++ b/share/dtrace/tcpstate @@ -0,0 +1,46 @@ +#!/usr/sbin/dtrace -s +/* + * Copyright (c) 2015 George V. Neville-Neil + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + * + * The tcpstate D script shows TCP sockets transitioning between states. + * + * Usage: tcpstate + */ + +#pragma D option quiet +BEGIN +{ + printf("Old State\t\tNew State\n"); +} + +tcp:kernel::state-change +{ + newstate = args[3]->tcps_state; + oldstate = args[5]->tcps_state; + printf("%s\t\t%s\n", tcp_state_string[oldstate], + tcp_state_string[newstate]); +} |