Date: Tue, 14 May 2002 22:39:22 -0700 From: Terry Lambert <tlambert2@mindspring.com> To: Doug White <dwhite@resnet.uoregon.edu> Cc: Zhihui Zhang <zzhang@cs.binghamton.edu>, freebsd-hackers@FreeBSD.ORG Subject: Re: Collect process sleeping statistics Message-ID: <3CE1F48A.532F0649@mindspring.com> References: <20020514211310.I70761-100000@resnet.uoregon.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
Doug White wrote: > On Mon, 13 May 2002, Zhihui Zhang wrote: > > A process can sleep for various reasons such as memory, I/O etc. Is there > > a way to collect statistics about how long it sleeps for different > > reasons? Thanks. > > I don't think it's actually accounted for anywhere, but if a process does > go to sleep the WCHAN will be filled in and visible in top and ps. > > You could write a program to collect the WCHANs every so often and build > some course stats. And if you really wanted to get fancy it might not be > too hard to build a scheduler or hz-driven procedure to log them directly > in the kernel. Profiling will also show the amount of time spent in "sleep" for a process. Generally, you eliminate these arc's as "unrecoverable system overhead". You typically "treat" these symptoms by changing algorithms in user space, or, if you have an application specific need, hacking the kernel after doing kernel profiling on the code paths. I don't think a statistical sampling of the wait channels outstanding would be very useful. Statistical sampling done for normal profiling (profiling without compiler hacks for recording function entry and exit) is barely generally useful on its own (IMO); you would effectively have to hook into the profiling clock, which means kernel space work, for "outstanding wait channel" tagging. The reason it wouldn't be that useful is that profiling arcs are generally either above or below -- not spanning -- the user/kernel boundary, so there's a lot of information that would get lost in the process, I think. -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3CE1F48A.532F0649>