1238710Sadrian#
2238710Sadrian# CDDL HEADER START
3238710Sadrian#
4238710Sadrian# The contents of this file are subject to the terms of the
5238710Sadrian# Common Development and Distribution License (the "License").
6238710Sadrian# You may not use this file except in compliance with the License.
7238710Sadrian#
8238710Sadrian# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9238710Sadrian# or http://www.opensolaris.org/os/licensing.
10238710Sadrian# See the License for the specific language governing permissions
11238710Sadrian# and limitations under the License.
12238710Sadrian#
13238710Sadrian# When distributing Covered Code, include this CDDL HEADER in each
14238710Sadrian# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15238710Sadrian# If applicable, add the following below this CDDL HEADER, with the
16238710Sadrian# fields enclosed by brackets "[]" replaced with your own identifying
17238710Sadrian# information: Portions Copyright [yyyy] [name of copyright owner]
18238710Sadrian#
19238710Sadrian# CDDL HEADER END
20238710Sadrian#
21238710Sadrian
22238710Sadrian#
23238710Sadrian# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24238710Sadrian# Use is subject to license terms.
25238710Sadrian#
26238710Sadrian# ident	"%Z%%M%	%I%	%E% SMI"
27238710Sadrian
28238710Sadrianscript()
29238710Sadrian{
30238710Sadrian	$dtrace -qs /dev/stdin <<EOF
31238710Sadrian	profile-1234hz
32238710Sadrian	/arg0 != 0/
33238710Sadrian	{
34238710Sadrian		@[mod(arg0)] = count();
35238710Sadrian	}
36238710Sadrian
37	tick-100ms
38	/i++ == 20/
39	{
40		exit(0);
41	}
42EOF
43}
44
45spinny()
46{
47	while true; do
48		/usr/bin/date > /dev/null
49	done
50}
51
52if [ $# != 1 ]; then
53	echo expected one argument: '<'dtrace-path'>'
54	exit 2
55fi
56
57dtrace=$1
58
59spinny &
60child=$!
61
62#
63# The only thing we can be sure of is that some module named "unix" (or
64# "genunix") did some work -- so that's all we'll check.
65#
66script | tee /dev/fd/2 | grep unix > /dev/null
67status=$? 
68
69kill $child
70exit $status
71