3 * intoncpu.d - print interrupt on-cpu usage.
4 * Written using DTrace (Solaris 10 3/05)
6 * $Id: intoncpu.d 3 2007-08-01 10:50:08Z brendan $
8 * USAGE: intoncpu.d # wait several seconds, then hit Ctrl-C
11 * value Time interrupt thread was on-cpu, ns
12 * count Number of occurrences of at least this time
14 * BASED ON: /usr/demo/dtrace/intr.d
16 * SEE ALSO: DTrace Guide "sdt Provider" chapter (docs.sun.com)
19 * PORTIONS: Copyright (c) 2005, 2006 Brendan Gregg.
23 * The contents of this file are subject to the terms of the
24 * Common Development and Distribution License, Version 1.0 only
25 * (the "License"). You may not use this file except in compliance
28 * You can obtain a copy of the license at Docs/cddl1.txt
29 * or http://www.opensolaris.org/os/licensing.
30 * See the License for the specific language governing permissions
31 * and limitations under the License.
35 * 09-May-2005 Brendan Gregg Created this.
36 * 20-Apr-2006 " " Last update.
39 #pragma D option quiet
43 printf("Tracing... Hit Ctrl-C to end.\n");
48 self->ts = vtimestamp;
51 sdt:::interrupt-complete
52 /self->ts && arg0 != 0/
54 this->devi = (struct dev_info *)arg0;
55 /* this checks the pointer is valid, */
56 self->name = this->devi != 0 ?
57 stringof(`devnamesp[this->devi->devi_major].dn_name) : "?";
58 this->inst = this->devi != 0 ? this->devi->devi_instance : 0;
59 @Time[self->name, this->inst] = quantize(vtimestamp - self->ts);
65 printa("%s%d\n%@d", @Time);