[Tutor] Tutor] Re: newbie looking for code suggestions
Lance
lbrannma@cablespeed.com
Mon, 23 Sep 2002 04:48:51 -0700
I wonder how often the clock tics.... It seems to tic only every second on
our Solaris box.
Lance
----- Original Message -----
From: "Gregor Lingl" <glingl@aon.at>
To: "Bob Roher" <shiska@swbell.net>
Cc: "Tutor" <tutor@python.org>
Sent: Monday, September 23, 2002 1:01 AM
Subject: Re: [Tutor] Tutor] Re: newbie looking for code suggestions
> Bob Roher schrieb:
>
> >Is there a way to import time into the program, say
> >before the loop starts and have it compare start and stop times
> >to give some idea of cpu time? I would like to have some idea of
> >time used when I try some of the ideas I've seen here.
> >
> >
> >
> You may use this function:
>
> from time import clock
>
> def gettime(repetitions, function, *arguments):
> start = clock()
> for i in range(repetitions):
> function(*arguments)
> end = clock()
> return end - start
>
>
> which measures the time used for repetitions repetitions
> of the function function with an arbitrary number of arguments.
> Regards
> Gregor
>
> >
> >_______________________________________________
> >Tutor maillist - Tutor@python.org
> >http://mail.python.org/mailman/listinfo/tutor
> >
> >
> >
> >
>
>
>
>
>
> _______________________________________________
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>