From owner-freebsd-hackers Wed May 15 11:44:25 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from pintail.mail.pas.earthlink.net (pintail.mail.pas.earthlink.net [207.217.120.122]) by hub.freebsd.org (Postfix) with ESMTP id 47DCB37B406 for ; Wed, 15 May 2002 11:44:22 -0700 (PDT) Received: from pool0412.cvx21-bradley.dialup.earthlink.net ([209.179.193.157] helo=mindspring.com) by pintail.mail.pas.earthlink.net with esmtp (Exim 3.33 #2) id 1783kw-00060x-00; Wed, 15 May 2002 11:44:10 -0700 Message-ID: <3CE2AC5C.5B511B16@mindspring.com> Date: Wed, 15 May 2002 11:43:40 -0700 From: Terry Lambert X-Mailer: Mozilla 4.7 [en]C-CCK-MCD {Sony} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Zhihui Zhang Cc: Doug White , freebsd-hackers@FreeBSD.ORG Subject: Re: Collect process sleeping statistics References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Zhihui Zhang wrote: > Basically I have a program that does a lot of I/O and alloctes/frees a lot > of memory. The time command gives result like this: > > 6.239u 19.329s 7:59.76 5.3% 310+775k 3993+246io 7pf+0w > > I want to know why CPU is running only 5.3% of the total time. I just > want know how long it is waiting for memory and how long it is waiting for > I/O. No other process is running at the same time. You got 7 page faults with 0 waits. So it was waiting for I/O 94.7% of the time. That's statistical; the real calculation is 100% - 246/3993 = 93.8%. Generally, this comes down to a design issue that's very common in code these days, particularly code where people think "threads solve all concurrency problems". I think I should patent the correct way of solving this problem, since no one seems to use it. I'll call it "interleaved I/O"... -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message