Subject: Re: Why is Samba so much slower on NetBSD than FreeBSD?
To: Michael Richardson <>
From: Brian C. Grayson <>
List: current-users
Date: 10/23/1998 14:22:10
On Fri, Oct 23, 1998 at 03:23:30PM -0400, Michael Richardson wrote:
> >>>>> "Jukka" == Jukka Marin <> writes:
>     Jukka> On Fri, Oct 23, 1998 at 09:23:49AM -0700, Jason Thorpe
>     Jukka> wrote:
>     >> > Note that the elink3 driver doesn't say anything when the
>     >> fifo > overflowded.
>     >> 
>     >> Uh, let's add a printf?
>     Jukka> Doesn't that just make the problem worse by slowing down
>   Yes. We should be incrementing a counter, and printing something
> whenever the counter is first incremented, so that I might think to
> monitor the counter.

  I've recently started using an exponential backoff scheme in
some of my code to reduce the overhead of logging info like
this.  For example, if there are 1 million overflows, only the
following would be logged:

1 time(s):  fifo overflow
2 time(s):  fifo overflow
4 time(s):  fifo overflow
8 time(s):  fifo overflow
262144 time(s):  fifo overflow
524288 time(s):  fifo overflow

  This is a good tradeoff (IMHO) between knowing the absolute
number of times this occurs, and reducing the impact of
tracking this knowledge (both in CPU expense and in logfile space).

  I use preprocessor magic so that I can just say

exponential_warning(("format string passed to printf", arg, arg, ...));

and have it Do The Right Thing (without having to specify either
a counter or a threshold variable -- the macro does all that). 
If anyone is interested in the macro (it ain't too hard to
figure out), mail me!

"Old programmers never die.  They just branch to a new address."