Subject: Re: what's a better name for this function?
To: Darren Reed <darrenr@reed.wattle.id.au>
From: David Brownlee <abs@netbsd.org>
List: tech-kern
Date: 02/03/2000 15:36:43
Redirecting to tech-kern....
On Fri, 4 Feb 100, Darren Reed wrote:
> In some email I received from Chris G. Demetriou, sie wrote:
> >
> > i suck at names. what's a better name for this function. send me
> > private mail, or hell, if you want to, discuss. (but i know that this
> > is the "wrong" list. 8-)
> >
> > (implementation available if you want to see it, too... send me mail.
> > 8-)
>
> Also, is this something which is better suited to ticks rather than
> seconds/milliseconds ? At least ticks are not subject to being screwed
> around with by settimeofday() and friends, nor are we actually concerned
> with actual times.
>
Related comment - we should probably bite the bullet and split
current time from monotonically elapsed time since boot...
I've been screwed over a number of times by machines hanging
when rdate skews the time by large values...
> Oh, and what about putting both of the timeval's into say "struct rate" ?
> This would allow the interface to grow later.
But it makes it harder to share the same interval over multiple
error checks.
If we're opening the debate - here is a message I sent direct
to Chris earlier :)
} Just to go off on a tangent, but given the described use of
} ratecheck probably is (or should be) quite frequent, is there
} any mileage in implementing a specific ratecheck_printf()
} function as well to reduce duplicated code?
}
} eg:
}
}struct ratecheck_printf {
} struct timeval lasterr; /* time of last err message */
} long count; /* # of errs since last msg */
}};
}
}struct ratecheck_printf drv_lasterr2notice;
}ratecheck_printf(&drv_lasterr2notice, 0, "drv2", "err2");
}
}void
}ratecheck_printf(struct ratecheck_printf *notice, struct timeval *interval,
} const char *driver, const char *fmt, ...)
}{
} static timeval default_interval = { 5, 0 };
}
} ++notice->count;
}
} if (interval == 0) /* Allow null interval for 'default' */
} interval = &default_interval
}
} if(ratecheck(¬ice->lasterr, interval)) {
} if (notice->count > 1)
} printf("%s: %ld '", driver, notice->count);
} else
} printf("%s: ", driver);
}
} /* usual stdargs code to print fmt here */
}
} if (notice->count > 1)
} printf("' errors occured\n");
} notice->count = 0;
} }
}}
}
} Sorry I can't help on the name :)
}