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

« back to all changes in this revision

Viewing changes to perf/remote_lat.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:
54
54
    msg = ' ' * message_size
55
55
 
56
56
    clock = zmq.Stopwatch()
 
57
    start = 0
57
58
    clock.start()
58
 
    start = 0
59
59
    # start = time.clock()
60
60
 
61
61
    for i in range (0, roundtrip_count):
62
62
        if use_poll:
63
63
            res = p.poll()
64
64
            assert(res[0][1] & zmq.POLLOUT)
65
 
        s.send (msg, zmq.NOBLOCK if use_poll else 0, copy=use_copy)
 
65
        s.send(msg, zmq.NOBLOCK if use_poll else 0, copy=use_copy)
66
66
 
67
67
        if use_poll:
68
68
            res = p.poll()
76
76
    time.sleep(1)
77
77
 
78
78
    elapsed = (end - start)
79
 
    # elapsed = (end - start) * 1000000
80
 
    latency = elapsed / roundtrip_count / 2
 
79
    # elapsed = (end - start) * 1000000 # use with time.clock
 
80
    latency = elapsed / (roundtrip_count * 2)
81
81
 
82
82
    print "message size: %.0f [B]" % (message_size, )
83
83
    print "roundtrip count: %.0f" % (roundtrip_count, )