[dtrace-discuss] How to record waiters on mutex locks ?
Jonathan Adams
jwadams at gmail.com
Tue Jul 18 22:19:24 PDT 2006
On 7/18/06, David Jafferian - Sun Microsystems <david.jafferian at east.sun.com>
wrote:
>
>
> 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 :
...
> I don't see why "waiters" should increase over time.
Global variables are not guaranteed to be consistant if modified from
multiple threads. Try using an aggregation:
s/waiters++/@a = sum(1)/
s/waiters--/@a = sum(-1)/
s/trace(waiters)/printa(@a)/
Cheers,
- jonathan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.opensolaris.org/pipermail/dtrace-discuss/attachments/20060718/a36cd50b/attachment.html
More information about the dtrace-discuss
mailing list