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.

4.4 PROCESS- AND PROCESSOR-SPECIFIC TOOLS 73<br />

time is the time between when the process started and when it completed. A multithreaded<br />

process will typically report a combined user and system time that is<br />

greater than the wall time. The tools do differ in output format. The tool timex<br />

can be passed additional options that will cause it to report more information.<br />

% time <br />

Example 4.30 Syntax of the time Command<br />

4.4.3 Reporting System-Wide Hardware Counter Activity (cpustat)<br />

cpustat first shipped with <strong>Solaris</strong> 8. It is a tool for inspecting the hardware performance<br />

counters on all the processors in a system. The performance counters<br />

report events that occur to the processor. For example, one counter may be incremented<br />

every time data is fetched from memory, and another counter may be<br />

incremented every time an instruction is executed. The events that can be counted,<br />

and the number of events that can be counted simultaneously, are hardwaredependent.<br />

Opteron processors can typically count four different event types at the<br />

same time, whereas UltraSPARC processors typically only count two. We will discuss<br />

hardware performance counters in greater depth in <strong>Chapter</strong> 10.<br />

cpustat reports the number of performance counter events on a system-wide<br />

basis, hence it requires superuser permissions to run. So, if multiple programs are<br />

running, the reported values will represent the events encountered by all programs.<br />

If the system is running a mix of workloads, this information may not be of<br />

great value, but if the system is performing a single job, it is quite possible that<br />

this level of aggregation of data will provide useful information.<br />

Assume that the system is dedicated to a single task—the program of interest—and<br />

the program is in some kind of steady state (e.g., it is a Web server that<br />

is dealing with many incoming requests). The command line for cpustat, shown<br />

in Example 4.31, is appropriate for an UltraSPARC IIICu-based system. The output<br />

is a way of determining which performance counters are worth further investigation.<br />

Example 4.31 Sample Command Line for cpustat to Collect System-Wide Stats<br />

$ cpustat -c pic0=Dispatch0_IC_miss,pic1=Dispatch0_mispred,sys \<br />

-c pic0=Rstall_storeQ,pic1=Re_DC_miss,sys \<br />

-c pic0=EC_rd_miss,pic1=Re_EC_miss,sys \<br />

-c pic0=Rstall_IU_use,pic1=Rstall_FP_use,sys \<br />

-c pic0=Cycle_cnt,pic1=Re_PC_miss,sys \<br />

-c pic0=Instr_cnt,pic1=DTLB_miss,sys \<br />

-c pic0=Cycle_cnt,pic1=Re_RAW_miss,sys

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

Saved successfully!

Ooh no, something went wrong!