tst.umod.ksh revision 178477
1228753Smm#
2228753Smm# CDDL HEADER START
3228753Smm#
4228753Smm# The contents of this file are subject to the terms of the
5228753Smm# Common Development and Distribution License (the "License").
6228753Smm# You may not use this file except in compliance with the License.
7228753Smm#
8228753Smm# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9228753Smm# or http://www.opensolaris.org/os/licensing.
10228753Smm# See the License for the specific language governing permissions
11228753Smm# and limitations under the License.
12228753Smm#
13228753Smm# When distributing Covered Code, include this CDDL HEADER in each
14228753Smm# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15228753Smm# If applicable, add the following below this CDDL HEADER, with the
16228753Smm# fields enclosed by brackets "[]" replaced with your own identifying
17228753Smm# information: Portions Copyright [yyyy] [name of copyright owner]
18228753Smm#
19228753Smm# CDDL HEADER END
20228753Smm#
21228753Smm
22228753Smm#
23228753Smm# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24228753Smm# Use is subject to license terms.
25228753Smm#
26228753Smm# ident	"%Z%%M%	%I%	%E% SMI"
27228753Smm
28228753Smmscript()
29228753Smm{
30228753Smm	$dtrace -qs /dev/stdin <<EOF
31228753Smm	profile-1234hz
32228753Smm	/arg1 != 0/
33228753Smm	{
34228753Smm		@[umod(arg1)] = count();
35228753Smm	}
36228753Smm
37228753Smm	tick-100ms
38228753Smm	/i++ == 20/
39228753Smm	{
40228753Smm		exit(0);
41228753Smm	}
42228753SmmEOF
43228753Smm}
44228753Smm
45228753Smmspinny()
46228753Smm{
47228753Smm	while true; do
48228753Smm		let i=i+1
49228753Smm	done
50228753Smm}
51228753Smm
52228753Smmif [ $# != 1 ]; then
53228753Smm	echo expected one argument: '<'dtrace-path'>'
54228753Smm	exit 2
55228753Smmfi
56228753Smm
57228753Smmdtrace=$1
58228753Smm
59228753Smmspinny &
60228753Smmchild=$!
61228753Smm
62228753Smm#
63228753Smm# The only thing we can be sure of here is that ksh is doing some work.
64228753Smm#
65228753Smmscript | tee /dev/fd/2 | grep -w ksh > /dev/null
66228753Smmstatus=$? 
67228753Smm
68228753Smmkill $child
69228753Smmexit $status
70228753Smm