tst.mod.ksh revision 277911
133965Sjdp#
278828Sobrien# CDDL HEADER START
3218822Sdim#
433965Sjdp# The contents of this file are subject to the terms of the
533965Sjdp# Common Development and Distribution License (the "License").
633965Sjdp# You may not use this file except in compliance with the License.
7130561Sobrien#
833965Sjdp# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9130561Sobrien# or http://www.opensolaris.org/os/licensing.
10130561Sobrien# See the License for the specific language governing permissions
11130561Sobrien# and limitations under the License.
12130561Sobrien#
1333965Sjdp# When distributing Covered Code, include this CDDL HEADER in each
14130561Sobrien# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15130561Sobrien# If applicable, add the following below this CDDL HEADER, with the
16130561Sobrien# fields enclosed by brackets "[]" replaced with your own identifying
17130561Sobrien# information: Portions Copyright [yyyy] [name of copyright owner]
1833965Sjdp#
19130561Sobrien# CDDL HEADER END
20130561Sobrien#
21218822Sdim
2233965Sjdp#
2333965Sjdp# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
2433965Sjdp# Use is subject to license terms.
2533965Sjdp#
2633965Sjdp# ident	"%Z%%M%	%I%	%E% SMI"
2733965Sjdp
2833965Sjdpscript()
2933965Sjdp{
3033965Sjdp	$dtrace -qs /dev/stdin <<EOF
3133965Sjdp	profile-1234hz
3233965Sjdp	/arg0 != 0/
3333965Sjdp	{
3433965Sjdp		@[mod(arg0)] = count();
3533965Sjdp	}
3633965Sjdp
37130561Sobrien	tick-100ms
3833965Sjdp	/i++ == 20/
39130561Sobrien	{
40130561Sobrien		exit(0);
41130561Sobrien	}
4291041SobrienEOF
4391041Sobrien}
4433965Sjdp
4591041Sobrienspinny()
4691041Sobrien{
4733965Sjdp	while true; do
48218822Sdim		/usr/bin/date > /dev/null
49218822Sdim	done
50130561Sobrien}
51218822Sdim
5233965Sjdpif [ $# != 1 ]; then
5391041Sobrien	echo expected one argument: '<'dtrace-path'>'
5491041Sobrien	exit 2
55130561Sobrienfi
5633965Sjdp
5791041Sobriendtrace=$1
5891041Sobrien
5991041Sobrienspinny &
60130561Sobrienchild=$!
6133965Sjdp
6291041Sobrien#
6391041Sobrien# The only thing we can be sure of is that some module named "unix" (or
64130561Sobrien# "genunix") did some work -- so that's all we'll check.
6533965Sjdp#
6691041Sobrienscript | tee /dev/fd/2 | grep kernel > /dev/null
6791041Sobrienstatus=$? 
6891041Sobrien
6933965Sjdpkill $child
7091041Sobrienexit $status
71130561Sobrien