Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Operating system Diagnostic tools truss, pstack, and pmap

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

Operating system diagnosis tools truss, pstack, and pmaptrussTruss is an UNIX utility to trace Unix System Calls in Solaris platform. Truss utility is very useful tounderstand complex problems at OS level. As Truss utility generates enormous amount of data,Oracle Database Instrumentation is always a first step to troubleshoot a problem. If the problemcannot be distilled by Oracle Database instrumentation, then the use of OS tools such as truss,pstack etc are required.To trace a process and print minimal information:truss-p Example: truss-p 23898To trace a process, follow its children and print minimal information:truss-f-p Example: truss-f-p 23898To trace a process, print timestamp and print minimal information:truss-d-p Example: truss-d-p 23898To trace a process Send output to a file and print minimal information:truss-o / tmp/truss.out-p Example: truss-o / tmp/truss.out-d-p 23898Utility in UNIX platformPlatform NameSolaris trussHP-UX TUSC (truss) Linux straceAIX trussTruss of DBWR with-d-D flag$ truss-d-D-p 1473 | moreTruss of DBWR with-d-D flag$ truss-d-E-p 19001 | moreTruss of DB startup with-f flag$ truss-d-E-f-p 2522 | more is under Linux $strace-ttT-p 5164AIX & HPHP-UX operating system provides TUSC a tool similar to truss utility. But, truss is soft linked to tuscutility and supports many options as in truss utility in Solaris. Essentially, discussions for Solaris,applies to HP-UX platform too.In AIX, truss is available too. But, truss in AIX does not support-E flag. There is no easy way tomeasure amount of time elapsed in the system call itself using truss utility (at least, not that I know of). Pmappmap command can be used to understand virtual memory mapping of an UNIX process, memoryusage, and attributes of memory area etc.In AIX, this tool is named as procmapIn Linux, & HP-UX Pmap is availablepmap-xs output$ pmap-x 2540 | morepmap-xs outputPmap-xs pmap $pmap-x 2540 | more2540: ora_pmon_solrac2Address Kbytes RSS Anon Locked Mode Mapped File0000000000400000 232736 37864-- oracle000000000E757000 1424 476 144-rw--- oracle000000000E8BB000 15632-rw--- oracle000000000E8E2000 1972 1132 1124-rw--- [heap] 00000060000000 526336 321508-rwxs- [dismshmid=0x3b] FFFFFD7FFCAA0000 64-rwx-- [anon] FFFFFD7FFCABE000 728-rw--- [anon] FFFFFD7FFCAD0000 64 12 12 -rw--- [anon] FFFFFD7FFCAE0000 64 20 20-rw--- [anon]..-- total Kb 780044 368316 2072-Pmap prints a Nice memory mapof the Process. Various heaps andStacks are printed herepmappings! / bin/kshpid=$1 ((cnt=1000)) while [[$cnt- gt 0]]; dodatepmap-x $pidpstack $pidecho $cnt ((cnt=cnt-1)) sleep 10done---A small shell script, to dump Memory map and stack of a process, in a loop,every 10 secondspstackUtility pstack can print the current execution stack of a process. Oracle Databaseprocesses are instrumented to measure performance and most performance issues can beresolved using that instrumentation. Database processes are usually in one of these threestates, either executing a piece of code, waiting for an event such as I/O, or waiting inCPU scheduling queue to be scheduled.To measure performance of a program, optimal task is to alter the session to enable sqltrace and execute the program. But, that is not always possible in a productionenvironment. So, if a program is running longer in production, you can review the ASHdata to measure the waits. But, if the program is not suffering from waits and spendingtime executing in CPU, how do you measure the performance of a program?Utility pstack comes handy in these situations. Essentially, current execution stack of aprocess can be printed using pstack utility. Using pstack in a loop, you can generate manysamples of execution stack of a process; with some aggregation, you can understand theperformance of a process better.In AIX, this tool is named as procstackpstack output$pstack 2544Pfiles:? Pfiles can be used to associate this file ids with file names.? Pfiles lists the files currently opened by a process. In fewunix platform, this can be achieved by lsof commandalso.Many tools available, aka proc toolspflags, pcred, pldd, psig, pstack, pfiles, pwdx,pstop, prun, pwait, ptree, ptimeOradebug utility can be used to print the call stack too. In Listing 1-14, call stack of theprocess is printed in the current process, using setmypid command.Listing 1-14 oradebugSQL > oradebug setmypidStatement processed.SQL > oradebug short_stackksedsts () + 1123

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report