Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
936dce61
Commit
936dce61
authored
Apr 10, 2010
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add bench_sendall.py. Original patch by Ralf Schmitt.
parent
1184b2fd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
+37
-0
greentest/bench_sendall.py
greentest/bench_sendall.py
+37
-0
No files found.
greentest/bench_sendall.py
0 → 100644
View file @
936dce61
#! /usr/bin/env python
import
time
from
gevent
import
server
,
socket
class
MyServer
(
server
.
StreamServer
):
def
handle
(
self
,
socket
,
addr
):
while
True
:
d
=
socket
.
recv
(
4096
)
if
not
d
:
break
def
main
():
server
=
MyServer
((
"127.0.0.1"
,
0
))
server
.
start
()
length
=
50
*
0x100000
data
=
"x"
*
(
50
*
0x100000
)
spent_total
=
0
N
=
10
conn
=
socket
.
create_connection
((
server
.
server_host
,
server
.
server_port
))
for
i
in
range
(
N
):
start
=
time
.
time
()
conn
.
sendall
(
data
)
spent
=
time
.
time
()
-
start
print
"%.2f MB/s"
%
(
length
/
spent
/
0x100000
)
spent_total
+=
spent
print
"== %.2f MB/s"
%
(
length
*
N
/
spent_total
/
0x100000
)
if
__name__
==
"__main__"
:
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment