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