3 * cpuwalk.d - Measure which CPUs a process runs on.
4 * Written using DTrace (Solaris 10 3/05)
6 * This program is for multi-CPU servers, and can help identify if a process
7 * is running on multiple CPUs concurrently or not.
9 * $Id: cpuwalk.d 3 2007-08-01 10:50:08Z brendan $
11 * USAGE: cpuwalk.d [duration]
13 * cpuwalk.d 10 # sample for 10 seconds
14 * cpuwalk.d # sample until Ctrl-C is hit
18 * count Number of 1000 hz samples on this CPU
20 * COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
24 * The contents of this file are subject to the terms of the
25 * Common Development and Distribution License, Version 1.0 only
26 * (the "License"). You may not use this file except in compliance
29 * You can obtain a copy of the license at Docs/cddl1.txt
30 * or http://www.opensolaris.org/os/licensing.
31 * See the License for the specific language governing permissions
32 * and limitations under the License.
36 * 22-Sep-2005 Brendan Gregg Created this.
37 * 14-Feb-2006 " " Last update.
40 #pragma D option quiet
41 #pragma D option defaultargs
43 inline int MAXCPUID = 1024;
47 $1 ? printf("Sampling...\n") :
48 printf("Sampling... Hit Ctrl-C to end.\n");
52 profile:::profile-1000hz
55 @sample[pid, execname] = lquantize(cpu, 0, MAXCPUID, 1);
71 printa("\n PID: %-8d CMD: %s\n%@d", @sample);