xref: /titanic_41/usr/src/cmd/sgs/link_audit/common/perfcnt.ksh (revision 2b24ab6b3865caeede9eeb9db6b83e1d89dcd1ea)
1#!/bin/ksh
2#
3# CDDL HEADER START
4#
5# The contents of this file are subject to the terms of the
6# Common Development and Distribution License, Version 1.0 only
7# (the "License").  You may not use this file except in compliance
8# with the License.
9#
10# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11# or http://www.opensolaris.org/os/licensing.
12# See the License for the specific language governing permissions
13# and limitations under the License.
14#
15# When distributing Covered Code, include this CDDL HEADER in each
16# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17# If applicable, add the following below this CDDL HEADER, with the
18# fields enclosed by brackets "[]" replaced with your own identifying
19# information: Portions Copyright [yyyy] [name of copyright owner]
20#
21# CDDL HEADER END
22#
23#
24# ident	"%Z%%M%	%I%	%E% SMI"
25#
26# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
27# Use is subject to license terms.
28
29usage() {
30	echo "usage: perfcnt -[$optlet] utility [utility arguments]"
31	echo "	-f <bindfromlist>"
32	echo "		A colon seperated list of libraries that are to be"
33	echo "		traced.  Only calls from these libraries will be"
34	echo "		traced.  The default is to trace all calls."
35	echo "	-t <bindtolist>"
36	echo "		A colon seperated list of libraries that are to be"
37	echo "		traced.  Only calls to these libraries will be"
38	echo "		traced.  The default is to trace all calls."
39	echo "	-l <perfcntlib>"
40	echo "		Specify an alternate perfcnt.so to use."
41}
42
43bindto=""
44bindfrom=""
45perfcntlib32="/opt/SUNWonld/lib/32/perfcnt.so.1"
46perfcntlib64="/opt/SUNWonld/lib/64/perfcnt.so.1"
47
48optlet="f:t:l:"
49
50if [[ $# -lt 1 ]]; then
51	usage
52	exit 1
53fi
54
55while getopts $optlet c
56do
57	case $c in
58	f)
59		bindfrom="$OPTARG"
60		;;
61	t)
62		bindto="$OPTARG"
63		;;
64	l)
65		perfcntlib32="$OPTARG"
66		perfcntlib64="$OPTARG"
67		;;
68	\?)
69		usage
70		exit 1
71		;;
72	esac
73done
74shift `expr $OPTIND - 1`
75
76#
77# Build environment variables
78#
79
80PERFCNT_BINDTO="$bindto" \
81PERFCNT_BINDFROM="$bindfrom" \
82LD_AUDIT_32="$perfcntlib32" \
83LD_AUDIT_64="$perfcntlib64" \
84$*
85
86exit 0
87