Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: ef5bc7018d
Fetching contributors…

Cannot retrieve contributors at this time

executable file 25 lines (19 sloc) 0.844 kB
#! /usr/bin/env escript
%%! -smp enable -pa ebin -pa perf
main([ConnectTo,MessageSizeStr,RoundtripCountStr]) ->
{MessageSize, _} = string:to_integer(MessageSizeStr),
{RoundtripCount, _} = string:to_integer(RoundtripCountStr),
{ok, Context} = erlzmq:context(),
{ok, Socket} = erlzmq:socket(Context, [req, {active, false}]),
ok = erlzmq:connect(Socket, ConnectTo),
Msg = list_to_binary(lists:duplicate(MessageSize, 0)),
Start = now(),
erlzmq_perf:remote_lat_loop(RoundtripCount, Socket, Msg),
Elapsed = timer:now_diff(now(), Start),
Latency = Elapsed / (RoundtripCount * 2),
io:format("message size: ~p [B]~n"
"roundtrip count: ~p~n"
"average latency: ~p [us]~n",
[MessageSize, RoundtripCount, Latency]),
erlzmq:close(Socket),
erlzmq:term(Context).
Jump to Line
Something went wrong with that request. Please try again.