Skip to main content

AIX 5.2 performance tools update, Part 2

Nam Keung (namkeung@us.ibm.com), Technical Consultant, IBM, Software Group
Nam Keung is a senior programmer for IBM in Austin, TX. He has worked in the area of AIX ISDN communication, AIX SOM/DSOM development, AIX Multimedia development, NT Clustering technology and Java performance. His current assignment involves helping ISVs in porting, deploying applications, performance tuning, and education for the pSeries platform. He has been a programmer with IBM since 1987. Nam can be reached at namkeung@us.ibm.com.

Summary:  This is the second article in a series about new and enhanced AIX® 5.2 performance tools. This article discusses how the tools further empower AIX developers in debugging system and application performance behavior. The vastly improved system tuning utilities in AIX 5.2 help developers and administrators analyze, capture, and identify application and system performance behavior and problems.

Part 1 covers the elements of the new 5.2 performance tuning framework, which makes it possible to have all the kernel tuning commands work consistently. It also has detailed descriptions of each new or modified kernel tuning command.

Date:  20 Nov 2003
Level:  Introductory
Activity:  1529 views

Introduction

The following tools are discussed in this article:


/proc file system

On AIX 5.2, the /proc file system can be used by both 32-bit and 64-bit control processes to get additional information about target processes using the new tools procwdx and procfiles. Two new directories, /proc/pid#/cwd and /proc/pid#/fd, have been created.

The /proc files contain data that presents the state of processes and threads in the system. This state is constantly changing while the system is operating. To lessen the load on system performance caused by reading /proc files, the /proc file system does not stop system activity while gathering the data for those files. A single read of a /proc file generally returns a coherent and fairly accurate representation of process or thread state. Because the state changes as the process or thread runs, multiple reads of /proc files may return representations that show different data and therefore appear to be inconsistent with each other.


/proc tools

The 12 simple utilities, similar to tools provided on Solaris, are very useful to developers for debugging and analyzing processes behavior. The /proc file system gives access to information about the current state of processes and threads, but in binary form. The /proc tools commands provide ASCII reports based on some of the available information.

You should exercise caution when using the -F flag. The procfiles, procldd, procmap, and procstack /proc tools stop their target processes while inspecting them and reporting the results. A process can do nothing while interrupt is stopped. Imposing two controlling processes on one victim process can lead to chaos.

On AIX 5.2, some of the proc tools cannot be applied to core files, and the ptime command is not available.

The proc tools are utilities that exercise features of /proc. Most of them take a list of process-ids (pid); those that do also accept /proc/nnn as a process-id, so the shell expansion /proc/* can be used to specify all processes in the system.


Table 1. Differences between Solaris and AIX 5.2
Solaris 2.9 AIX 5.2
pflags [-r] [pid | core] procflags [-r] [pid]
pcred [pid | core] proccred [pid]
pmap [-rxIF] [pid | core]procmap [-F] [pid]
pldd [-F] [pid | core]procldd [-F] [pid]
pstack [-F] [pid | core]procstack [-F] [pid]
pfiles [-F] [pid]procfiles [-nF] [pid]
ptime command [argument]Not available
proctree
Displays the process tree containing the specified process IDs or users. To display the ancestors and all the children of process 12312, enter:
> proctree 21166
11238    /usr/sbin/srcmstr
  21166    /usr/sbin/rsct/bin/IBM.AuditRMd

To display the ancestors and children of process 21166, including children of process 0, enter:

> proctree –a 21166 
1    /etc/init
   11238    /usr/sbin/srcmstr
      21166    /usr/sbin/rsct/bin/IBM.AuditRMd

procstack
Displays the hexadecimal addresses and symbolic names for each of the stack frames of the current thread in processes. To display the current stack of process 15052, enter:
> procstack 15052
15052 : /usr/sbin/snmpd
d025ab80  select   (?, ?, ?, ?, ?) + 90
100015f4  main   (?, ?, ?) + 1814
10000128  __start   () + 8c

Currently, procstack displays garbage or wrong information for the top stack frame, and possibly for the second top stack frame. Sometimes it will erroneously display "No frames found on the stack," and sometimes it will display: deadbeef ???????? (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ...) The fix for this problem had not been released at the writing of this article. When the fix becomes available, you need to download the APAR IY48543.

procmap
Displays a process address map. To display the address space of process 13204, enter:
>procmap  13204 
13204 : /usr/sbin/biod 6
10000000	  3K	read/exec	biod
20000910	  0K	read/write	biod
d0083100	 79K	read/exec	/usr/lib/libiconv.a
20013bf0	 41K	read/write	/usr/lib/libiconv.a
d007a100	 34K	read/exec	/usr/lib/libi18n.a
20011378	  4K	read/write	/usr/lib/libi18n.a
d0074000	 11K	read/exec	/usr/lib/nls/loc/en_US
d0077130	  8K	read/write	/usr/lib/nls/loc/en_US
d00730f8	  2K	read/exec	/usr/lib/libcrypt.a
f03c7508	  0K	read/write	/usr/lib/libcrypt.a
d01d4e20    1997K	read/exec 	/usr/lib/libc.a
f0337e90     570K	read/write	/usr/lib/libc.a

procldd
Displays a list of libraries loaded by a process. To display the list of dynamic libraries loaded by process 11928, enter > procldd 11928. The output of this command might look like:
 11928 : -sh
 /usr/lib/nls/loc/en_US
 /usr/lib/libcrypt.a
 /usr/lib/libc.a

procflags
Displays a process tracing flags, and the pending and holding signals. To display the tracing flags of process 28138, enter:
> procflags 28138
28138 : /usr/sbin/rsct/bin/IBM.HostRMd
data model = _ILP32 flags = PR_FORK
/64763: flags = PR_ASLEEP | PR_NOREGS
/66315: flags = PR_ASLEEP | PR_NOREGS
/60641: flags = PR_ASLEEP | PR_NOREGS
/66827: flags = PR_ASLEEP | PR_NOREGS
/7515: flags = PR_ASLEEP | PR_NOREGS
/70439: flags = PR_ASLEEP | PR_NOREGS
/66061: flags = PR_ASLEEP | PR_NOREGS
/69149: flags = PR_ASLEEP | PR_NOREGS

procsig
Lists the signal actions for a process. To list all the signal actions defined for process 30552, enter:
> procsig 30552
30552 : -ksh
HUP caught
INT caught
QUIT caught
ILL caught
TRAP caught
ABRT caught
EMT caught
FPE caught
KILL default RESTART BUS caught

proccred
Prints a process' credentials. To display the credentials of process 25632, enter:
> proccred  25632
25632: e/r/suid=0  e/r/sgid=0

procfiles
Prints a list of open file descriptors. To display status and control information on the file descriptors opened by process 20138, enter:
> procfiles –n 20138
20138 : /usr/sbin/rsct/bin/IBM.CSMAgentRMd
  Current rlimit: 2147483647 file descriptors
   0: S_IFCHR mode:00 dev:10,4 ino:4178 uid:0 gid:0 rdev:2,2
      O_RDWR  name:/dev/null
   2: S_IFREG mode:0311 dev:10,6 ino:250 uid:0 gid:0 rdev:0,0
      O_RDWR size:0   name:/var/ct/IBM.CSMAgentRM.stderr
   4: S_IFREG mode:0200 dev:10,6 ino:255 uid:0 gid:0 rdev:0,0

procwdx
Prints the current working directory for a process. To display the current working directory of process 11928, enter:
 > procwdx 11928
11928 :  /home/guest

procstop
Stops a process. To stop process 7500 on the PR_REQUESTED event, enter >procstop 7500.
procrun
Restart a process. To restart process 30192 that was stopped on the PR_REQUESTED event, enter > procrun 30192.
procwait
Waits for all of the specified processes to terminate. To wait for process 12942 to exit and display the status, enter > procwait -v 12942. The output of this command might look like:
12942 : terminated, exit status 0


pstat command

The pstat command, which displays many system tables such as a process table, inode table, or processor status table, has been ported to AIX 5.2 with the same functions. The pstat command interprets the contents of the various system tables and writes it to standard output.

This command is not supported on Solaris 2.9. Use the pstat command from the AIX 5.2 command prompt. See the command reference for details and examples, or use the syntax summary in Table 2 below.


Table 2. Flags
-aDisplays entries in the process table
-ADisplays all entries in the kernel thread table
-fDisplays the file table
-iDisplays the i-node table and the i-node data block addresses
-pDisplays the process table
-PDisplays runnable kernel thread table entries only
-sDisplays information about the swap or paging space usage
-SDisplays the status of the processors
-tDisplays the tty structures
-u ProcSlotDisplays the user structure of the process in the designated slot of the process table. An error message is generated if you attempt to display a swapped out process.
-TDisplays the system variables. These variables are briefly described in var.h
-U ThreadSlot Displays the user structure of the kernel thread in the designated slot of the kernel thread table. An error message is generated if you attempt to display a swapped out kernel thread.

To display all threads in the kernel thread table and the user structure of the thread in thread table slot 0, enter:

>pstat -A -U 0
THREAD TABLE:

SLT ST    TID      PID    CPUID  POLICY PRI CPU    EVENT  PROCNAME    FLAGS
  0 s       3        0  unbound    FIFO  10  78            swapper
        flags:  kthread
  1 s     103        1  unbound   other  3c   0               init
        flags:  local wakeonsig cdefer unknown: 0x10000
  2 r     205      204        0    FIFO  ff  78               wait
        flags:  funnel kthread
  3 r     307      306        1    FIFO  ff  78               wait
        flags:  funnel kthread
  4 s     409      408  unbound      RR  11   0             reaper
        flags:  kthread
  
UTHREAD AREA:

        UTHREAD AREA FOR SLOT   0 (swapper)

SAVED MACHINE STATE
    m/q:0x00000000  iar:0x0004baa8  cr:0x28222024
    msr:0x000010b2    lr:0x0004baa8   xer:0x20000018  kjmpbuf:0x00000000
    backtrack:0x00   tid:0x00000000  fpeu:0x01       excp_type:0x00000000
    ctr:0x00000000 *prevmst:0x00000000 *stackfix:0x2ff3b2a8 intpri:0x00
    …

General Purpose Regs
          0x00000000  0x40000000  0x00054035  0xdff3c000  0x00000106
    Adspace:
MST Segment Regs
     0:0x00000000   1:0x0003800e   2:0x00044011   3:0x0003c00f
     4:0x007fffff   5:0x007fffff   6:0x007fffff   7:0x0003402d
     …
     
General Purpose Regs
     0:0x00037ae4   1:0x2ff3b2a8   2:0x00675148   3:0xe2000154
     4:0xffff0000   5:0x01fe4400   6:0x00000003   7:0x00000000
     8:0x0017b140   9:0x00000001  10:0x2ff3b338  11:0x0017b140
    12:0x000010b2  13:0x01066178  14:0x01000085  15:0x00000000
    ….

SYSTEM CALL STATE
    error code:0x00  *kjmpbuf:0x00000000

PER-THREAD TIMER MANAGEMENT
    timer[0] = 0x0

SIGNAL MANAGEMENT
    *sigsp:0x000000000   code:0x0

MISCELLANOUS FIELDS:
   fstid:0x00000000   ioctlrv:0x00000000   selchn:0x00000000
   link:0x00000000   loginfo:0x00000000   fselchn:0x00000000
   selbuc:0x00000000sigssz:0x0000000000000000 User msr:0x0000000000000000
   *context:0x0000000000000000   **errnopp:0x00000000c0c0fade
   *stkb:0x0000000000000000
   *audsvc:0x00000000     scsave[0]:0x00000000   scsave[1]:0x00000000
   …

USER AREA:

   USER AREA OF ASSOCIATED PROCESS swapper (SLOT   0, PROCTAB 0x01fe4200)
    handy_lock:0x00000000  timer_lock:0x00000000
    map:0x00000000  *semundo:0x00000000  *pinu_block:0x00000000
    compatibility:0x00000001  lock:0x00000000
    ulocks:0x00000000  *message:0x00000000  irss:0x0000000000000000
    lock_word:0x00000000  *vmm_lock_wait:0x00000000  vmmflags:0x00000000

SIGNAL MANAGEMENT
   Signals to be blocked (sig#:hi/lo mask,flags,&func)
     1:hi 0x00000000,lo 0x00000000,0x00000000,0x00000000

INTERNAL SIGNALS
    64:hi 0x00000000,lo 0x00000000,0x00000000,0x00000000
    65:hi 0x00000000,lo 0x00000000,0x00000000,0x00000000
    
USER INFORMATION
   CRED Structure Not Found


ACCOUNTING DATA
    start:0x3f818c87  ticks:0x00000000  acflag:0x0000  pr_base:0x00000000
    pr_size:0x00000000  pr_off:0x00000000  pr_scale:0x00000000
    process times:
           user:0x00000000s 0x00000000us
            sys:0x00000000s 0x0007df0dus
    children's times:
           user:0x00000000s 0x00000000us
            sys:0x00000000s 0x00000000us

CONTROLLING TTY
    *ttysid:0x00000000  *ttyp(pgrp):0x00000000
    ttyd(evice):0x00000000  ttympx:0x00000000  *ttys(tate):0x00000000
    tty id: 0x00000000  *query function: 0x00000000

RESOURCE LIMITS AND COUNTERS
    ior:0x00000000  iow:0x00000000  ioch:0x00000000
    text:0x0000000000000000  data:0x0000000000000000  stk:0x01000000
    max data:0x08000000  max stk:0x01000000  max file(blks):0xffffffff
    *tstart:0x00000000  sdsize:0x00000000
    *datastart:0x00000000  *stkstart0x20000000
    U_minbreak:0x0000000020000000  U_breakhiwater 0000000020000000
    U_min_mmap:0x0000000000000000 U_brkseg 00000002 U_stkseg 00000002
FILE SYSTEM STATE
    *curdir:0x00000000  *rootdir:0x00000000
    cmask:0x0000  maxindex:0x00000000
    U_fd_slcks[0].u_fd_slock:0x00000000
    U_fd_slcks[1].u_fd_slock:0x00000000
    U_fd_slcks[2].u_fd_slock:0x00000000
    fso_lock:0x00000000  lockflag:0x00000000  fdevent:0x00000000

FILE DESCRIPTOR TABLE
    *ufd: 0x2ff3cee8

To display the system variables, enter:

> pstat -T
SYSTEM VARS:

Buffers	20
Files		853
e_files	853
procs		262144
e_procs	128
threads	524288
e_threads	224
clists		16384
maxproc	128
	…

To display the current kernel table entries, enter:

	
> pstat -P
THREAD TABLE:

SLT ST    TID      PID    CPUID  POLICY PRI CPU    EVENT  PROCNAME     FLAGS
  2 r     205      204        0    FIFO  ff  78               wait
        flags:  funnel kthread  
 67 r    435f     619c  unbound   other  3c   6              pstat
        flags:

To display the process tables, enter:

> pstat -p
PROC TABLE:

SLT ST    PID   PPID   PGRP   UID  EUID  TCNT  NAME
  2 a     204      0      0     0     0     1  wait
        FLAGS:swapped_inno_swapfixed_prikproc
  3 a     306      0      0     0     0     1  wait
        FLAGS:swapped_inno_swapfixed_prikproc
124 a    7cc2   6fae   7cc2     0     0     1  pstat
        FLAGS:swapped_in execed

To display the processors, enter:

> pstat -S
STATUS OF PROCESSORS:

CPU     TID  TSLOT     PID  PSLOT  PROC_NAME
  0     205      2     204      2  wait
  1    5ab7     90    7cc4    124  pstat

To display the paging space, enter:

> pstat -s
PAGE SPACE:

          USED PAGES   FREE PAGES
             1261       129811


Truss

The truss command is also available for SVR4 UNIX-based environments. This command is useful for tracing system calls in one or more processes. In AIX 5.2, all base system call parameter types are now recognized. In AIX 5.1, only about 40 system calls were recognized.

Truss is a /proc based debugging tool that executes and traces a command, or traces an existing process. It prints names of all system calls made with their arguments and return code. System call parameters are displayed symbolically. It prints information about all signals received by a process. The AIX 5.2 version supports library calls tracing. For each call, it prints parameters and return codes. It can also trace a subset of libraries and a subset of routines in a given library. The timestamps on each line are also supported.

In AIX 5.2, truss is packaged with bos.sysmgt.serv_aid, which is installable from the AIX base installation media. See the command reference for details and examples, or use the information below.

-a Displays the parameter strings that are passed in each executed system call.

> truss –a  sleep
execve("/usr/bin/sleep", 0x2FF22980, 0x2FF22988)  argc: 1
argv: sleep
sbrk(0x00000000)                                = 0x200007A4
sbrk(0x00010010)                                = 0x200007B0
getuidx(4)                                             = 0
…
…
__loadx(0x01000080, 0x2FF1E790, 0x00003E80, 0x2FF22720, 0x00000000) = 
   0xD0077130 access("/usr/lib/nls/msg/en_US/sleep.cat", 0)   = 0
_getpid()                                       = 31196
open("/usr/lib/nls/msg/en_US/sleep.cat", O_RDONLY) = 3
kioctl(3, 22528, 0x00000000, 0x00000000)        Err#25 ENOTTY
kfcntl(3, F_SETFD, 0x00000001)                  = 0
kioctl(3, 22528, 0x00000000, 0x00000000)        Err#25 ENOTTY
kread(3, "\0\001 ∙\001\001 I S O 8".., 4096)    = 123
lseek(3, 0, 1)                                  = 123
lseek(3, 0, 1)                                  = 123
lseek(3, 0, 1)                     	             = 123
_getpid()                         	             = 31196
lseek(3, 0, 1)                     	             = 123
Usage: sleep Seconds
kwrite(2, " U s a g e :   s l e e p".., 21) 	    = 21
kfcntl(1, F_GETFL, 0x00000000)           	    = 2
kfcntl(2, F_GETFL, 0x00000000)           	    = 2
_exit(2)

-c Counts traced system calls, faults, and signals rather than displaying trace results line by line. A summary report is produced after the traced command terminates or when truss is interrupted. If the -f flag is also used, the counts include all traced Syscalls, Faults, and Signals for child processes.

	> truss –c ls
	syscall			seconds   	calls  errors
execve				.00		1
__loadx			.00	      17
_exit				.00		1
close				.00		2
kwrite				.00		5
lseek                     	.00		1
setpid                   	.00	       1
getuidx                   	.00	      19
getdirent                 	.00	       3
kioctl                    	.00	       3
open                      	.00	       1
statx                     	.00	       2
getgidx                   	.00	      18
sbrk                      	.00	       4
access                    	.00	       1
kfcntl                    	.00	       6
                         	----	     ---    ---
sys totals:               	.01	      85      0
usr time:                 	.00
elapsed:                  	.01

-d A timestamp will be included with each line of output. Time displayed is in seconds relative to the beginning of the trace. The first line of the trace output will show the base time from which the individual time stamps are measured. By default timestamps are not displayed.

	>truss –d sleep
0.0029:        execve("/usr/bin/sleep", 0x2FF22978, 0x2FF22980)  argc: 1
0.0369:        sbrk(0x00000000)                 = 0x200007A4
0.0381:        sbrk(0x0000000C)                 = 0x200007A4
0.0394:        sbrk(0x00010010)                 = 0x200007B0
0.0406:        getuidx(4)                       = 0
0.0416:        getuidx(2)                       = 0
0.0426:        getuidx(1)                       = 0
0.0436:        getgidx(4)                       = 0
0.0446:        getgidx(2)                       = 0
0.0456:        getgidx(1)                       = 0
0.0468:        __loadx(0x01000080, 0x2FF1E780, 0x00003E80, 0x2FF22710, 
   0x00000000) = 0xD0077130 

-D Delta time is displayed on each line of output. The delta time represents the elapsed time for the LWP that incurred the event since the last reported event incurred by that thread. By default delta times are not displayed.

	
	>truss –D sleep
0.0002:        execve("/usr/bin/sleep", 0x2FF22978, 0x2FF22980)  argc: 1
0.0345:        sbrk(0x00000000)                 = 0x200007A4
0.0013:        sbrk(0x0000000C)                 = 0x200007A4
0.0013:        sbrk(0x00010010)                 = 0x200007B0
0.0012:        getuidx(4)                       = 0
0.0010:        getuidx(2)                       = 0
0.0010:        getuidx(1)                       = 0
0.0010:        getgidx(4)                       = 0
0.0011:        getgidx(2)                       = 0
0.0010:        getgidx(1)                       = 0
0.0012:        __loadx(0x01000080, 0x2FF1E780, 0x00003E80, 0x2FF22710, 
   0x00000000) = 0xD007130

-e Displays the environment strings that are passed in each executed system call.

>truss –e ls
execve("/usr/bin/ls", 0x2FF22980, 0x2FF22988)    argc: 1
envp: _=/usr/bin/truss MANPATH=:/opt/freeware/man LANG=en_US
LOGIN=root PAGER=pg ENSCRIPT=-G -broot@nkeung   VISUAL=/usr/bin/vi
RPC_SUPPORTED_PROTSEQS=ncadg_ip_udp
  PATH=/usr/java14/jre/bin:/usr/java14/bin:/usr/opt/ifor/bin:/perf/
     jinsight2.1:/usr/vvac/bin:/usr/vacpp/bin:/usr/bin:/etc:/usr/sbin:/
     usr/ucb:/usr/bin/X11:/sbin:/usr/local/bin:/usr/idebug/bin:/usr/
     lib:/usr/prod/bin:/usr/afs/bin:/usr/vatools/bin:/opt/freeware/bin:.:/
     var/ifo
/usr/opt/ifor/ls/conf

LC__FASTMSG=true CGI_DIRECTORY=/usr/HTTPServer/cgi-bin
EDITOR=/usr/bin/vi PSCH=> TTYNAME=pts/3 LOGNAME=root
MAIL=/usr/spool/mail/root SECONDS=34097 MOZILLA_HOME=/opt/netscape
LOCPATH=/usr/lib/nls/loc PS1=$_place ${PWD}: ${PSCH}
PRINTER=labnetps HOST=nkeung
DOCUMENT_SERVER_MACHINE_NAME=nkeung.austin.ibm.com USER=root
AUTHSTATE=compat DCE_USE_WCHAR_NAMES=1 DEFAULT_BROWSER=netscape
SHELL=/usr/bin/ksh ODMDIR=/etc/objrepos DOCUMENT_SERVER_PORT=80
HOME=/ FCEDIT=/usr/bin/vi TERM=ansi MAILMSG=[YOU HAVE NEW MAIL]
_place=root@nkeung ITECONFIGSRV=/etc/IMNSearch PWD=/home
DOCUMENT_DIRECTORY=/usr/HTTPServer/htdocs TZ=CST6CDT LPDEST=labnetps
ENV=${START[(_$-=1)+(_=0)-(_$-!=_${-%%*i*})]} START=//.kshrc
TRY_PE_SITE=1 ITECONFIGCL=/etc/IMNSearch/clients
ITE_DOC_SEARCH_INSTANCE=search A__z=! LOGNAME
NLSPATH=/usr/lib/nls/msg/%L/%N:/usr/lib/nls/msg/%L/%N.cat
sbrk(0x00000000)                                = 0x20000EA8
…..

-u [!] [LibraryName [...]::[!]FunctionName [...] ] Traces dynamically loaded user level function calls from user libraries. The LibraryName is a comma-separated list of library names. The FunctionName is a comma-separated list of function names. In both cases the names can include name-matching metacharacters *, ?, [] with the same meanings as interpreted by the shell, but as applied to the library or function name spaces, and not to files.

  • To trace all user-level calls made to any function in the C library from outside the C library, enter:

    >truss –u "libc.a::*" ls

  • To trace the open() function call in the libc.a while running the motd command, enter:

    > truss -t open -u 'libc*::*open*' /usr/bin/cat /etc/motd
    open("/etc/motd", 0400000000)                   = 3
    ******************************************************************
    *  
    * Welcome to AIX Version 5.2!                                    *
    *
    * Please see the README file in /usr/lpp/bos for information 
    * pertinent to   *
    * this release of the AIX Operating System.                      *

  • To trace the malloc() function call and exclude the strlen() function call in the libc.a library while running the ls command, enter:

     
    >truss -u libc.a::malloc,!strlen ls
    execve("/usr/bin/ls", 0x2FF22970, 0x2FF22978)    argc: 1
    sbrk(0x00000000)                                = 0x20000EA8
    sbrk(0x00000008)                                = 0x20000EA8
    sbrk(0x00010010)                                = 0x20000EB0
    getuidx(4)                                      = 0
    getuidx(2)                                      = 0
    getuidx(1)                                      = 0
    getgidx(4)                                      = 0
    getgidx(2)                                      = 0
    getgidx(1)                                      = 0
    __loadx(0x01000080, 0x2FF1E760, 0x00003E80, 0x2FF226F0, 0x00000000) = 
       0xD0077130
    ->libc.a:malloc(0xc)
    <-libc.a:malloc() = 20001058            0.000000
    ->libc.a:malloc(0x188)
    <-libc.a:malloc() = 20001078            0.000000
    ->libc.a:malloc(0x40)
    <-libc.a:malloc() = 20001208            0.000000
    ->libc.a:malloc(0x3c)
    <-libc.a:malloc() = 20001258            0.000000

  • To trace all function calls in the libc.a library with names starting with "m" while running the ls command, enter:

     
    >truss -u libc.a::m*,!strlen ls
    execve("/usr/bin/ls", 0x2FF22970, 0x2FF22978)    argc: 1
    ->libc.a:malloc(0xc)
    <-libc.a:malloc() = 20001058            0.000000
    ->libc.a:malloc(0x188)
    ….
    kwrite(1, 0xF0382258, 1)                        = 1
    ->libc.a:mbswidth(0x20021678, 0x9)
    ->libc.a:mbtowc(0x2ff21520, 0x2ff21420, 0x1)
    ->libc.a:mbtowc(0x2ff21522, 0x2ff21421, 0x1)
    ->libc.a:mbtowc(0x2ff21524, 0x2ff21422, 0x1)
    …
    <-libc.a:mbswidth() = 9         0.000000
    .netscapekwrite(1, 0xF0382258, 9)                = 9
    ->libc.a:mbswidth(0x20022af8, 0x8)
    ->libc.a:mbtowc(0x2ff21520, 0x2ff21420, 0x1)
    ->libc.a:mbtowc(0x2ff21522, 0x2ff21421, 0x1)
    ->libc.a:mbtowc(0x2ff21524, 0x2ff21422, 0x1)
    ->libc.a:mbtowc(0x2ff21526, 0x2ff21423, 0x1)
    <-libc.a:mbswidth() = 8         0.000000
                     kdb.corekwrite(1, 0xF0382258, 25)         = 25
    ->libc.a:mbswidth(0x2001f900, 0x3)
    ->libc.a:mbtowc(0x2ff21520, 0x2ff21420, 0x1)
    ->libc.a:mbtowc(0x2ff21522, 0x2ff21421, 0x1)
    ->libc.a:mbtowc(0x2ff21524, 0x2ff21422, 0x1)
    <-libc.a:mbswidth() = 3         0.000000
                      usrkwrite(1, 0xF0382258, 21)              = 21 
    

  • To trace all function calls from the library libcurses.a and exclude calls from libc.a while running executable foo, enter:

    >truss -u libcurses.a,!libc.a::* foo

  • To trace the refresh() function call from libcurses.a and the malloc() function call from libc.a while running the executable foo, enter:

     
    >truss -u libc.a::malloc -u libcurses.a::refresh foo


About the author

Nam Keung is a senior programmer for IBM in Austin, TX. He has worked in the area of AIX ISDN communication, AIX SOM/DSOM development, AIX Multimedia development, NT Clustering technology and Java performance. His current assignment involves helping ISVs in porting, deploying applications, performance tuning, and education for the pSeries platform. He has been a programmer with IBM since 1987. Nam can be reached at namkeung@us.ibm.com.

Comments (Undergoing maintenance)



Trademarks  |  My developerWorks terms and conditions

Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=AIX and UNIX
ArticleID=86503
ArticleTitle=AIX 5.2 performance tools update, Part 2
publish-date=11202003
author1-email=namkeung@us.ibm.com
author1-email-cc=

My developerWorks community

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Special offers