Bill Allombert on Mon, 03 Apr 2006 15:54:59 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: elapsed time and system command


On Sun, Apr 02, 2006 at 07:19:35AM +0000, cino hilliard wrote:
> The timing functions # and ## do not account for the time taken by calls to 
> external objects.
> For example,
> 
> (01:06) gp > #
>   timer = 1 (on)
> (01:05) gp > t(n) = for(x=1,n,write("testtimer.txt","12345678901"))
> (01:07) gp > t(100000)
> time = 10,891 ms.
> (01:08) gp > ##
>  ***   last result computed in 10,891 ms.
> 
> Actually took 50 sec.
> 
> This has been the case for some time and applies to system commands also.

Actually, PARI support three timing functions, times, ftime and
getrusage, getrusage being the default because this is the most reliable
and reproducible. getrusage report user time, not system or
wallclock time.

If you really want wallclock time, edit pari.cfg and change
has_getrusage='yes' to has_ftime='yes' and run
./Configure -l pari.cfg
make clean
and rebuild PARI.

? system("sleep 5");
? ##
  ***   last result computed in 5,081 ms.

Cheers,
Bill.