Date: Tue, 4 Dec 2001 08:33:26 -0800 From: Luigi Rizzo <luigi@FreeBSD.ORG> To: Poul-Henning Kamp <phk@critter.freebsd.dk> Cc: cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG Subject: Re: cvs commit: src/sys/kern uipc_mbuf.c Message-ID: <20011204083326.A54383@iguana.aciri.org> In-Reply-To: <4025.1007482612@critter.freebsd.dk> References: <200112040213.fB42DBl08877@freefall.freebsd.org> <4025.1007482612@critter.freebsd.dk>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Dec 04, 2001 at 05:16:52PM +0100, Poul-Henning Kamp wrote: > > Are we at the point where we need a > rlprintf() > in the kernel which implements rate-limiting in a generic way ? the problem with these rate-limited messages is that you need state associated to the message to figure out when you last generated it (or how many of them were spit out in the last interval). The way i have implemented this functionality is the following: if (need_to_report_an_error) { static int last_report ; /* when we did that (in ticks) */ if (ticks < last_report || (ticks - last_report) >= hz) { last_report = ticks; printf("bla bla bla\n"); } } yes the rlprintf might replace the block of 4 lines, but given how rarely this feature is used, probably it is not necessary at the moment. In case, it should become something like rlprintf(msg_class, printf_arguments ); but then you'd need some code somewhere to define message classes. cheers luigi ----------------------------------+----------------------------------------- Luigi RIZZO, luigi@iet.unipi.it . ACIRI/ICSI (on leave from Univ. di Pisa) http://www.iet.unipi.it/~luigi/ . 1947 Center St, Berkeley CA 94704 Phone: (510) 666 2927 ----------------------------------+----------------------------------------- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011204083326.A54383>