05.08.2013 Views

Solaris Application Programming, 1/e - Chapter 4 - Parent Directory

Solaris Application Programming, 1/e - Chapter 4 - Parent Directory

Solaris Application Programming, 1/e - Chapter 4 - Parent Directory

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

78 <strong>Chapter</strong> 4 Informational Tools<br />

It is possible to make trapstat run on a single process. The command line for<br />

this is shown in Example 4.37.<br />

Example 4.37 Command Line to Run trapstat on a Single Program<br />

# trapstat <br />

At the end of the run of the process, this will report the number of traps that the<br />

single process caused. The figures will be reported (by default) as the number of<br />

traps per second.<br />

4.4.7 Reporting Virtual Memory Mapping Information for a<br />

Process (pmap)<br />

The pmap utility returns information about the address space of a given process.<br />

Possibly the most useful information the utility returns is information about the<br />

page size mapping returned under the -s option.<br />

Example 4.38 shows a sample of output from the pmap utility under the -s<br />

option. The output is useful in that it shows where the code and data are located in<br />

memory, as well as where the libraries are located in memory. For each memory<br />

range, a page size is listed in the Pgsz column. In this case, all the memory has<br />

been allocated on 8KB pages (I discussed page sizes in Section 1.9.2 of <strong>Chapter</strong> 1).<br />

Output from pmap is the best way to determine whether an application has successfully<br />

obtained large pages.<br />

Example 4.38 pmap -s Output<br />

% pmap -s 7962<br />

7962: ./myapp params<br />

Address Kbytes Pgsz Mode Mapped File<br />

00010000 272K 8K r-x-- /export/home/myapp<br />

00054000 80K - r-x-- /export/home/myapp<br />

00068000 32K 8K r-x-- /export/home/myapp<br />

0007E000 48K 8K rwx-- /export/home/myapp<br />

...<br />

000D2000 2952K 8K rwx-- [ heap ]<br />

...<br />

004D4000 1984K 8K rwx-- [ heap ]<br />

006C4000 8K - rwx-- [ heap ]<br />

006C6000 50944K 8K rwx-- [ heap ]<br />

...<br />

FF210000 8K 8K r-x-- /usr/platform/sun4u-us3/lib/libc_psr.so.1<br />

FF220000 32K 8K r-x-- /opt/SUNWspro/prod/usr/lib/libCrun.so.1<br />

...

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!