[dtrace-discuss] How to record waiters on mutex locks ?

David Jafferian - Sun Microsystems david.jafferian at east.sun.com
Tue Jul 18 11:19:36 PDT 2006


Hi -

I wrote the following simple script :

---begin---
#!/usr/sbin/dtrace -s

BEGIN
{
	lp = (int64_t)&`hat_statlock;
}

fbt::mutex_vector_enter:entry
/arg0 == lp/
{
	waiters++;
}

lockstat:::adaptive-block
/arg0 == lp/
{
	waiters--;
}

lockstat:::adaptive-spin
/arg0 == lp/
{
	waiters--;
}

tick-10sec
{
	trace(waiters);
}
---end---

Then I tested it on a two CPU sun4u machine as follows :

# cat /proc/self/pagedata >/dev/null &
885
# cat /proc/self/pagedata >/dev/null &
886
# ./test.d
dtrace: script './test.d' matched 5 probes
CPU     ID                    FUNCTION:NAME
  1  37151                      :tick-10sec               406
  1  37151                      :tick-10sec               815
  1  37151                      :tick-10sec              1230
  1  37151                      :tick-10sec              1536
  1  37151                      :tick-10sec              1913
  1  37151                      :tick-10sec              2296
  1  37151                      :tick-10sec              2700
  1  37151                      :tick-10sec              3078
...

I don't see why "waiters" should increase over time.

-- 
David N. Jafferian
Solaris Kernel and Drivers
Product Technical Support
Sun Microsystems, Inc.


More information about the dtrace-discuss mailing list