You can monitor performance on Solaris using
a performance monitoring tool that runs outside your process or via the instrumentation of your
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 for an example code counting data cache misses.
To compile this code, type:
"cc -o trycpc trycpc.c -lcpc".
This will work on Solaris10/Niagara only.
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.)