Light Speed Socket Connections
Steve Holden
sholden at holdenweb.com
Thu Jul 12 12:55:57 EDT 2001
"Skip Montanaro" <skip at pobox.com> wrote in message
news:mailman.994949372.17704.python-list at python.org...
>
> Bengt> On 11 Jul 2001 22:32:16 -0700, tangell at kicker.com (T Angell)
wrote:
> >> I wrote some code to test how long it takes to make socket
connections
> >> and ran it against several hosts around the world, here are some
> >> sample times:
> >>
> >> socket time: 0.0047459602356
> >> socket time: 0.00469899177551
> >> socket time: 0.00404000282288
> >> socket time: 0.00537407398224
> >>
> Bengt> [...]
> >> t1 = time.time()
> Bengt> For accurate timing, time.clock() is recommended, I believe:
> ...
>
> Not in this case. He wants to know how long it takes the socket to be
> connected between the two machines. That is an elapsed time sort of
thing,
> what you measure with time.time. It has little or nothing to do with the
> CPU time used by the client process making the connection.
> 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?
regards
Steve
--
http://www.holdenweb.com/
More information about the Python-list
mailing list