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 * 20-Apr-2006, ver 1.01 11 * 12 * USAGE: sigdist.d # hit Ctrl-C to end sampling 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 */ 43 44#pragma D option quiet 45 46dtrace:::BEGIN 47{ 48 printf("Tracing... Hit Ctrl-C to end.\n"); 49} 50 51proc:::signal-send 52{ 53 @Count[execname, stringof(args[1]->pr_fname), args[2]] = count(); 54} 55 56dtrace:::END 57{ 58 printf("%16s %16s %6s %6s\n", "SENDER", "RECIPIENT", "SIG", "COUNT"); 59 printa("%16s %16s %6d %6@d\n", @Count); 60} 61