intbycpu.d revision 235368
1235368Sgnn#!/usr/sbin/dtrace -s 2235368Sgnn/* 3235368Sgnn * intbycpu.d - interrupts by CPU. 4235368Sgnn * Written using DTrace (Solaris 10 3/05). 5235368Sgnn * 6235368Sgnn * $Id: intbycpu.d 3 2007-08-01 10:50:08Z brendan $ 7235368Sgnn * 8235368Sgnn * USAGE: intbycpu.d # hit Ctrl-C to end sample 9235368Sgnn * 10235368Sgnn * FIELDS: 11235368Sgnn * CPU CPU number 12235368Sgnn * INTERRUPTS number of interrupts in sample 13235368Sgnn * 14235368Sgnn * This is based on a DTrace OneLiner from the DTraceToolkit. 15235368Sgnn * 16235368Sgnn * COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg. 17235368Sgnn * 18235368Sgnn * CDDL HEADER START 19235368Sgnn * 20235368Sgnn * The contents of this file are subject to the terms of the 21235368Sgnn * Common Development and Distribution License, Version 1.0 only 22235368Sgnn * (the "License"). You may not use this file except in compliance 23235368Sgnn * with the License. 24235368Sgnn * 25235368Sgnn * You can obtain a copy of the license at Docs/cddl1.txt 26235368Sgnn * or http://www.opensolaris.org/os/licensing. 27235368Sgnn * See the License for the specific language governing permissions 28235368Sgnn * and limitations under the License. 29235368Sgnn * 30235368Sgnn * CDDL HEADER END 31235368Sgnn * 32235368Sgnn * 15-May-2005 Brendan Gregg Created this. 33235368Sgnn * 20-Apr-2006 " " Last update. 34235368Sgnn */ 35235368Sgnn 36235368Sgnn#pragma D option quiet 37235368Sgnn 38235368Sgnndtrace:::BEGIN 39235368Sgnn{ 40235368Sgnn printf("Tracing... Hit Ctrl-C to end.\n"); 41235368Sgnn} 42235368Sgnn 43235368Sgnnsdt:::interrupt-start { @num[cpu] = count(); } 44235368Sgnn 45235368Sgnndtrace:::END 46235368Sgnn{ 47235368Sgnn printf("%-16s %16s\n", "CPU", "INTERRUPTS"); 48235368Sgnn printa("%-16d %@16d\n", @num); 49235368Sgnn} 50