err.cputrackterminates.ksh revision 210753
1178479Sjb#!/bin/ksh 2178479Sjb# 3178479Sjb# CDDL HEADER START 4178479Sjb# 5178479Sjb# The contents of this file are subject to the terms of the 6178479Sjb# Common Development and Distribution License (the "License"). 7178479Sjb# You may not use this file except in compliance with the License. 8178479Sjb# 9178479Sjb# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10178479Sjb# or http://www.opensolaris.org/os/licensing. 11178479Sjb# See the License for the specific language governing permissions 12178479Sjb# and limitations under the License. 13178479Sjb# 14178479Sjb# When distributing Covered Code, include this CDDL HEADER in each 15178479Sjb# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16178479Sjb# If applicable, add the following below this CDDL HEADER, with the 17178479Sjb# fields enclosed by brackets "[]" replaced with your own identifying 18178479Sjb# information: Portions Copyright [yyyy] [name of copyright owner] 19178479Sjb# 20178479Sjb# CDDL HEADER END 21178479Sjb# 22178479Sjb 23178479Sjb# 24178479Sjb# Copyright 2009 Sun Microsystems, Inc. All rights reserved. 25178479Sjb# Use is subject to license terms. 26178479Sjb 27178479Sjb# 28178479Sjb# This script ensures that cputrack(1) will terminate when the cpc provider 29178479Sjb# kicks into life. 30178479Sjb# 31178479Sjb# The script will fail if: 32178479Sjb# 1) The system under test does not define the 'PAPI_tot_ins' event. 33178479Sjb# 34178479Sjb 35178479Sjbscript() 36178479Sjb{ 37178479Sjb $dtrace -s /dev/stdin <<EOF 38178479Sjb #pragma D option bufsize=128k 39178479Sjb 40178479Sjb cpc:::PAPI_tot_ins-all-10000 41178479Sjb { 42178479Sjb @[probename] = count(); 43178479Sjb } 44178479Sjb 45178479Sjb tick-1s 46178479Sjb /n++ > 10/ 47178479Sjb { 48178479Sjb exit(0); 49178479Sjb } 50178479SjbEOF 51178479Sjb} 52178479Sjb 53178479Sjbif [ $# != 1 ]; then 54178479Sjb echo expected one argument: '<'dtrace-path'>' 55178479Sjb exit 2 56178479Sjbfi 57178479Sjb 58178479Sjbdtrace=$1 59178479Sjb 60178479Sjbcputrack -c PAPI_tot_ins sleep 20 & 61178479Sjbcputrack_pid=$! 62178479Sjbsleep 5 63178479Sjbscript 2>/dev/null & 64178479Sjb 65178479Sjbwait $cputrack_pid 66178479Sjbstatus=$? 67178479Sjb 68178479Sjbrm $dtraceout 69178479Sjb 70exit $status 71