1#!/usr/sbin/dtrace -s
2/*
3 * xcallsbypid.d - CPU cross calls by PID.
4 *                 Writen using DTrace (Solaris 10 3/05).
5 *
6 * $Id: xcallsbypid.d 3 2007-08-01 10:50:08Z brendan $
7 *
8 * USAGE:	xcallsbypid.d		# hit Ctrl-C to end sample
9 *
10 * FIELDS:
11 *		PID		process ID
12 * 		CMD		process name
13 *		XCALLS		number of cross calls
14 *
15 * COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg.
16 *
17 * CDDL HEADER START
18 *
19 *  The contents of this file are subject to the terms of the
20 *  Common Development and Distribution License, Version 1.0 only
21 *  (the "License").  You may not use this file except in compliance
22 *  with the License.
23 *
24 *  You can obtain a copy of the license at Docs/cddl1.txt
25 *  or http://www.opensolaris.org/os/licensing.
26 *  See the License for the specific language governing permissions
27 *  and limitations under the License.
28 *
29 * CDDL HEADER END
30 *
31 * 17-Sep-2005	Brendan Gregg	Created this.
32 * 20-Apr-2006	   "      "	Last update.
33 */
34
35#pragma D option quiet
36
37dtrace:::BEGIN
38{
39	printf("Tracing... Hit Ctrl-C to end.\n");
40}
41
42sysinfo:::xcalls
43{
44	@num[pid, execname] = count();
45}
46
47dtrace:::END
48{
49	printf("%6s %-16s %16s\n", "PID", "CMD", "XCALLS");
50	printa("%6d %-16s %@16d\n", @num);
51}
52