Subject: Re: Profiled NetBSD slowing down applications considerably
To: Dheeraj Pandey <dpandey@rhapsodynetworks.com>
From: Jaromir Dolecek <jdolecek@netbsd.org>
List: tech-perform
Date: 01/22/2003 19:05:19
Dheeraj Pandey wrote:
> I was trying to track down the reason where most of the CPU is being
> consumed in my application on NetBSD 1.5W. I therefore, profiled my
> application, and realized that 60% of the time, the application was
> on-the-cpu while executing _sys_write(), _sys_select() and _sys_read(). I
> realized that write() and read() could be because of the TCP stack the
> application uses. What was surprising that the sampling profiler found the
> application taking 13% on-the-cpu during select()?!!

Do you watch many descriptors in select()? select() has inherent
considerable overhead for many watched descriptors.
 
> I then decided to profile the kernel and see what the kernel is doing while
> these applications are running. As soon as I switch the profile on in the
> kernel, the applications come to a dead halt... cpu is 100% idle... as
> opposed to the scenarios when they would be 0% idle when profiling is off. I
> don't understand why the applications become so slow when I "kgmon -b" the
> kernel, and become normal (cpu-intensive) as soon as I "kgmon -h" the
> kernel.

Yeah, profiling kernel adds considerable overhead to system, since
it gathers and writes out a lot of information.
 
Jaromir
-- 
Jaromir Dolecek <jdolecek@NetBSD.org>            http://www.NetBSD.org/
-=- We should be mindful of the potential goal, but as the tantric    -=-
-=- Buddhist masters say, ``You may notice during meditation that you -=-
-=- sometimes levitate or glow.   Do not let this distract you.''     -=-