Hi Ajit,
Probably you can exploit the fact Thread.sleep() is another function you
can probe and get timestamp information. Now you can have a mathematical
relation to get what data you want as below,
Warning: This code might not compile, just check if this idea looks
fine!
hotspot$target::method3:method-entry {
self->time1 = vtimestamp;
self->trace = 1; /* to denote it has entered method3 */
}
hotspot$target::sleep:method-entry /self->trace/ {
self->time2 = vtimestamp;
}
hotspot$target::sleep:method-return /self->trace/ {
self->idle_time = vtimestamp - self->time2;
}
hotspot$target::method3:method-return /self->trace/ {
self->time3 = vtimestamp - self->time1;
self->cpu_time = self->time3 - self->idle_time;
printf("cpu time = %d, idle time = %d\n", self->cpu_time,
self->idle_time);
self->trace = 0;
}
Regards,
Krishnan
On Fri, 2009-05-15 at 03:27 -0700, Ajit Bansode wrote:
> Thanks for reply Krishnan.
>
> But we don't have access to code.
> So I am wondering if there is any other way apart from adding static dtrace
> probes.
>
> Thanks,
> Ajit
_______________________________________________
dtrace-discuss mailing list
[email protected]