Pick true runtime?
  Home FAQ Contact Sign in
comp.lang.forth only
 
Advanced search
POPULAR GROUPS

more...

comp.lang.forth Profile…
 Up
Pick true runtime?         


Author: Michael
Date: Jun 8, 2008 13:46

Hi

In those project euler postings I find "runs in 0.xx s" or so.

Wonder how they can say so.

Did this with gforth on an empty FOR NEXT loop with k=1000000:

5 runtimetests

usertime: 80531 ms <0>
cputime: 41995 ms <0>
systime: 450 ms <0>

usertime: 43113 ms <0>
cputime: 43510 ms <0>
systime: 426 ms <0>

usertime: 75839 ms <0>
cputime: 43210 ms <0>
systime: 509 ms <0>

usertime: 61606 ms <0>
cputime: 42545 ms <0>
systime: 568 ms <0>
Show full article (1.72Kb)
9 Comments
Re: Pick true runtime?         


Author: Robert Spykerman
Date: Jun 8, 2008 18:29

On Jun 9, 6:46 am, Michael wrote:
> Did this with gforth on an empty FOR NEXT loop with k=1000000:
>
> 5 runtimetests
>
> usertime: 80531 ms <0>
> cputime: 41995 ms <0>
> systime: 450 ms <0>

This is interesting. You've said you're running a powerbook, which is
a few iterations behind my model (a penryn macbook) but did the tests
using usertime and cpu time actually take 80 secs and 41 secs etc?

I ran your code unmodified on a gforth 0.6.9-20070604 (no fancy build
options, just linked to ffcall) and I got really weird results too.

ie - and 20 iterations went by in less than a sec.

usertime: 14688 ms <0>
cputime: 4001 ms <0>
systime: 0 ms <0>
Show full article (2.22Kb)
no comments
Re: Pick true runtime?         


Author: ouatubi
Date: Jun 9, 2008 00:30

Hi Michael, there are *micro*-seconds, not milliseconds!

best regards,
humpty-dumpty
no comments
Re: Pick true runtime?         


Author: Anton Ertl
Date: Jun 9, 2008 01:37

Michael writes:
>5 runtimetests
>
>usertime: 80531 ms <0>
>cputime: 41995 ms <0>
>systime: 450 ms <0>
>
>usertime: 43113 ms <0>
>cputime: 43510 ms <0>
>systime: 426 ms <0>
>
>usertime: 75839 ms <0>
>cputime: 43210 ms <0>
>systime: 509 ms <0>
>
>usertime: 61606 ms <0>
>cputime: 42545 ms <0>
>systime: 568 ms <0>
>
>usertime: 50513 ms <0> ...
Show full article (1.70Kb)
no comments
Re: Pick true runtime?         


Author: m_l_g3
Date: Jun 11, 2008 00:05

Try the following:
first do all measurements, then do all i/o.
no comments
Re: Pick true runtime?         


Author: m_l_g3
Date: Jun 11, 2008 00:07

At second, you measure sys/cpu/usr time for *different* runs.
Why don't you measure them for the same run?
no comments
Re: Pick true runtime?         


Author: Michael
Date: Jun 12, 2008 12:59

On 11 Jun., 09:07, m_l_g3 yahoo.com> wrote:
> At second, you measure sys/cpu/usr time for *different* runs.
> Why don't you measure them for the same run?

Ok, lets try this:

\ test: Keeping track of Time with gforth - Mac OSX (PowerBook G4)

vocabulary test
test definitions

0 [if]

user: 14586256 44859 45282 43424 <0>
0.958968243452144
sys : 1383017 839 2644 493 <0>
0.186459909228442
ut : 1213225092442357 58390 383728 49172 <0>
0.128142851186257
time t2-t1 max min .s ratio

Hm, utimes reads the real time clock of the computer, am I right?

So, in those euler calculations utime will give the total time from
start of code until a result apears on screen, while you do email,
YouTube, ... ;-)
Show full article (2.90Kb)
no comments
Re: Pick true runtime?         


Author: brian.fox
Date: Jun 12, 2008 19:30

On Jun 12, 3:59 pm, Michael wrote:
> On 11 Jun., 09:07, m_l_g3 yahoo.com> wrote:
>
>> At second, you measure sys/cpu/usr time for *different* runs.
>> Why don't you measure them for the same run?
>
> Ok, lets try this:
>
> \ test: Keeping track of Time with gforth - Mac OSX (PowerBook G4)
>
> vocabulary test
> test definitions
>
> 0 [if]
>
> user: 14586256 44859 45282 43424 <0>
> 0.958968243452144
> sys : 1383017 839 2644 493 <0>
> 0.186459909228442
> ut : 1213225092442357 58390 383728 49172 <0> ...
Show full article (4.26Kb)
no comments
Re: Pick true runtime?         


Author: Michael
Date: Jun 12, 2008 23:51

On 13 Jun., 04:30, brian....@rogers.com wrote:
...
> include elapsed.fs

So you use utime too.

This also answers my question from the "Ultimate Prime Sieve
-- Sieve
of Zakiya (SoZ)" thread.

Thank you Brian, I like it. Michael
no comments
Re: Pick true runtime?         


Author: Anton Ertl
Date: Jun 14, 2008 04:07

Michael writes:
>Hm, utimes reads the real time clock of the computer, am I right?

It may, on some OSs. On Unix variants, typically the OS reads the
time on startup from the real-time clock, and then maintains it
through software; many systems also use NTP to keep the correct clock.

I any case UTIME gives you the real (aka "wall-clock") time.
>So, in those euler calculations utime will give the total time from
>start of code until a result apears on screen,

Yes, if you use UTIME for timings, you will see the time you would
have also measured with a stop-watch.
>By the way, as utime gives the time in microsec, is it time elapsed
>since 1970?
>1213138874991075 / 1000000 / 60 / 60 / 24 / 365 = 38,4683.. years.

On Unix variants, it is.
Show full article (1.04Kb)
no comments