format
This commit is contained in:
parent
cb4ad87010
commit
2dd6d160f3
|
@ -278,7 +278,6 @@
|
|||
|
||||
%% Erlang System Monitor
|
||||
{sysmon, [
|
||||
|
||||
%% Long GC
|
||||
{long_gc, 100},
|
||||
|
||||
|
|
|
@ -270,7 +270,6 @@
|
|||
|
||||
%% Erlang System Monitor
|
||||
{sysmon, [
|
||||
|
||||
%% Long GC, don't monitor in production mode for:
|
||||
%% https://github.com/erlang/otp/blob/feb45017da36be78d4c5784d758ede619fa7bfd3/erts/emulator/beam/erl_gc.c#L421
|
||||
{long_gc, false},
|
||||
|
|
|
@ -35,8 +35,7 @@
|
|||
{packet, raw},
|
||||
{reuseaddr, true},
|
||||
{backlog, 512},
|
||||
{nodelay, true}
|
||||
]).
|
||||
{nodelay, true}]).
|
||||
|
||||
-define(APP, ?MODULE).
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
%%% SOFTWARE.
|
||||
%%%-----------------------------------------------------------------------------
|
||||
%%% @doc
|
||||
%%% MQTT Topic Trie Tree.
|
||||
%%% MQTT Topic Trie.
|
||||
%%%
|
||||
%%% [Trie](http://en.wikipedia.org/wiki/Trie)
|
||||
%%%
|
||||
|
@ -120,7 +120,7 @@ match(Topic) when is_binary(Topic) ->
|
|||
[Name || #trie_node{topic=Name} <- TrieNodes, Name =/= undefined].
|
||||
|
||||
%%------------------------------------------------------------------------------
|
||||
%% @doc Delete topic from trie tree
|
||||
%% @doc Delete topic from trie
|
||||
%% @end
|
||||
%%------------------------------------------------------------------------------
|
||||
-spec delete(Topic :: binary()) -> ok.
|
||||
|
|
|
@ -33,23 +33,15 @@
|
|||
|
||||
-export([get_memory/0]).
|
||||
|
||||
-export([get_process_list/0,
|
||||
get_process_info/0,
|
||||
get_process_info/1,
|
||||
get_process_gc/0,
|
||||
get_process_gc/1,
|
||||
-export([get_process_list/0, get_process_info/0, get_process_info/1,
|
||||
get_process_gc/0, get_process_gc/1,
|
||||
get_process_group_leader_info/1,
|
||||
get_process_limit/0]).
|
||||
|
||||
-export([get_ets_list/0,
|
||||
get_ets_info/0,
|
||||
get_ets_info/1,
|
||||
get_ets_object/0,
|
||||
get_ets_object/1]).
|
||||
-export([get_ets_list/0, get_ets_info/0, get_ets_info/1,
|
||||
get_ets_object/0, get_ets_object/1]).
|
||||
|
||||
-export([get_port_types/0,
|
||||
get_port_info/0,
|
||||
get_port_info/1]).
|
||||
-export([get_port_types/0, get_port_info/0, get_port_info/1]).
|
||||
|
||||
-define(UTIL_ALLOCATORS, [temp_alloc,
|
||||
eheap_alloc,
|
||||
|
@ -192,8 +184,7 @@ format_system_info(allocator, {_,_,_,List}) ->
|
|||
List;
|
||||
format_system_info(dist_ctrl, List) ->
|
||||
lists:map(fun({Node, Socket}) ->
|
||||
{ok, Stats} = inet:getstat(Socket),
|
||||
{Node, Stats}
|
||||
{ok, Stats} = inet:getstat(Socket), {Node, Stats}
|
||||
end, List);
|
||||
format_system_info(driver_version, Value) ->
|
||||
list_to_binary(Value);
|
||||
|
@ -238,10 +229,9 @@ scheduler_usage(Interval) when is_integer(Interval) ->
|
|||
scheduler_usage_diff(First, Last).
|
||||
|
||||
scheduler_usage_diff(First, Last) ->
|
||||
lists:map(
|
||||
fun({{I, A0, T0},{I, A1, T1}}) ->{I, (A1 - A0)/(T1 - T0)}end,
|
||||
lists:zip(lists:sort(First), lists:sort(Last))
|
||||
).
|
||||
lists:map(fun({{I, A0, T0},{I, A1, T1}}) ->
|
||||
{I, (A1 - A0)/(T1 - T0)}
|
||||
end, lists:zip(lists:sort(First), lists:sort(Last))).
|
||||
|
||||
get_memory()->
|
||||
[{Key, get_memory(Key, current)} || Key <- [used, allocated, unused, usage]] ++ erlang:memory().
|
||||
|
@ -275,10 +265,8 @@ allocators() ->
|
|||
UtilAllocators = erlang:system_info(alloc_util_allocators),
|
||||
Allocators = [sys_alloc, mseg_alloc|UtilAllocators],
|
||||
[{{A, N},lists:sort(proplists:delete(versions, Props))} ||
|
||||
A <- Allocators,
|
||||
Allocs <- [erlang:system_info({allocator, A})],
|
||||
Allocs =/= false,
|
||||
{_, N, Props} <- Allocs].
|
||||
A <- Allocators, Allocs <- [erlang:system_info({allocator, A})],
|
||||
Allocs =/= false, {_, N, Props} <- Allocs].
|
||||
|
||||
container_size(Prop, Keyword, Container) ->
|
||||
Sbcs = container_value(Prop, Keyword, sbcs, Container),
|
||||
|
@ -291,7 +279,8 @@ container_value(Props, Pos, mbcs = Type, Container) when is_integer(Pos)->
|
|||
Pool = case proplists:get_value(mbcs_pool, Props) of
|
||||
PoolProps when PoolProps =/= undefined ->
|
||||
element(Pos, lists:keyfind(Container, 1, PoolProps));
|
||||
_ -> 0
|
||||
_ ->
|
||||
0
|
||||
end,
|
||||
TypeProps = proplists:get_value(Type, Props),
|
||||
Pool + element(Pos, lists:keyfind(Container, 1, TypeProps));
|
||||
|
@ -385,7 +374,6 @@ port_info(PortTerm, specific) ->
|
|||
case catch inet:getstat(Port) of
|
||||
{ok, Stats} -> [{statistics, Stats}];
|
||||
_ -> []
|
||||
|
||||
end ++
|
||||
case catch inet:peername(Port) of
|
||||
{ok, Peer} -> [{peername, Peer}];
|
||||
|
@ -401,7 +389,8 @@ case catch inet:getopts(Port, ?SOCKET_OPTS ) of
|
|||
end;
|
||||
{_, "efile"} ->
|
||||
[];
|
||||
_ ->[]
|
||||
_ ->
|
||||
[]
|
||||
end,
|
||||
{specific, Props};
|
||||
port_info(PortTerm, Keys) when is_list(Keys) ->
|
||||
|
@ -423,11 +412,7 @@ transform_port(N) when is_integer(N) ->
|
|||
Name = iolist_to_binary(atom_to_list(node())),
|
||||
NameLen = iolist_size(Name),
|
||||
Vsn = binary:last(term_to_binary(self())),
|
||||
Bin = <<131, 102, 100,
|
||||
NameLen:2/unit:8,
|
||||
Name:NameLen/binary,
|
||||
N:4/unit:8,
|
||||
Vsn:8>>,
|
||||
Bin = <<131, 102, 100, NameLen:2/unit:8, Name:NameLen/binary, N:4/unit:8, Vsn:8>>,
|
||||
binary_to_term(Bin).
|
||||
|
||||
ports_type_list() ->
|
||||
|
|
Loading…
Reference in New Issue