From owner-cvs-all Tue Dec 4 8:33:35 2001 Delivered-To: cvs-all@freebsd.org Received: from iguana.aciri.org (iguana.aciri.org [192.150.187.36]) by hub.freebsd.org (Postfix) with ESMTP id 39C4E37B405; Tue, 4 Dec 2001 08:33:29 -0800 (PST) Received: (from rizzo@localhost) by iguana.aciri.org (8.11.3/8.11.1) id fB4GXQg54448; Tue, 4 Dec 2001 08:33:26 -0800 (PST) (envelope-from rizzo) Date: Tue, 4 Dec 2001 08:33:26 -0800 From: Luigi Rizzo To: Poul-Henning Kamp 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> References: <200112040213.fB42DBl08877@freefall.freebsd.org> <4025.1007482612@critter.freebsd.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4025.1007482612@critter.freebsd.dk> User-Agent: Mutt/1.3.23i Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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