> I have a Toshiba Laptop with Intel centrino processor, 1,73 Ghz and
> 1GB Ram and windows XP on it.
I don't know anything about windows, maybe someone else here has some
idea what's going on.
Here's what happens:
> Zeit=cputime()
> for i in range(100000):
> g=maxima('193^99484')
> Ergebnis=cputime(Zeit)
> print Ergebnis
>
> and get following intressting result:
>
> 130.62
> 262.78
> 393.85
> 524.81
> 656.77
> 788.77
> 917.66
> 1046.38
> 1176.15
> 1307.78
> 1439.65
> 1571.42
> 1701.97
> 1832.77
> 1962.88
> 2093.95
> -2071.387296
> -1940.027296
> -1808.707296
> -1677.137296
> -1543.907296
> -1410.187296
> -1279.297296
> -1146.907296
> -1016.587296
> -885.917296
> -752.657296
> -620.757296
> -489.627296
> -358.087296
> -224.227296
> -94.367296
> 36.762704
>
> and so on, so the sign of the time changes about around every 2100
> seconds.
david
On Apr 19, 1:33 pm, David Harvey <dmhar...@math.harvard.edu> wrote:
> A user has been asking on sage-support about issues with cputime()...
> it sounds like some kind of "wrap-around" resolution bug on his
> platform. Every 35 minutes it wraps around to zero or something. He
> describes his system as
>
> > I have a Toshiba Laptop with Intel centrino processor, 1,73 Ghz and
> > 1GB Ram and windows XP on it.
>
So does the person use cygwin? It seems likely, but I am not 100%
sure.
> I don't know anything about windows, maybe someone else here has some
> idea what's going on.
>
> Here's what happens:
>
>
<SNIP>
>
> > and so on, so the sign of the time changes about around every 2100
> > seconds.
>
> david
As far as I can tell cputime() is a sage function. Grepping for it
found lots of use of the function, but if someone could point me to
the right place where it is implemented I can investigate further.
I would assume cputime() uses getrusage(), hence it uses native
timers. On Windows that timer (one jiffie on Linux speak) has a length
of 100ns, i.e. 10E-7 seconds length. Compare that to linux where one
jiffie equals 1/100, 1/250 or 1/1000 of a second (depending on the
kernel) one can get an idea why this might cause trouble on windows
with overflows or wraps.
There is a proper interface defined in Windows.h that provides all the
bits and pieces to get cputime() that wraps every ~43 days, but
because we use cygwin that is properly not an option.
Cheers,
Michael
The implementation is
def cputime(t=0):
try:
t = float(t)
except TypeError:
t = 0.0
return time.clock() - t
and is located in sage.misc.misc. You can find it by typing cputime? or
cputime?? on the SAGE prompt.
Martin
--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_www: http://www.informatik.uni-bremen.de/~malb
_jab: martinr...@jabber.ccc.de
On Apr 19, 2:39 pm, Martin Albrecht <m...@informatik.uni-bremen.de>
wrote:
> > As far as I can tell cputime() is a sage function. Grepping for it
> > found lots of use of the function, but if someone could point me to
> > the right place where it is implemented I can investigate further.
>
> The implementation is
>
thanks,
> def cputime(t=0):
> try:
> t = float(t)
> except TypeError:
> t = 0.0
> return time.clock() - t
>
> and is located in sage.misc.misc. You can find it by typing cputime? or
> cputime?? on the SAGE prompt.
>
A little poking around leads me to IPython/genutils.ps which
reimplemets clock(), specifially stating that it avoids the wraparound
problems in time.clock():
def clock():
"""clock() -> floating point number
Return the *TOTAL USER+SYSTEM* CPU time in seconds since the
start of
the process. This is done via a call to resource.getrusage,
so it
avoids the wraparound problems in time.clock()."""
u,s = resource.getrusage(resource.RUSAGE_SELF)[:2]
return u+s
> Martin
>
Because I know to little about the internal of sage I hope that
somebody else can take it from here. I should be working on something
else at the moment anyway ;)
Cheers,
Michael