Hi Senthil,
Bear in mind, the lockstat provider monitors kernel locking primitives so
if you''re writing a user-land C program the locking events you see
won''t
correlate directly. If you want to monitor user-land locking activity, you
should use the plockstat provider:
plockstat$target:::mutex-acquire
...
Since the plockstat provider is a USDT provider, you need to give it a
target process. You can do this by specifying the pid explicitly or by
using the $target macro (as above) and the -p or -c option to dtrace(1M).
Adam
On Tue, Oct 24, 2006 at 11:13:12AM -0400, senthil ramanujam
wrote:> Hi,
>
> I have been trying to use readers/writer lock and monitoring these
> lock activities (acquires and releases) using dtrace. I am not able to
> interpret the result that I am getting.
>
> Note that I am playing with rw-lock and dtrace to understand how it
> works and there is no business case for this.
>
> Following is an excerpt of the dtrace script I am using to monitor:
>
> --- cut here ---
>
> lockstat:::adaptive-acquire
> {
> @adacq["adacq"] = count();
> }
>
> lockstat:::adaptive-release
> {
> @adrel["adrel"] = count();
> }
>
> lockstat:::spin-acquire
> {
> @spacq["spacq"] = count();
> }
>
> lockstat:::spin-release
> {
> @sprel["sprel"] = count();
> }
>
> lockstat:::rw-acquire
> {
> @rwacq["rwacq"] = count();
> }
>
> lockstat:::rw-release
> {
> @rwrel["rwrel"] = count();
> }
>
> --- cut here ---
>
> I print the above aggregated values once in a few seconds(for e.g., 2
> seconds).
>
> On a different session, I am firing up a C program that creates a
> certain number of threads and does a lot of information sharing. The
> parent thread acquires writer lock, once in a second, and write
> something and releases it. The children threads acquire readers lock
> and read the information that is written by parent and release it. The
> children threads work continuously without any pause/delay. Imagine
> that these threads(parent and children) generate a lots of rw_rdlock
> and rw_wrlock function calls.
>
> Can these events be monitored using rw-acquire and rw-release probes
> in the lockstat provider? The dtrace output shown below tells me that
> almost all actions come under adaptive locks, though I heavily use
> readers/writer lock.
>
> $ kernel_locks -i 2 -n 100
> datetime : adaptive spin
> read-write
> acq. rel. acq. rel. acq.
> rel.
> 2006 Oct 24 10:43:29 : 11651 11651 2258 1852 499
> 499
> 2006 Oct 24 10:43:31 : 6720 6721 2183 1782 189
> 189
> 2006 Oct 24 10:43:33 : 7649 7649 2220 1818 179
> 179
> 2006 Oct 24 10:43:35 : 159974 159974 37252 36850 15877
> 15876
> 2006 Oct 24 10:43:37 : 181793 181793 309199 308798 166
> 167
> 2006 Oct 24 10:43:39 : 172816 172815 357078 356675 149
> 149
> 2006 Oct 24 10:43:41 : 171040 171041 368292 367891 165
> 165
> 2006 Oct 24 10:43:43 : 176365 176365 361701 361298 193
> 193
> 2006 Oct 24 10:43:45 : 127181 127181 260703 260336 331
> 331
> 2006 Oct 24 10:43:47 : 7334 7333 2382 1983 146
> 146
> 2006 Oct 24 10:43:49 : 6228 6229 2131 1730 140
> 140
> 2006 Oct 24 10:43:51 : 6400 6400 2215 1813 134
> 134
> 2006 Oct 24 10:43:53 : 6145 6144 2155 1751 142
> 142
> 2006 Oct 24 10:43:55 : 6118 6119 2170 1770 135
> 135
>
> Is it possible that readers/writer lock internally transformed to
> adaptive locks? I am confused the more I think about it :o)
>
> Any inputs or pointers would be appreciated.
>
> thanks.
>
> senthil
> _______________________________________________
> dtrace-discuss mailing list
> dtrace-discuss at opensolaris.org
--
Adam Leventhal, Solaris Kernel Development http://blogs.sun.com/ahl