Date: Tue, 22 Feb 2011 20:08:20 -0500 From: Ryan Stone <rysto32@gmail.com> To: Jerome Flesch <jerome.flesch@netasq.com>, Chuck Swiger <cswiger@mac.com>, freebsd-current@freebsd.org Cc: John-Mark Gurney <jmg@funkthat.com> Subject: Re: Process timing issue Message-ID: <AANLkTik4LEgGBgg4vuUzfMib36Egb2bkOxBL3m1_rYAa@mail.gmail.com> In-Reply-To: <20110222195713.GW66284@funkthat.com> References: <4D6291A5.4050206@netasq.com> <8C8FE4A5-F031-466A-9CB8-46D79EEA280D@mac.com> <4D638050.2010906@netasq.com> <20110222195713.GW66284@funkthat.com>
next in thread | previous in thread | raw e-mail | index | archive | help
To debug weird scheduling issues I find it helpful to start by looking at a schedgraph. schedgraph is a tool that can display a graphical representation of what the scheduler was doing over a small slice of time. The one downside is that you have to recompile your kernel to get the hooks that collect the necessary data, but it sounds like your problem is pretty easy to reproduce and so that shouldn't be a big problem. To enable the hooks, put the following in your kernel conf: options KTR options KTR_COMPILE=KTR_SCHED options KTR_MASK=KTR_SCHED options KTR_ENTIRES=(128*1024) Then rebuild and install the new kernel. Next, run your test. The instant that your test has detected the long delay, set the sysctl debug.ktr.mask to 0. The scheduler hooks record data into a ring buffer, so the interesting data can be flushed out within seconds. Clearing that sysctl will stop any further events from being logged, which means that the interesting data will stay there until you go and collect it. You can get the raw data by redirecting the output of "ktrdump -ct" into a file. Then from any machine with a graphical interface(FreeBSD with X installed, Windows, Mac, whatever) and python installed, run: $ python schedgraph.py /path/to/ktrdump/output You can get schedgraph.py from /usr/src/tools/sched. If you want to collect the data again, set the sysctl debug.ktr.mask back to 0x20000000 to restart gathering scheduler data. Ryan
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTik4LEgGBgg4vuUzfMib36Egb2bkOxBL3m1_rYAa>