xref: /illumos-gate/usr/src/cmd/dtrace/demo/tcp/tcpstate.d (revision 9cd928fe5e3ea4e05f64cfb380beb54b2623e7dc)
1*9cd928feSAlan Maguire #!/usr/sbin/dtrace -s
2*9cd928feSAlan Maguire /*
3*9cd928feSAlan Maguire  * CDDL HEADER START
4*9cd928feSAlan Maguire  *
5*9cd928feSAlan Maguire  * The contents of this file are subject to the terms of the
6*9cd928feSAlan Maguire  * Common Development and Distribution License (the "License").
7*9cd928feSAlan Maguire  * You may not use this file except in compliance with the License.
8*9cd928feSAlan Maguire  *
9*9cd928feSAlan Maguire  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*9cd928feSAlan Maguire  * or http://www.opensolaris.org/os/licensing.
11*9cd928feSAlan Maguire  * See the License for the specific language governing permissions
12*9cd928feSAlan Maguire  * and limitations under the License.
13*9cd928feSAlan Maguire  *
14*9cd928feSAlan Maguire  * When distributing Covered Code, include this CDDL HEADER in each
15*9cd928feSAlan Maguire  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*9cd928feSAlan Maguire  * If applicable, add the following below this CDDL HEADER, with the
17*9cd928feSAlan Maguire  * fields enclosed by brackets "[]" replaced with your own identifying
18*9cd928feSAlan Maguire  * information: Portions Copyright [yyyy] [name of copyright owner]
19*9cd928feSAlan Maguire  *
20*9cd928feSAlan Maguire  * CDDL HEADER END
21*9cd928feSAlan Maguire  */
22*9cd928feSAlan Maguire /*
23*9cd928feSAlan Maguire  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
24*9cd928feSAlan Maguire  */
25*9cd928feSAlan Maguire 
26*9cd928feSAlan Maguire #pragma D option quiet
27*9cd928feSAlan Maguire 
28*9cd928feSAlan Maguire dtrace:::BEGIN
29*9cd928feSAlan Maguire {
30*9cd928feSAlan Maguire 	printf("%-10s %-10s %-20s    %-20s\n", "C", "PID", "PREV", "NEW");
31*9cd928feSAlan Maguire }
32*9cd928feSAlan Maguire 
33*9cd928feSAlan Maguire 
34*9cd928feSAlan Maguire tcp:::state-change
35*9cd928feSAlan Maguire {
36*9cd928feSAlan Maguire 	printf("%-10d %-10d %-20s -> %-20s\n", cpu, args[1]->cs_pid,
37*9cd928feSAlan Maguire 	    tcp_state_string[args[5]->tcps_state],
38*9cd928feSAlan Maguire 	    tcp_state_string[args[3]->tcps_state]);
39*9cd928feSAlan Maguire }
40