[dtrace-discuss] track program time - need some guidelines

Jim Mauro
2009-07-12T15:45:43Z

So......why is prstat with microstates not sufficient?
Observing your app with;
prstat -Lcmp <PID> 1 10 > prstat.out

Will give you statistics collected at 1 second intervals for
10 seconds. You can do the math if you really need to
get down to clock ticks (roughly).

Chad''s modified ptime will give you time spent in each microstate.

Also, as per Marty''s suggestion, the Studio Analyzer, which is free,
can do high resolution profiling.

Writing C code to extract data from /proc, which would work, is like
spending a lot of time and tools removing a car engine completely
from the top, just so you can change the oil filter, when all you had
to do was slide under the car to do it.

Unless you''re goal is skill development or this is an academic
exercise,
I''d love to know what you''re trying to accomplish - what
problem
you''re trying to solve. On a modern microprocessor with
sub-nanosecond clocking, do you really need clock-tick level
accounting?

Thanks,
/jim


tester wrote:
> Thanks Jim.M and  thanks Jim.L. Sure, I can use prstat and post-process. I
am not sure if I can get a accurate profile of the app. If I can go back to my
previous example and assume an multi-threaded app running for 100 clock ticks, I
would like to have a break up and say
usr:20ticks,sys:10,wait1:20,wait2:20,wait3:20,sleep:10. Units of time can be
anything meaningful. Basically, a much more accurate answer  for where my app
spend it''s time than what the traditional tools offer.
>
> I will explore extended accounting and Jim.L suggestion of using /proc. I
have limitation''s with my C programming skills.
>
> Thanks
>