From owner-freebsd-hackers@FreeBSD.ORG Wed Jan 11 01:55:05 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9600C16A420 for ; Wed, 11 Jan 2006 01:55:05 +0000 (GMT) (envelope-from kamal_ckk@yahoo.com) Received: from web30015.mail.mud.yahoo.com (web30015.mail.mud.yahoo.com [68.142.201.218]) by mx1.FreeBSD.org (Postfix) with SMTP id F0D2A43D49 for ; Wed, 11 Jan 2006 01:55:04 +0000 (GMT) (envelope-from kamal_ckk@yahoo.com) Received: (qmail 48494 invoked by uid 60001); 11 Jan 2006 01:55:04 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=efAAF1G/Pb5ClaUsJf0xNCwrTwTl3mNFah9uwU68KbsoZ9as4DVfA0J16sm55CiiJgbKlPk4YvZrUNRk4KuXydmqmr7gxqbzK25DgvySUW6s76CQTvZAi7QeXSRFTV3/XXy5uWirnZY7XDSg4wcKWfegkT6LJa27P8ipJ0TtvU0= ; Message-ID: <20060111015504.48492.qmail@web30015.mail.mud.yahoo.com> Received: from [202.79.62.13] by web30015.mail.mud.yahoo.com via HTTP; Tue, 10 Jan 2006 17:55:04 PST Date: Tue, 10 Jan 2006 17:55:04 -0800 (PST) From: kamal kc To: freebsd In-Reply-To: <43C3DE68.70303@oxygen.az> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Subject: Re: using get_system_info() - obtaining system load averages X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2006 01:55:05 -0000 --- Tofik Suleymanov wrote: > kamal kc wrote: > > >--- Peter Jeremy > wrote: > >>>thanks i tried getloadavg() it worked. > >>> > >>>but when i tried to put it in the kernel the > kernel > >>>failed to link. > >>You didn't mention the kernel bit before. To > access > >>the load average in the kernel, you just access > >>"averunnable" (see ). Note that > you > >>cannot do floating point arithmetic in the kernel > so > >>the load averages are stored as fixed point > numbers. > >thanks , it worked !!!! > > > >i used the ldavg[] and fscale of averunnable to get > >the system load. > > > > > >you people are great .. > > > >kamal > > > Just a curiosity: why use kernel-space functions to > get system load ? > Isn't it better to use sysctls in user-space ? actually the thing is , i have put some code in the bridge.c routine that attempts to compress/decompress ip packets. i don't know if it was a good idea since i am just a beginner in programming in the kernel and have a little knowledge regarding it. after i put my code i got a very high amount of interrupts (irq 21: xl1 interrupts) that overloads the cpu withing seconds if i pump about 4Mbps traffic through it. so i thought as a temp solution that i could turn off the compression if ever the cpu gets overloaded and that's it. But after a second thought--> the very idea of putting the large compression routine in the bridge code now seems awkward to me. since the compression takes time and putting the code in the bridge may be causing high interrupts i now think if i can do the compression stuffs in separate thread/process than in the bridge process itself. but right now i don't know how do i create a separate process/thread, what are the routines that i need to implement for this.. and also how to dispatch control from the bridge process to a new process without blocking. i am looking into these stuffs and hope i find something from the sources but it is getting really difficult ... maybe you people could have something to say, any advice on whether i am doing the right stuffs would be greatly helpful to me .. thanks, kamal __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com