err.cputrackfailtostart.ksh revision 8803:8c01b39012c9
1284990Scy#!/bin/ksh 2284990Scy# 3284990Scy# CDDL HEADER START 4284990Scy# 5284990Scy# The contents of this file are subject to the terms of the 6284990Scy# Common Development and Distribution License (the "License"). 7284990Scy# You may not use this file except in compliance with the License. 8284990Scy# 9284990Scy# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10284990Scy# or http://www.opensolaris.org/os/licensing. 11284990Scy# See the License for the specific language governing permissions 12284990Scy# and limitations under the License. 13284990Scy# 14284990Scy# When distributing Covered Code, include this CDDL HEADER in each 15284990Scy# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16284990Scy# If applicable, add the following below this CDDL HEADER, with the 17284990Scy# fields enclosed by brackets "[]" replaced with your own identifying 18284990Scy# information: Portions Copyright [yyyy] [name of copyright owner] 19284990Scy# 20284990Scy# CDDL HEADER END 21284990Scy# 22284990Scy 23284990Scy# 24284990Scy# Copyright 2009 Sun Microsystems, Inc. All rights reserved. 25284990Scy# Use is subject to license terms. 26284990Scy 27284990Scy# 28284990Scy# This script ensures that cputrack(1M) will fail to start when the cpc 29284990Scy# provider has active enablings. 30284990Scy# 31284990Scy# The script will fail if: 32284990Scy# 1) The system under test does not define the 'PAPI_tot_ins' event. 33284990Scy# 34284990Scy 35284990Scyscript() 36284990Scy{ 37284990Scy $dtrace -o $dtraceout -s /dev/stdin <<EOF 38284990Scy #pragma D option bufsize=128k 39284990Scy 40284990Scy cpc:::PAPI_tot_ins-all-10000 41284990Scy { 42284990Scy @[probename] = count(); 43284990Scy } 44284990ScyEOF 45284990Scy} 46284990Scy 47284990Scy 48284990Scyif [ $# != 1 ]; then 49284990Scy echo expected one argument: '<'dtrace-path'>' 50284990Scy exit 2 51284990Scyfi 52284990Scy 53284990Scydtrace=$1 54284990Scydtraceout=/tmp/dtrace.out.$$ 55284990Scyscript 2>/dev/null & 56timeout=15 57 58# 59# Sleep while the above script fires into life. To guard against dtrace dying 60# and us sleeping forever we allow 15 secs for this to happen. This should be 61# enough for even the slowest systems. 62# 63while [ ! -f $dtraceout ]; do 64 sleep 1 65 timeout=$(($timeout-1)) 66 if [ $timeout -eq 0 ]; then 67 echo "dtrace failed to start. Exiting." 68 exit 1 69 fi 70done 71 72cputrack -c PAPI_tot_ins sleep 10 73status=$? 74 75rm $dtraceout 76 77exit $status 78