You can monitor performance on Solaris using cputrack
,
a performance monitoring tool that runs outside your process or via the instrumentation of your
program.
Cputrack
has a small performance overhead (I measured about 3% on Sparc T2000
when samples were taken every second).
The overhead could be reduced if you instrument your program to measure performance via cpc library.
(Click here
If you want to do fancy performance instrumentation, such as taking a sample ever N instructions,
you will also need to do your own instrumentation. This code sample
shows how to sample counters at instruction-based intervals. (Thanks to Hossein Maserrat for the sample.)