1218799Snwhitehorn# 2218799Snwhitehorn# CDDL HEADER START 3218799Snwhitehorn# 4218799Snwhitehorn# The contents of this file are subject to the terms of the 5218799Snwhitehorn# Common Development and Distribution License (the "License"). 6218799Snwhitehorn# You may not use this file except in compliance with the License. 7218799Snwhitehorn# 8218799Snwhitehorn# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9218799Snwhitehorn# or http://www.opensolaris.org/os/licensing. 10218799Snwhitehorn# See the License for the specific language governing permissions 11218799Snwhitehorn# and limitations under the License. 12218799Snwhitehorn# 13218799Snwhitehorn# When distributing Covered Code, include this CDDL HEADER in each 14218799Snwhitehorn# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15218799Snwhitehorn# If applicable, add the following below this CDDL HEADER, with the 16218799Snwhitehorn# fields enclosed by brackets "[]" replaced with your own identifying 17218799Snwhitehorn# information: Portions Copyright [yyyy] [name of copyright owner] 18218799Snwhitehorn# 19218799Snwhitehorn# CDDL HEADER END 20218799Snwhitehorn# 21218799Snwhitehorn 22218799Snwhitehorn# 23218799Snwhitehorn# Copyright 2007 Sun Microsystems, Inc. All rights reserved. 24218799Snwhitehorn# Use is subject to license terms. 25218799Snwhitehorn# 26218799Snwhitehorn# ident "%Z%%M% %I% %E% SMI" 27218799Snwhitehorn 28218799Snwhitehornscript() 29218799Snwhitehorn{ 30218799Snwhitehorn $dtrace -qs /dev/stdin <<EOF 31218799Snwhitehorn profile-1234hz 32220088Snwhitehorn /arg0 != 0/ 33220088Snwhitehorn { 34218799Snwhitehorn @[func(arg0)] = count(); 35218799Snwhitehorn } 36218799Snwhitehorn 37218799Snwhitehorn tick-100ms 38225637Snwhitehorn /i++ == 50/ 39218799Snwhitehorn { 40218799Snwhitehorn exit(0); 41218799Snwhitehorn } 42218799SnwhitehornEOF 43218799Snwhitehorn} 44218799Snwhitehorn 45218799Snwhitehornspinny() 46218799Snwhitehorn{ 47218799Snwhitehorn while true; do 48218799Snwhitehorn /usr/bin/date > /dev/null 49218799Snwhitehorn done 50218799Snwhitehorn} 51218799Snwhitehorn 52218799Snwhitehornif [ $# != 1 ]; then 53218799Snwhitehorn echo expected one argument: '<'dtrace-path'>' 54219615Snwhitehorn exit 2 55219615Snwhitehornfi 56219615Snwhitehorn 57218947Snwhitehorndtrace=$1 58219615Snwhitehorn 59219615Snwhitehornspinny & 60219615Snwhitehornchild=$! 61219615Snwhitehorn 62219615Snwhitehorn# 63219615Snwhitehorn# This is gutsy -- we're assuming that mutex_enter(9F) will show up in the 64219615Snwhitehorn# output. This is most likely _not_ to show up in the output if the 65219615Snwhitehorn# platform does not support arbitrary resolution interval timers -- but 66219615Snwhitehorn# the above script was stress-tested down to 100 hertz and still ran 67219615Snwhitehorn# successfully on all platforms, so one is hopeful that this test will pass 68219615Snwhitehorn# even in that case. 69218947Snwhitehorn# 70218799Snwhitehornscript | tee /dev/fd/2 | grep mutex_enter > /dev/null 71218799Snwhitehornstatus=$? 72218799Snwhitehorn 73218799Snwhitehornkill $child 74218799Snwhitehornexit $status 75218799Snwhitehorn