From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 16 11:13:40 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2E5AD106566C for ; Thu, 16 Jun 2011 11:13:40 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 05A138FC0C for ; Thu, 16 Jun 2011 11:13:40 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id ACD9746B03; Thu, 16 Jun 2011 07:13:39 -0400 (EDT) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 4C87D8A02A; Thu, 16 Jun 2011 07:13:39 -0400 (EDT) From: John Baldwin To: freebsd-hackers@freebsd.org Date: Thu, 16 Jun 2011 07:12:46 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110325; KDE/4.5.5; amd64; ; ) References: <4DF91458.8010508@rawbw.com> <20110615215515.GA6889@dan.emsphone.com> In-Reply-To: <20110615215515.GA6889@dan.emsphone.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201106160712.46408.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Thu, 16 Jun 2011 07:13:39 -0400 (EDT) Cc: Yuri , Dan Nelson Subject: Re: Why user time of the process depends on machine load? 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: Thu, 16 Jun 2011 11:13:40 -0000 On Wednesday, June 15, 2011 5:55:17 pm Dan Nelson wrote: > In the last episode (Jun 15), Yuri said: > > When I test performance of the code, I always observe dependency of CPU > > user time on the presence of other CPU intense processes. Same CPU-only > > deterministic process that on the quiet machine completes in 220 user > > seconds in the presence of, for example, kde rebuild would complete in > > 261, 266 or even 379 user seconds. I am talking about times shown by > > time(1), not actual an execution time. It's the same time as getrusage(2) > > returns in ru_utime field. > > > > Why time that process takes in user seconds depends on what other > > processes are running? > > > > FreeBSD-8.2 STABLE on i7 CPU @ 9200 @ 2.67GHz. > > Some possible factors: > > o Intel Turbo Boost, which raises the clock rate of a single core if the > other cores are idle. A single process on an idle system will run faster. > > o i7 chips have a shared L3 cache across all cores, so a single process on > an idle system will tend to have more of its data in cache compared to a > system with multiple processes, so it spends less time waiting for slower > physical memory lookups. > > o Process accounting isn't exact. I may be wrong, but I don't think > timestamps are taken every time a syscall is invoked and returns. Some > time marked as "user" may actually be "system" time, in which case you may > be seeing the effect of contention in the kernel as more processes are > run. This is very true. You can only really trust the sum of system + user time and compare that across runs. -- John Baldwin