3 * rwbypid.d - read/write calls by PID.
4 * Written using DTrace (Solaris 10 3/05)
6 * This script tracks the number of reads and writes at the syscall level
7 * by processes, printing the totals in a report. This matches reads
8 * and writes whether they succeed or not.
10 * $Id: rwbypid.d 3 2007-08-01 10:50:08Z brendan $
12 * USAGE: rwbypid.d # hit Ctrl-C to end sample
20 * COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg.
24 * The contents of this file are subject to the terms of the
25 * Common Development and Distribution License, Version 1.0 only
26 * (the "License"). You may not use this file except in compliance
29 * You can obtain a copy of the license at Docs/cddl1.txt
30 * or http://www.opensolaris.org/os/licensing.
31 * See the License for the specific language governing permissions
32 * and limitations under the License.
36 * 28-Jun-2005 Brendan Gregg Created this.
37 * 20-Apr-2006 " " Last update.
40 #pragma D option quiet
44 printf("Tracing... Hit Ctrl-C to end.\n");
49 @calls[pid, execname, "R"] = sum(arg0);
52 syscall::*write*:entry
54 @calls[pid, execname, "W"] = sum(arg0);
59 printf("%6s %-24s %4s %8s\n", "PID", "CMD", "DIR", "COUNT");
60 printa("%6d %-24s %4s %@8d\n", @calls);