Light Speed Socket Connections
Steve Holden
sholden at holdenweb.com
Sat Jul 14 11:03:56 EDT 2001
Thanks for the excellent clarification, /F.
--
http://www.holdenweb.com/
"Fredrik Lundh" <fredrik at pythonware.com> wrote in message
news:EbJ37.5150$z21.530071 at newsc.telia.net...
> Steve Holden wrote
>
> > Well, after this little experiment on PythonWin 2.0/Win95 I'm no longer
> > sure what is going on:
> >
> > >>> for i in range(10):
> > ... time.sleep(2.5)
> > ... print time.time(), time.clock()
> > ...
> > 994956779.3 5.86667560636e-006
> > 994956781.88 2.55270956603
> > 994956784.41 5.0637313733
> > 994956786.94 7.58865720176
> > 994956789.41 10.1181121038
> > 994956791.99 12.6327050403
> > 994956794.46 15.1421897786
> > 994956796.99 17.6518547076
> > 994956799.51 20.1890552976
> > 994956802.04 22.7061055331
> >
> > Is my CPU usage really ~100% during those sleeps?
>
> from the Python library reference:
>
> clock()
>
> Return the current CPU time as a floating point
> number expressed in seconds. The precision, and
> in fact the very definition of the meaning of ''CPU
> time'' , depends on that of the C function of the
> same name
>
> ANSI C leaves the "era" and resolution open, and Microsoft
> has defined it as:
>
> The clock function's era begins (with a value of 0)
> when the C program starts to execute. It returns
> times measured in 1/CLOCKS_PER_SEC (which
> equals 1/1000 for Microsoft C).
>
> In recent version, I think "when the C program starts to
> execute" means "when the C program first calls the clock
> function", but you get the idea.
>
> Cheers /F
>
>
More information about the Python-list
mailing list