9512fe850e98fdd448c638ca63fdd92a8a510255ahl#
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# CDDL HEADER START
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# The contents of this file are subject to the terms of the
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# Common Development and Distribution License (the "License").
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# You may not use this file except in compliance with the License.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# or http://www.opensolaris.org/os/licensing.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# See the License for the specific language governing permissions
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# and limitations under the License.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# When distributing Covered Code, include this CDDL HEADER in each
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# If applicable, add the following below this CDDL HEADER, with the
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# fields enclosed by brackets "[]" replaced with your own identifying
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# information: Portions Copyright [yyyy] [name of copyright owner]
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# CDDL HEADER END
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# Use is subject to license terms.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#ident "%Z%%M% %I% %E% SMI"
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# This script attempts to tease out a race when probes are initially enabled.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#
9512fe850e98fdd448c638ca63fdd92a8a510255ahlscript()
9512fe850e98fdd448c638ca63fdd92a8a510255ahl{
9512fe850e98fdd448c638ca63fdd92a8a510255ahl #
9512fe850e98fdd448c638ca63fdd92a8a510255ahl # Nauseatingly, the #defines below must be in the 0th column to
9512fe850e98fdd448c638ca63fdd92a8a510255ahl # satisfy the ancient cpp that -C defaults to.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl #
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee $dtrace -C -s /dev/stdin <<EOF
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#define PROF1 profile:::profile-4000hz
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#define PROF4 PROF1, PROF1, PROF1, PROF1
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#define PROF16 PROF4, PROF4, PROF4, PROF4
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#define PROF64 PROF16, PROF16, PROF16, PROF16
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#define PROF256 PROF64, PROF64, PROF64, PROF64
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#define PROF512 PROF256, PROF256
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahl PROF1
9512fe850e98fdd448c638ca63fdd92a8a510255ahl {
9512fe850e98fdd448c638ca63fdd92a8a510255ahl this->x = 0;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl }
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahl PROF512
9512fe850e98fdd448c638ca63fdd92a8a510255ahl {
9512fe850e98fdd448c638ca63fdd92a8a510255ahl this->x++;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl }
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahl PROF1
9512fe850e98fdd448c638ca63fdd92a8a510255ahl /this->x != 512/
9512fe850e98fdd448c638ca63fdd92a8a510255ahl {
9512fe850e98fdd448c638ca63fdd92a8a510255ahl printf("failed! x is %d (expected 512)", this->x);
9512fe850e98fdd448c638ca63fdd92a8a510255ahl exit(1);
9512fe850e98fdd448c638ca63fdd92a8a510255ahl }
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahl tick-1sec
9512fe850e98fdd448c638ca63fdd92a8a510255ahl /secs++/
9512fe850e98fdd448c638ca63fdd92a8a510255ahl {
9512fe850e98fdd448c638ca63fdd92a8a510255ahl exit(0);
9512fe850e98fdd448c638ca63fdd92a8a510255ahl }
9512fe850e98fdd448c638ca63fdd92a8a510255ahlEOF
9512fe850e98fdd448c638ca63fdd92a8a510255ahl}
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomeeif [ $# != 1 ]; then
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee echo expected one argument: '<'dtrace-path'>'
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee exit 2
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomeefi
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomeedtrace=$1
9512fe850e98fdd448c638ca63fdd92a8a510255ahllet i=0
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahlwhile [ "$i" -lt 20 ]; do
9512fe850e98fdd448c638ca63fdd92a8a510255ahl script
9512fe850e98fdd448c638ca63fdd92a8a510255ahl status=$?
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahl if [ "$status" -ne 0 ]; then
9512fe850e98fdd448c638ca63fdd92a8a510255ahl exit $status
9512fe850e98fdd448c638ca63fdd92a8a510255ahl fi
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahl let i=i+1
9512fe850e98fdd448c638ca63fdd92a8a510255ahldone
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahlexit 0