Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
347f143a
Commit
347f143a
authored
Aug 10, 2017
by
Luca Boccassi
Committed by
GitHub
Aug 10, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2673 from jakecobb/curve_testing
CURVE throughput performance testing
parents
6652a0d7
84ab7718
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
6 deletions
+58
-6
local_thr.cpp
perf/local_thr.cpp
+27
-4
remote_thr.cpp
perf/remote_thr.cpp
+31
-2
No files found.
perf/local_thr.cpp
View file @
347f143a
...
...
@@ -31,6 +31,12 @@
#include <stdio.h>
#include <stdlib.h>
// keys are arbitrary but must match remote_lat.cpp
const
char
server_pubkey
[]
=
"DX4nh=yUn{-9ugra0X3Src4SU-4xTgqxcYY.+<SH"
;
const
char
server_prvkey
[]
=
"{X}#>t#jRGaQ}gMhv=30r(Mw+87YGs+5%kh=i@f8"
;
const
char
client_pubkey
[]
=
"<n^oA}I:66W+*ds3tAmi1+KJzv-}k&fC2aA5Bj0K"
;
const
char
client_prvkey
[]
=
"9R9bV}[6z6DC-%$!jTVTKvWc=LEL{4i4gzUe$@Zx"
;
int
main
(
int
argc
,
char
*
argv
[])
{
const
char
*
bind_to
;
...
...
@@ -43,16 +49,20 @@ int main (int argc, char *argv [])
zmq_msg_t
msg
;
void
*
watch
;
unsigned
long
elapsed
;
unsigned
long
throughput
;
double
throughput
;
double
megabits
;
int
curve
=
0
;
if
(
argc
!=
4
)
{
printf
(
"usage: local_thr <bind-to> <message-size> <message-count>
\n
"
);
if
(
argc
!=
4
&&
argc
!=
5
)
{
printf
(
"usage: local_thr <bind-to> <message-size> <message-count>
[<enable_curve>]
\n
"
);
return
1
;
}
bind_to
=
argv
[
1
];
message_size
=
atoi
(
argv
[
2
]);
message_count
=
atoi
(
argv
[
3
]);
if
(
argc
>=
5
&&
atoi
(
argv
[
4
]))
{
curve
=
1
;
}
ctx
=
zmq_init
(
1
);
if
(
!
ctx
)
{
...
...
@@ -68,6 +78,19 @@ int main (int argc, char *argv [])
// Add your socket options here.
// For example ZMQ_RATE, ZMQ_RECOVERY_IVL and ZMQ_MCAST_LOOP for PGM.
if
(
curve
)
{
rc
=
zmq_setsockopt
(
s
,
ZMQ_CURVE_SECRETKEY
,
server_prvkey
,
sizeof
(
server_prvkey
));
if
(
rc
!=
0
)
{
printf
(
"error in zmq_setsockoopt: %s
\n
"
,
zmq_strerror
(
errno
));
return
-
1
;
}
int
server
=
1
;
rc
=
zmq_setsockopt
(
s
,
ZMQ_CURVE_SERVER
,
&
server
,
sizeof
(
int
));
if
(
rc
!=
0
)
{
printf
(
"error in zmq_setsockoopt: %s
\n
"
,
zmq_strerror
(
errno
));
return
-
1
;
}
}
rc
=
zmq_bind
(
s
,
bind_to
);
if
(
rc
!=
0
)
{
...
...
@@ -115,7 +138,7 @@ int main (int argc, char *argv [])
return
-
1
;
}
throughput
=
(
unsigned
long
)
throughput
=
((
double
)
message_count
/
(
double
)
elapsed
*
1000000
);
megabits
=
((
double
)
throughput
*
message_size
*
8
)
/
1000000
;
...
...
perf/remote_thr.cpp
View file @
347f143a
...
...
@@ -32,6 +32,12 @@
#include <stdlib.h>
#include <string.h>
// keys are arbitrary but must match local_lat.cpp
const
char
server_pubkey
[]
=
"DX4nh=yUn{-9ugra0X3Src4SU-4xTgqxcYY.+<SH"
;
const
char
server_prvkey
[]
=
"{X}#>t#jRGaQ}gMhv=30r(Mw+87YGs+5%kh=i@f8"
;
const
char
client_pubkey
[]
=
"<n^oA}I:66W+*ds3tAmi1+KJzv-}k&fC2aA5Bj0K"
;
const
char
client_prvkey
[]
=
"9R9bV}[6z6DC-%$!jTVTKvWc=LEL{4i4gzUe$@Zx"
;
int
main
(
int
argc
,
char
*
argv
[])
{
const
char
*
connect_to
;
...
...
@@ -42,15 +48,19 @@ int main (int argc, char *argv [])
int
rc
;
int
i
;
zmq_msg_t
msg
;
int
curve
=
0
;
if
(
argc
!=
4
)
{
if
(
argc
!=
4
&&
argc
!=
5
)
{
printf
(
"usage: remote_thr <connect-to> <message-size> "
"<message-count>
\n
"
);
"<message-count>
[<enable_curve>]
\n
"
);
return
1
;
}
connect_to
=
argv
[
1
];
message_size
=
atoi
(
argv
[
2
]);
message_count
=
atoi
(
argv
[
3
]);
if
(
argc
>=
5
&&
atoi
(
argv
[
4
]))
{
curve
=
1
;
}
ctx
=
zmq_init
(
1
);
if
(
!
ctx
)
{
...
...
@@ -66,6 +76,25 @@ int main (int argc, char *argv [])
// Add your socket options here.
// For example ZMQ_RATE, ZMQ_RECOVERY_IVL and ZMQ_MCAST_LOOP for PGM.
if
(
curve
)
{
rc
=
zmq_setsockopt
(
s
,
ZMQ_CURVE_SECRETKEY
,
client_prvkey
,
sizeof
(
client_prvkey
));
if
(
rc
!=
0
)
{
printf
(
"error in zmq_setsockoopt: %s
\n
"
,
zmq_strerror
(
errno
));
return
-
1
;
}
rc
=
zmq_setsockopt
(
s
,
ZMQ_CURVE_PUBLICKEY
,
client_pubkey
,
sizeof
(
client_pubkey
));
if
(
rc
!=
0
)
{
printf
(
"error in zmq_setsockoopt: %s
\n
"
,
zmq_strerror
(
errno
));
return
-
1
;
}
rc
=
zmq_setsockopt
(
s
,
ZMQ_CURVE_SERVERKEY
,
server_pubkey
,
sizeof
(
server_pubkey
));
if
(
rc
!=
0
)
{
printf
(
"error in zmq_setsockoopt: %s
\n
"
,
zmq_strerror
(
errno
));
return
-
1
;
}
}
rc
=
zmq_connect
(
s
,
connect_to
);
if
(
rc
!=
0
)
{
...
...
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