]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - cddl/contrib/dtracetoolkit/Proc/sigdist.d
Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.
[FreeBSD/stable/10.git] / cddl / contrib / dtracetoolkit / Proc / sigdist.d
1 #!/usr/sbin/dtrace -s
2 /*
3  * sigdist.d - signal distribution by process name.
4  *             Written using DTrace (Solaris 10 3/05)
5  *
6  * This is a simple DTrace script that prints the number of signals
7  * recieved by process and signal number. This script is also available
8  * as /usr/demo/dtrace/sig.d, where it originates.
9  *
10  * $Id: sigdist.d 4 2007-08-01 11:01:38Z brendan $
11  *
12  * USAGE:       sigdist.d       # hit Ctrl-C to end
13  *
14  * FIELDS:
15  *              SENDER          process name of sender
16  *              RECIPIENT       process name of target
17  *              SIG             signal number, see signal(3head)
18  *              COUNT           number of signals sent
19  *
20  * BASED ON: /usr/demo/dtrace/sig.d
21  *
22  * SEE ALSO: DTrace Guide "proc Provider" chapter (docs.sun.com)
23  *           kill.d(1M)
24  *
25  * PORTIONS: Copyright (c) 2005, 2006 Brendan Gregg.
26  *
27  * CDDL HEADER START
28  *
29  *  The contents of this file are subject to the terms of the
30  *  Common Development and Distribution License, Version 1.0 only
31  *  (the "License").  You may not use this file except in compliance
32  *  with the License.
33  *
34  *  You can obtain a copy of the license at Docs/cddl1.txt
35  *  or http://www.opensolaris.org/os/licensing.
36  *  See the License for the specific language governing permissions
37  *  and limitations under the License.
38  *
39  * CDDL HEADER END
40  *
41  * 09-Jun-2005  Brendan Gregg   Created this.
42  * 20-Apr-2006     "      "     Last update.
43  */
44
45 #pragma D option quiet
46
47 dtrace:::BEGIN
48 {
49         printf("Tracing... Hit Ctrl-C to end.\n");
50 }
51
52 proc:::signal-send
53 {
54         @Count[execname, stringof(args[1]->pr_fname), args[2]] = count();
55 }
56
57 dtrace:::END
58 {
59         printf("%16s %16s %6s %6s\n", "SENDER", "RECIPIENT", "SIG", "COUNT");
60         printa("%16s %16s %6d %6@d\n", @Count);
61 }