Hello,

On Apr 19, 2:39 pm, Martin Albrecht <[EMAIL PROTECTED]>
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


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to