From owner-freebsd-performance@FreeBSD.ORG Sun Jan 30 06:22:16 2011 Return-Path: Delivered-To: freebsd-performance@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B910E106564A; Sun, 30 Jan 2011 06:22:16 +0000 (UTC) (envelope-from robbysun@gmail.com) Received: from mail-gw0-f54.google.com (mail-gw0-f54.google.com [74.125.83.54]) by mx1.freebsd.org (Postfix) with ESMTP id 5B1CD8FC08; Sun, 30 Jan 2011 06:22:16 +0000 (UTC) Received: by gwj21 with SMTP id 21so1718384gwj.13 for ; Sat, 29 Jan 2011 22:22:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=JzggQa3bPhTjK2HY+/+h8TCBCu+zx7gnDXJL96Jmpkg=; b=ada8OPYb9M5PiDG8QVVg1p+vAFzNK+E1kSGYrV+VPmWzLWpK951WC8yv3dy38fldEO MZaxMuWvte79gPvLjaIzaWmq6wDRgEbxJwjiMDg0OmUBxFXzDiUegO+PzTuH1jAtSR29 Z7TLqR6WntM7fRx+SvcAf5t5sNfriQFQWpVLU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=s+SgSZcqoZDynLChrfbwjnbO88qCgiTYeODoEy5yhI2loRwkmOtMO2NRJQiekBlMo3 iIiGqYrDFeNTyvOLPVvB/D1BRQUxc0C+ZP/Ix+l1w3b73O1xJi0XQv631vVdjiwWupdR g7BcMokBTC4mf2vARp9qO02pjUuWhlc6P0AyI= MIME-Version: 1.0 Received: by 10.150.144.14 with SMTP id r14mr6424782ybd.28.1296366907051; Sat, 29 Jan 2011 21:55:07 -0800 (PST) Received: by 10.151.45.7 with HTTP; Sat, 29 Jan 2011 21:55:06 -0800 (PST) In-Reply-To: <20110128215215.GJ18170@zxy.spb.ru> References: <20110128143355.GD18170@zxy.spb.ru> <22E77EED-6455-4164-9115-BBD359EC8CA6@moneybookers.com> <20110128161035.GF18170@zxy.spb.ru> <4D42F87C.7020909@freebsd.org> <20110128172516.GG18170@zxy.spb.ru> <20110129070205.Q7034@besplex.bde.org> <20110128215215.GJ18170@zxy.spb.ru> Date: Sat, 29 Jan 2011 21:55:06 -0800 Message-ID: From: Robby Sun To: Slawa Olhovchenkov Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-performance@freebsd.org, Julian Elischer , Bruce Evans , Stefan Lambrev Subject: Re: Interrupt performance X-BeenThere: freebsd-performance@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Performance/tuning List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jan 2011 06:22:16 -0000 I'd like to suggest that you use the same bit-width for 'Dummy' as that for 'count', and initialize it to 0, so as to ensure that it won't overflow. -Robby On Fri, Jan 28, 2011 at 1:52 PM, Slawa Olhovchenkov wrote: > On Sat, Jan 29, 2011 at 07:52:11AM +1100, Bruce Evans wrote: > > > >> there are of course several possible answers, including: > > >> > > >> 1/ Sometimes BSD and Linux report things differently. Linux may or may > not > > >> account for the lowest level interrupt tie the same as BSD > > > > > > But I see only 20% idle on FreeBSD and 80% idle on Linux. > > > > The time must be counted somewhere, so when it is not properly accounted > > to packet handling, and nothing much else is running, it is accounted to > > idle. > > > > To see how much CPU is actually available, run something else and see how > > fast it runs. A simple counting loops works well on UP systems. > > === > #include > #include > > int Dummy; > > int > main(int argc, char *argv[]) > { > long int count,i,dt; > struct timeval st,et; > > count = atol(argv[1]); > > gettimeofday(&st, NULL); > for(i=count;i;i--) Dummy++; > gettimeofday(&et, NULL); > dt = (et.tv_sec-st.tv_sec)*1000000 + et.tv_usec-st.tv_usec; > printf("Elapsed %d us\n",dt); > } > === > > This is ok? > > ./loop 2000000000 > > FreeBSD > 1 process: Elapsed 7554193 us > 2 process: Elapsed 14493692 us > netperf + 1 process: Elapsed 21403644 us > > Linux > 1 process: Elapsed 7524843 us > 2 process: Elapsed 14995866 us > netperf + 1 process: Elapsed 14107670 us > >