Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 May 2007 20:25:05 -0700
From:      Bill Campbell <freebsd@celestial.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: wall-clock time profiling
Message-ID:  <20070531032505.GB26400@ayn.mi.celestial.com>
In-Reply-To: <20070531.114515.133762361.kayama@personal-media.co.jp>
References:  <20070528.154753.32719103.kayama@personal-media.co.jp> <465DB587.6010109@mac.com> <20070531.114515.133762361.kayama@personal-media.co.jp>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, May 31, 2007, Akihiro KAYAMA wrote:
>In article <465DB587.6010109@mac.com>,
>Chuck Swiger <cswiger@mac.com> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070531032505.GB26400>