3 * threaded.d - sample multi-threaded CPU usage.
4 * Written using DTrace (Solaris 10 3/05).
6 * This measures thread IDs as a process runs across multiple CPUs.
7 * It is a simple script that can help determine if a multi-threaded
8 * application is effectively using it's threads, or if the threads have
9 * serialised. See the example file in Docs/Examples/threaded_example.txt
10 * for a demonstration.
12 * $Id: threaded.d 3 2007-08-01 10:50:08Z brendan $
20 * count number of samples
24 * COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
28 * The contents of this file are subject to the terms of the
29 * Common Development and Distribution License, Version 1.0 only
30 * (the "License"). You may not use this file except in compliance
33 * You can obtain a copy of the license at Docs/cddl1.txt
34 * or http://www.opensolaris.org/os/licensing.
35 * See the License for the specific language governing permissions
36 * and limitations under the License.
40 * Author: Brendan Gregg [Sydney, Australia]
42 * 25-Jul-2005 Brendan Gregg Created this.
43 * 25-Jul-2005 " " Last update.
46 #pragma D option quiet
54 @sample[pid, execname] = lquantize(tid, 0, 128, 1);
58 * Print output every 1 second
62 printf("%Y,\n", walltimestamp);
63 printa("\n PID: %-8d CMD: %s\n%@d", @sample);