diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2011-02-10 10:06:21 +0000 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2011-02-10 10:06:21 +0000 |
commit | 4a6c7d0f4630538939a211843c86905ef1de908b (patch) | |
tree | 826e60593b9809f0ce5748d438aa45936dc44584 /test | |
parent | 6c3f51129713a3fea8239903d688e2e74b570a1b (diff) | |
download | pysendfile-4a6c7d0f4630538939a211843c86905ef1de908b.tar.gz |
benchmark server docstring
Diffstat (limited to 'test')
-rw-r--r-- | test/benchmark.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/test/benchmark.py b/test/benchmark.py index 09d1e0c..5dcd833 100644 --- a/test/benchmark.py +++ b/test/benchmark.py @@ -5,7 +5,7 @@ A simle benchmark script which compares plain send() and sendfile() performances in terms of CPU time spent and bytes transmitted per second. -This is what I get on my Linux 2.6.35-22 box, Intel core duo 3.1 GHz: +This is what I get on my Linux 2.6.35-22 box, Intel core-duo, 3.1 GHz: === send() === cpu: 6.60 usec/pass @@ -20,7 +20,6 @@ Working with python 2.x only. """ import socket -import sys import os import errno import timeit @@ -74,6 +73,12 @@ class Client: def start_server(use_sendfile, keep_sending=False): + """A simple test server which sends a file once a client connects. + use_sendfile decides whether using sendfile() or plain sendall() + method. + If keep_sending is True restart sending file when EOF is reached + instead of disconnecting. + """ sock = socket.socket() sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) sock.bind((HOST, PORT)) @@ -148,7 +153,6 @@ def main(): bytes1 = client.retr_for_1_sec() server.terminate() - # MB/sec: use send() # MB/sec: use sendfile() server = Process(target=start_server, kwargs={"use_sendfile":False, "keep_sending":True}) |