17c478bd9Sstevel@tonic-gate#!/bin/ksh 27c478bd9Sstevel@tonic-gate# 37c478bd9Sstevel@tonic-gate# CDDL HEADER START 47c478bd9Sstevel@tonic-gate# 57c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the 6*20c1c355SRod Evans# Common Development and Distribution License (the "License"). 7*20c1c355SRod Evans# You may not use this file except in compliance with the License. 87c478bd9Sstevel@tonic-gate# 97c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate# and limitations under the License. 137c478bd9Sstevel@tonic-gate# 147c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate# 207c478bd9Sstevel@tonic-gate# CDDL HEADER END 217c478bd9Sstevel@tonic-gate# 22*20c1c355SRod Evans 237c478bd9Sstevel@tonic-gate# 24*20c1c355SRod Evans# Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. 257c478bd9Sstevel@tonic-gate# 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gateusage() { 287c478bd9Sstevel@tonic-gate echo "usage: perfcnt -[$optlet] utility [utility arguments]" 297c478bd9Sstevel@tonic-gate echo " -f <bindfromlist>" 307c478bd9Sstevel@tonic-gate echo " A colon seperated list of libraries that are to be" 317c478bd9Sstevel@tonic-gate echo " traced. Only calls from these libraries will be" 327c478bd9Sstevel@tonic-gate echo " traced. The default is to trace all calls." 337c478bd9Sstevel@tonic-gate echo " -t <bindtolist>" 347c478bd9Sstevel@tonic-gate echo " A colon seperated list of libraries that are to be" 357c478bd9Sstevel@tonic-gate echo " traced. Only calls to these libraries will be" 367c478bd9Sstevel@tonic-gate echo " traced. The default is to trace all calls." 377c478bd9Sstevel@tonic-gate echo " -l <perfcntlib>" 387c478bd9Sstevel@tonic-gate echo " Specify an alternate perfcnt.so to use." 397c478bd9Sstevel@tonic-gate} 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gatebindto="" 427c478bd9Sstevel@tonic-gatebindfrom="" 437c478bd9Sstevel@tonic-gateperfcntlib32="/opt/SUNWonld/lib/32/perfcnt.so.1" 447c478bd9Sstevel@tonic-gateperfcntlib64="/opt/SUNWonld/lib/64/perfcnt.so.1" 457c478bd9Sstevel@tonic-gate 467c478bd9Sstevel@tonic-gateoptlet="f:t:l:" 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gateif [[ $# -lt 1 ]]; then 497c478bd9Sstevel@tonic-gate usage 507c478bd9Sstevel@tonic-gate exit 1 517c478bd9Sstevel@tonic-gatefi 527c478bd9Sstevel@tonic-gate 537c478bd9Sstevel@tonic-gatewhile getopts $optlet c 547c478bd9Sstevel@tonic-gatedo 557c478bd9Sstevel@tonic-gate case $c in 567c478bd9Sstevel@tonic-gate f) 577c478bd9Sstevel@tonic-gate bindfrom="$OPTARG" 587c478bd9Sstevel@tonic-gate ;; 597c478bd9Sstevel@tonic-gate t) 607c478bd9Sstevel@tonic-gate bindto="$OPTARG" 617c478bd9Sstevel@tonic-gate ;; 627c478bd9Sstevel@tonic-gate l) 637c478bd9Sstevel@tonic-gate perfcntlib32="$OPTARG" 647c478bd9Sstevel@tonic-gate perfcntlib64="$OPTARG" 657c478bd9Sstevel@tonic-gate ;; 667c478bd9Sstevel@tonic-gate \?) 677c478bd9Sstevel@tonic-gate usage 687c478bd9Sstevel@tonic-gate exit 1 697c478bd9Sstevel@tonic-gate ;; 707c478bd9Sstevel@tonic-gate esac 717c478bd9Sstevel@tonic-gatedone 727c478bd9Sstevel@tonic-gateshift `expr $OPTIND - 1` 737c478bd9Sstevel@tonic-gate 747c478bd9Sstevel@tonic-gate# 757c478bd9Sstevel@tonic-gate# Build environment variables 767c478bd9Sstevel@tonic-gate# 777c478bd9Sstevel@tonic-gate 787c478bd9Sstevel@tonic-gatePERFCNT_BINDTO="$bindto" \ 797c478bd9Sstevel@tonic-gatePERFCNT_BINDFROM="$bindfrom" \ 807c478bd9Sstevel@tonic-gateLD_AUDIT_32="$perfcntlib32" \ 817c478bd9Sstevel@tonic-gateLD_AUDIT_64="$perfcntlib64" \ 827c478bd9Sstevel@tonic-gate$* 837c478bd9Sstevel@tonic-gate 847c478bd9Sstevel@tonic-gateexit 0 85