From owner-freebsd-questions@FreeBSD.ORG Thu May 31 03:24:58 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5226316A47F for ; Thu, 31 May 2007 03:24:58 +0000 (UTC) (envelope-from bill@ayn.mi.celestial.com) Received: from ayn.mi.celestial.com (hayek.celestial.com [192.136.111.12]) by mx1.freebsd.org (Postfix) with ESMTP id 26C2013C44C for ; Thu, 31 May 2007 03:24:57 +0000 (UTC) (envelope-from bill@ayn.mi.celestial.com) Received: from localhost (localhost [127.0.0.1]) by ayn.mi.celestial.com (Postfix) with ESMTP id 8CE1C6866CE7B; Wed, 30 May 2007 20:25:05 -0700 (PDT) X-Virus-Scanned: amavisd-new at mi.celestial.com Received: from ayn.mi.celestial.com ([127.0.0.1]) by localhost (ayn.mi.celestial.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id VlWfhKtJttr4; Wed, 30 May 2007 20:25:05 -0700 (PDT) Received: by ayn.mi.celestial.com (Postfix, from userid 203) id 65F106866CE7A; Wed, 30 May 2007 20:25:05 -0700 (PDT) Date: Wed, 30 May 2007 20:25:05 -0700 From: Bill Campbell To: freebsd-questions@freebsd.org Message-ID: <20070531032505.GB26400@ayn.mi.celestial.com> Mail-Followup-To: freebsd-questions@freebsd.org References: <20070528.154753.32719103.kayama@personal-media.co.jp> <465DB587.6010109@mac.com> <20070531.114515.133762361.kayama@personal-media.co.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070531.114515.133762361.kayama@personal-media.co.jp> User-Agent: Mutt/1.5.11 OpenPKG/2.5 Subject: Re: wall-clock time profiling X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd@celestial.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2007 03:24:58 -0000 On Thu, May 31, 2007, Akihiro KAYAMA wrote: >In article <465DB587.6010109@mac.com>, >Chuck Swiger writes: > >cswiger> Akihiro KAYAMA wrote: >cswiger> > Hi all. >cswiger> > >cswiger> > What is the right way to measure wall-clock time in profiling on FreeBSD? >cswiger> >cswiger> The time shell builtin command or "/usr/bin/time -l _program_"? >cswiger> >cswiger> The latter variant displays the rusage struct (ie, from "man getrusage")? > >Thanks for your response. > >Yes, we can know whether the program is I/O bound or CPU bound by >time(1). But it is still unclear which part of the program is really >waiting for I/O. So profiling is needed for tuning, although CPU time >profiling gives me non-distinct result on I/O bound programs. It is >reason why I want wall-clock time profiling. Wall clock time doesn't generally tell you anything reliably useful on a multi-tasking system as it's very dependent on other system activity. I had many fights back in the mid '70s with people in accounting who wanted to bill wall-clock time on Burroughs main frames which generally had 20 programs in the mix at any time (I guess they were accustomed to IBM 360s that couldn't walk and chew gum at the same time :-). If I had to measure wall-clock time for proceses, I would probably write a simple wrapper script to execute the command getting the system time before and after running the command I wanted to time: #!/usr/bin/env python import os, time tstart = time.time() os.system('some command') tend = time.time() et = tstart - tend print et Bill -- INTERNET: bill@Celestial.COM Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 ``Lord, the money we do spend on Government and it's not one bit better than the government we got for one third the money twenty years ago.'' Will Rogers