xref: /netbsd-src/external/cddl/dtracetoolkit/dist/Bin/intbycpu.d (revision c29d51755812ace2e87aeefdb06cb2b4dac7087a)
1 #!/usr/sbin/dtrace -s
2 /*
3  * intbycpu.d - interrupts by CPU.
4  *              Written using DTrace (Solaris 10 3/05).
5  *
6  * $Id: intbycpu.d,v 1.1.1.1 2015/09/30 22:01:07 christos Exp $
7  *
8  * USAGE:	intbycpu.d		# hit Ctrl-C to end sample
9  *
10  * FIELDS:
11  *		CPU		CPU number
12  *		INTERRUPTS	number of interrupts in sample
13  *
14  * This is based on a DTrace OneLiner from the DTraceToolkit.
15  *
16  * COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg.
17  *
18  * CDDL HEADER START
19  *
20  *  The contents of this file are subject to the terms of the
21  *  Common Development and Distribution License, Version 1.0 only
22  *  (the "License").  You may not use this file except in compliance
23  *  with the License.
24  *
25  *  You can obtain a copy of the license at Docs/cddl1.txt
26  *  or http://www.opensolaris.org/os/licensing.
27  *  See the License for the specific language governing permissions
28  *  and limitations under the License.
29  *
30  * CDDL HEADER END
31  *
32  * 15-May-2005	Brendan Gregg	Created this.
33  * 20-Apr-2006	   "      "	Last update.
34  */
35 
36 #pragma D option quiet
37 
38 dtrace:::BEGIN
39 {
40 	printf("Tracing... Hit Ctrl-C to end.\n");
41 }
42 
43 sdt:::interrupt-start { @num[cpu] = count(); }
44 
45 dtrace:::END
46 {
47 	printf("%-16s %16s\n", "CPU", "INTERRUPTS");
48 	printa("%-16d %@16d\n", @num);
49 }
50