Subject: Profiled NetBSD slowing down applications considerably
To: '' <>
From: Dheeraj Pandey <>
List: tech-perform
Date: 01/22/2003 09:43:21
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()?!!

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

Any pointers would be appreciated.