~ubuntu-branches/ubuntu/precise/pyzmq/precise

« back to all changes in this revision

Viewing changes to perf/local_thr.py

  • Committer: Bazaar Package Importer
  • Author(s): Piotr Ożarowski
  • Date: 2011-02-15 09:08:36 UTC
  • mfrom: (2.1.2 experimental)
  • Revision ID: james.westby@ubuntu.com-20110215090836-phh4slym1g6muucn
Tags: 2.0.10.1-2
* Team upload.
* Upload to unstable
* Add Breaks: ${python:Breaks}

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
    msg = s.recv()
61
61
    assert len (msg) == message_size
62
62
 
63
 
    start = time.clock()
 
63
    clock = zmq.Stopwatch()
 
64
    start = 0
 
65
    clock.start()
 
66
    # start = time.clock()
64
67
 
65
68
    for i in range (1, message_count):
66
69
        if use_poll:
69
72
        msg = s.recv(zmq.NOBLOCK if use_poll else 0, copy=use_copy)
70
73
        assert len(msg) == message_size
71
74
 
72
 
    end = time.clock()
 
75
        end = clock.stop()
 
76
        # end = time.clock()
73
77
 
74
 
    elapsed = (end - start) * 1000000
 
78
    elapsed = (end - start)
 
79
    # elapsed = (end - start) * 1000000 # use with time.clock
75
80
    if elapsed == 0:
76
81
        elapsed = 1
77
82
    throughput = (1000000.0 * float(message_count)) / float(elapsed)