Skip to content

Commit 5ea171d

Browse files
committed
chore: rebase to master
1 parent faa3ddf commit 5ea171d

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

src/emqtt_bench.erl

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
{nst_dets_file, undefined, "load-qst", string, "load quic session tickets from dets file"},
9797
%% == MQTT layer ==
9898
{username, $u, "username", string,
99-
"username for connecting to server, support %i, %(i/2), %(rand(100)) variables"},
99+
"username for connecting to server, support %i, %(rand(100)) variables"},
100100
{password, $P, "password", string,
101101
"password for connecting to server"},
102102
{keepalive, $k, "keepalive", {integer, 300},
@@ -198,6 +198,25 @@
198198

199199
-define(CONN_OPTS, ?COMMON_OPTS).
200200

201+
-define(COUNTER_NAMES,
202+
[ publish_latency
203+
, recv
204+
, sub
205+
, sub_fail
206+
, pub
207+
, pub_fail
208+
, pub_overrun
209+
, pub_succ
210+
, connect_succ
211+
, connect_fail
212+
, connect_retried
213+
, reconnect_succ
214+
, unreachable
215+
, connection_refused
216+
, connection_timeout
217+
, connection_idle
218+
]).
219+
201220
-define(shared_padding_tab, emqtt_bench_shared_payload).
202221
-define(QoELog, qoe_dlog).
203222
-define(cnt_map, cnt_map).
@@ -966,18 +985,18 @@ eval_expr("rand(" ++ Str) ->
966985
Int = strip_last_char(Str),
967986
rand:uniform(list_to_integer(Int));
968987
_ -> Str
969-
end.
988+
end;
989+
eval_expr(Str) ->
990+
throw({unsupported_expression, Str}).
970991

971992
parse_expr("%i") ->
972993
erlang:get(conn_id);
973-
parse_expr("%(i-div-2)") ->
974-
erlang:get(conn_id) div 2;
975-
parse_expr("%(" ++ Str) ->
994+
parse_expr("%(" ++ Str = Str0) ->
976995
case lists:last(Str) of
977996
$) ->
978997
eval_expr(strip_last_char(Str));
979998
_ ->
980-
throw({invalid_expression, "%(" ++ Str})
999+
Str0
9811000
end;
9821001
parse_expr(Str) ->
9831002
Str.

0 commit comments

Comments
 (0)