Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 32 lines (26 sloc) 1.006 kb
0139502 @evax Update perf tests to support active mode
evax authored
1 #! /usr/bin/env escript
2 %%! -smp enable -pa ebin -pa perf
3 %-mode(compile).
4
5 main([BindTo,MessageSizeStr,MessageCountStr]) ->
6 {MessageSize, _} = string:to_integer(MessageSizeStr),
7 {MessageCount, _} = string:to_integer(MessageCountStr),
8 {ok, Context} = erlzmq:context(),
9 {ok, Socket} = erlzmq:socket(Context, [sub, {active, true}]),
10 ok = erlzmq:setsockopt(Socket,subscribe, <<>>),
11 ok = erlzmq:bind(Socket, BindTo),
12 receive
13 _ ->
14 ok
15 end,
16 Start = now(),
17 erlzmq_perf:recv_loop(MessageCount-1, Socket, active),
18 Elapsed = timer:now_diff(now(), Start),
19
20 Throughput = MessageCount / Elapsed * 1000000,
21 Megabits = Throughput * MessageSize * 8 / 1000000,
22
23 io:format("message size: ~p [B]~n"
24 "message count: ~p~n"
25 "mean throughput: ~p [msg/s]~n"
26 "mean throughput: ~p [Mb/s]~n",
27 [MessageSize, MessageCount, Throughput, Megabits]),
28
29 erlzmq:close(Socket),
30 erlzmq:term(Context).
31
Something went wrong with that request. Please try again.