xref: /onnv-gate/usr/src/cmd/dtrace/demo/ip/ipio.d (revision 6878:360e73ea6b0c)
1*6878Sbrendan /*
2*6878Sbrendan  * CDDL HEADER START
3*6878Sbrendan  *
4*6878Sbrendan  * The contents of this file are subject to the terms of the
5*6878Sbrendan  * Common Development and Distribution License (the "License").
6*6878Sbrendan  * You may not use this file except in compliance with the License.
7*6878Sbrendan  *
8*6878Sbrendan  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*6878Sbrendan  * or http://www.opensolaris.org/os/licensing.
10*6878Sbrendan  * See the License for the specific language governing permissions
11*6878Sbrendan  * and limitations under the License.
12*6878Sbrendan  *
13*6878Sbrendan  * When distributing Covered Code, include this CDDL HEADER in each
14*6878Sbrendan  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*6878Sbrendan  * If applicable, add the following below this CDDL HEADER, with the
16*6878Sbrendan  * fields enclosed by brackets "[]" replaced with your own identifying
17*6878Sbrendan  * information: Portions Copyright [yyyy] [name of copyright owner]
18*6878Sbrendan  *
19*6878Sbrendan  * CDDL HEADER END
20*6878Sbrendan  */
21*6878Sbrendan /*
22*6878Sbrendan  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23*6878Sbrendan  * Use is subject to license terms.
24*6878Sbrendan  */
25*6878Sbrendan 
26*6878Sbrendan #pragma D option quiet
27*6878Sbrendan #pragma D option switchrate=10hz
28*6878Sbrendan 
29*6878Sbrendan dtrace:::BEGIN
30*6878Sbrendan {
31*6878Sbrendan 	printf(" %3s %10s %15s    %15s %8s %6s\n", "CPU", "DELTA(us)",
32*6878Sbrendan 	    "SOURCE", "DEST", "INT", "BYTES");
33*6878Sbrendan 	last = timestamp;
34*6878Sbrendan }
35*6878Sbrendan 
36*6878Sbrendan ip:::send
37*6878Sbrendan {
38*6878Sbrendan 	this->elapsed = (timestamp - last) / 1000;
39*6878Sbrendan 	printf(" %3d %10d %15s -> %15s %8s %6d\n", cpu, this->elapsed,
40*6878Sbrendan 	    args[2]->ip_saddr, args[2]->ip_daddr, args[3]->if_name,
41*6878Sbrendan 	    args[2]->ip_plength);
42*6878Sbrendan 	last = timestamp;
43*6878Sbrendan }
44*6878Sbrendan 
45*6878Sbrendan ip:::receive
46*6878Sbrendan {
47*6878Sbrendan 	this->elapsed = (timestamp - last) / 1000;
48*6878Sbrendan 	printf(" %3d %10d %15s <- %15s %8s %6d\n", cpu, this->elapsed,
49*6878Sbrendan 	    args[2]->ip_daddr, args[2]->ip_saddr, args[3]->if_name,
50*6878Sbrendan 	    args[2]->ip_plength);
51*6878Sbrendan 	last = timestamp;
52*6878Sbrendan }
53