1210753Srpaulo#!/bin/ksh 2210753Srpaulo# 3210753Srpaulo# CDDL HEADER START 4210753Srpaulo# 5210753Srpaulo# The contents of this file are subject to the terms of the 6210753Srpaulo# Common Development and Distribution License (the "License"). 7210753Srpaulo# You may not use this file except in compliance with the License. 8210753Srpaulo# 9210753Srpaulo# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10210753Srpaulo# or http://www.opensolaris.org/os/licensing. 11210753Srpaulo# See the License for the specific language governing permissions 12210753Srpaulo# and limitations under the License. 13210753Srpaulo# 14210753Srpaulo# When distributing Covered Code, include this CDDL HEADER in each 15210753Srpaulo# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16210753Srpaulo# If applicable, add the following below this CDDL HEADER, with the 17210753Srpaulo# fields enclosed by brackets "[]" replaced with your own identifying 18210753Srpaulo# information: Portions Copyright [yyyy] [name of copyright owner] 19210753Srpaulo# 20210753Srpaulo# CDDL HEADER END 21210753Srpaulo# 22210753Srpaulo 23210753Srpaulo# 24210753Srpaulo# Copyright 2009 Sun Microsystems, Inc. All rights reserved. 25210753Srpaulo# Use is subject to license terms. 26210753Srpaulo 27210753Srpaulo# 28210753Srpaulo# This script ensures that cputrack(1) will terminate when the cpc provider 29210753Srpaulo# kicks into life. 30210753Srpaulo# 31210753Srpaulo# The script will fail if: 32210753Srpaulo# 1) The system under test does not define the 'PAPI_tot_ins' event. 33210753Srpaulo# 34210753Srpaulo 35210753Srpauloscript() 36210753Srpaulo{ 37210753Srpaulo $dtrace -s /dev/stdin <<EOF 38210753Srpaulo #pragma D option bufsize=128k 39210753Srpaulo 40210753Srpaulo cpc:::PAPI_tot_ins-all-10000 41210753Srpaulo { 42210753Srpaulo @[probename] = count(); 43210753Srpaulo } 44210753Srpaulo 45210753Srpaulo tick-1s 46210753Srpaulo /n++ > 10/ 47210753Srpaulo { 48210753Srpaulo exit(0); 49210753Srpaulo } 50210753SrpauloEOF 51210753Srpaulo} 52210753Srpaulo 53210753Srpauloif [ $# != 1 ]; then 54210753Srpaulo echo expected one argument: '<'dtrace-path'>' 55210753Srpaulo exit 2 56210753Srpaulofi 57210753Srpaulo 58210753Srpaulodtrace=$1 59210753Srpaulo 60210753Srpaulocputrack -c PAPI_tot_ins sleep 20 & 61210753Srpaulocputrack_pid=$! 62210753Srpaulosleep 5 63210753Srpauloscript 2>/dev/null & 64210753Srpaulo 65210753Srpaulowait $cputrack_pid 66210753Srpaulostatus=$? 67210753Srpaulo 68210753Srpaulorm $dtraceout 69210753Srpaulo 70210753Srpauloexit $status 71