xref: /titanic_44/usr/src/cmd/sgs/link_audit/man/perfcnt.man (revision 0cd13cbfb4270b840b4bd22ec5f673b2b6a2c02b)
ident "%Z%%M% %I% %E% SMI"
Copyright 2005 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.

CDDL HEADER START

The contents of this file are subject to the terms of the
Common Development and Distribution License, Version 1.0 only
(the "License"). You may not use this file except in compliance
with the License.

You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
or http://www.opensolaris.org/os/licensing.
See the License for the specific language governing permissions
and limitations under the License.

When distributing Covered Code, include this CDDL HEADER in each
file and include the License file at usr/src/OPENSOLARIS.LICENSE.
If applicable, add the following below this CDDL HEADER, with the
fields enclosed by brackets "[]" replaced with your own identifying
information: Portions Copyright [yyyy] [name of copyright owner]

CDDL HEADER END

perfcnt 1 "18 Nov 1996"
NAME
perfcnt - trace the amount of time spent in each function call
SYNOPSIS
perfcnt [ -f bindfromlist ] [ t bindtolist ] [ -l perfcntlib ] executable [executable arguments ...]
AVAILABILITY

SUNWosdem

DESCRIPTION
perfcnt executes the specified command and tracks the amount of time that is spent in each procedure call. perfcnt traces all of the procedure calls that occur between dynamic objects via the Procedure Linkage Table, so only those procedure calls which are bound to the Procedure Linkage Table will be traced.

perfcnt has the limitation that it does not work with a threaded program nor any programs which use procedures which are dependent upon the stack frame. See NOTES below

OPTIONS

10 -f " bindfromlist" A colon seperated list of libraries that are to be traced. Only calls from these libraries will be traced. The default is to trace all calls.

-t " bindtolist" A colon seperated list of libraries taht are to be traced. Only calls to these libraries will be traced. The default is to trace all calls.

-l " perfcntlib" specify an alternate perfcnt.so Link-Auditing library to use.

EXAMPLES
The example tracks the usage of the libelf.so.1 library when performing a nm.

% perfcnt -t/usr/lib/libelf.so.1 nm /usr/lib/libc.so.1
/usr/lib/libc.so.1:

[Index] Value Size Type Bind Other Shndx Name

[457] | 0| 0|NOTY |LOCL |0 |UNDEF |
[2] | 148| 0|SECT |LOCL |0 |1 |
[3] | 15232| 0|SECT |LOCL |0 |2 |
[4] | 45120| 0|SECT |LOCL |0 |3 |
[5] | 64024| 0|SECT |LOCL |0 |4 |
\.\.\.
[1893] | 347660| 88|FUNC |LOCL |0 |12 |ypstub_perror
[1895] | 347280| 380|FUNC |LOCL |0 |12 |ypstub_sperror
[714] | 663472| 8|OBJT |LOCL |0 |22 |zero


Perf Counts for: nm

 SYMBOL c_count tim avg. tim tot. %
---------------------------------------------------------------------
 elf_getscn 1 4.03 4.03 0.01%
 elf_kind 1 4.36 4.36 0.01%
 _elf32_fsize 7 50.80 7.26 0.09%
 _elf32_xlatetom 6 67.47 11.24 0.11%
 elf_version 1 72.50 72.50 0.12%
 elf32_getshdr 33 77.42 2.35 0.13%
 elf_nextscn 33 83.36 2.53 0.14%
 elf_end 1 131.91 131.91 0.22%
 elf_getdata 2 138.74 69.37 0.23%
 elf_begin 1 171.74 171.74 0.29%
 elf32_getehdr 1 214.81 214.81 0.36%
 _elf_getscn 4254 9755.89 2.29 16.38%
 elf_strptr 4254 48784.97 11.47 81.91%
---------------------------------------------------------------------
 Total Time: 59557.98

NOTES
The perfcnt command is a demonstration of the Link-Auditing interface of the run-time linker (which is documented in .TZ LLM \), and it is not usefull in all environments. This program will not work with a threaded application and should not be used with one. Also, in order to track the time spent in a procedure both the entry and exit of the procedure must be tracked. Because this causes an additional stack frame to be created for each procedure call it is not compatible with all library routines. More details on this can be found in the Link-Auditing section of .TZ LLM
SEE ALSO
ld.so.1 (1)

.TZ LLM