Well I am trying to record the duration of user level mutex locks. Below is the
simple script:
-----------------------------------------------------------------
#!/usr/sbin/dtrace -s
dtrace:::BEGIN
{
self->begin=timestamp;
self->mutex_acq=0;
}
plockstat$1:::mutex-acquire
{
self->ts[arg0]=timestamp;
self->mutex_acq++;
@mutex_acquired["No of mutexes acquired"]=count();
}
plockstat$1:::mutex-release
/self->mutex_acq==1/
{
self->tstop[arg0]=timestamp;
@mutex_released["No of mutexes released"]=count();
printf("%d outer mutex duration:%d\n", arg0, self->tstop[arg0]-self->ts[arg0]);
@["all_mutex_duration"]=avg(self->tstop[arg0]-self->ts[arg0]);
self->mutex_acq=0;
self->ts[arg0]=0;
}
plockstat$1:::mutex-release
/self->mutex_acq>1/
{
self->mutex_acq--;
self->tstp[arg0]=timestamp;
@mutex_released["No of mutexes released"]=count();
printf("%d mutex duration:%d\n", arg0, self->tstp[arg0]-self->ts[arg0]);
}
------------------------------------------------------------------------------------------
You can see two release probes here, because I was trying to find out the
duration of outermost lock, when there is nesting.
And for the timing measurement in the c code, I think it must be the user level
gethrtime()..I include #include <sys/time.h> for using it.
Thanks,
Neelam
--
This message posted from opensolaris.org
_______________________________________________
dtrace-discuss mailing list
[email protected]