From owner-freebsd-current@FreeBSD.ORG Sat Mar 22 01:53:07 2008 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7EED2106564A for ; Sat, 22 Mar 2008 01:53:07 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outS.internet-mail-service.net (outS.internet-mail-service.net [216.240.47.242]) by mx1.freebsd.org (Postfix) with ESMTP id 5C9DB8FC17 for ; Sat, 22 Mar 2008 01:53:07 +0000 (UTC) (envelope-from julian@elischer.org) Received: from mx0.idiom.com (HELO idiom.com) (216.240.32.160) by out.internet-mail-service.net (qpsmtpd/0.40) with ESMTP; Fri, 21 Mar 2008 18:54:08 -0700 Received: from julian-mac.elischer.org (localhost [127.0.0.1]) by idiom.com (Postfix) with ESMTP id 971772D6004; Fri, 21 Mar 2008 18:53:06 -0700 (PDT) Message-ID: <47E46682.4020403@elischer.org> Date: Fri, 21 Mar 2008 18:53:06 -0700 From: Julian Elischer User-Agent: Thunderbird 2.0.0.12 (Macintosh/20080213) MIME-Version: 1.0 To: Barney Cordoba References: <817070.5892.qm@web63911.mail.re1.yahoo.com> In-Reply-To: <817070.5892.qm@web63911.mail.re1.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: current@freebsd.org Subject: Re: kvm_read() vs ioctl performance X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Mar 2008 01:53:07 -0000 Barney Cordoba wrote: > --- Julian Elischer wrote: > >> Barney Cordoba wrote: >>> I have an app which reads stats from the kernel >>> periodically, and there can be a lot of >> iterations, >>> sometimes 20,000 or more. I'm thinking of >> converting >>> from an ioctl method to kvm_read(). KVM is >> certainly >>> simpler, but its not clear what overhead is >> involved, >>> since kvm_read() likely has to call the kernel >> also. >>> Does anyone have a handle on the difference in >>> overhead, assuming that the ioctl call is to a >> module >>> which does nothing more than copy the data and >> return? >> >> tried a shared memory page? > > No, but I built a test and kvm_read is 70 times > faster, in > case anyone is interested. cool.. the only downside is that we are trying to get away from kvm direct access. (which is why a shared page might give the same result with a stable API which is not libkvm... BTW on an SMP machine you have no way to ensure that your stats are coherent if you use libkvm. > > Barney > > > ____________________________________________________________________________________ > Never miss a thing. Make Yahoo your home page. > http://www.yahoo.com/r/hs