diff --git a/src/emqttd_cli.erl b/src/emqttd_cli.erl index d41bf26de..bcc68e5cf 100644 --- a/src/emqttd_cli.erl +++ b/src/emqttd_cli.erl @@ -368,7 +368,7 @@ vm([]) -> vm(["all"]); vm(["all"]) -> - [vm([Name]) || Name <- ["load", "memory", "process", "io"]]; + [vm([Name]) || Name <- ["load", "memory", "process", "io", "ports"]]; vm(["load"]) -> [?PRINT("cpu/~-20s: ~s~n", [L, V]) || {L, V} <- emqttd_vm:loads()]; @@ -387,12 +387,18 @@ vm(["io"]) -> ?PRINT("io/~-21s: ~w~n", [Key, get_value(Key, IoInfo)]) end, [max_fds, active_fds]); +vm(["ports"]) -> + foreach(fun({Name, Key}) -> + ?PRINT("ports/~-16s: ~w~n", [Name, erlang:system_info(Key)]) + end, [{count, port_count}, {limit, port_limit}]); + vm(_) -> - ?USAGE([{"vm all", "Show info of erlang vm"}, - {"vm load", "Show load of erlang vm"}, - {"vm memory", "Show memory of erlang vm"}, - {"vm process", "Show process of erlang vm"}, - {"vm io", "Show IO of erlang vm"}]). + ?USAGE([{"vm all", "Show info of Erlang VM"}, + {"vm load", "Show load of Erlang VM"}, + {"vm memory", "Show memory of Erlang VM"}, + {"vm process", "Show process of Erlang VM"}, + {"vm io", "Show IO of Erlang VM"}, + {"vm ports", "Show Ports of Erlang VM"}]). %%-------------------------------------------------------------------- %% @doc mnesia Command diff --git a/test/emqttd_SUITE.erl b/test/emqttd_SUITE.erl index 8e9366503..fc65e0477 100644 --- a/test/emqttd_SUITE.erl +++ b/test/emqttd_SUITE.erl @@ -74,7 +74,8 @@ groups() -> cli_subscriptions, cli_bridges, cli_plugins, - cli_listeners]}]. + cli_listeners, + cli_vm]}]. init_per_suite(Config) -> application:start(lager), @@ -419,3 +420,7 @@ cli_bridges(_) -> cli_listeners(_) -> emqttd_cli:listeners([]). +cli_vm(_) -> + emqttd_cli:vm(), + emqttd_cli:vm(["ports"]). +