This commit is contained in:
Feng 2015-10-01 11:23:24 +08:00
parent 14d2de3b05
commit 354ae6f398
1 changed files with 6 additions and 5 deletions

View File

@ -31,12 +31,12 @@
-include("emqttd.hrl"). -include("emqttd.hrl").
-export([start_link/0]).
-behaviour(gen_server). -behaviour(gen_server).
-define(SERVER, ?MODULE). -define(SERVER, ?MODULE).
-export([start_link/0]).
%% statistics API. %% statistics API.
-export([statsfun/1, statsfun/2, -export([statsfun/1, statsfun/2,
getstats/0, getstat/1, getstats/0, getstat/1,
@ -52,8 +52,8 @@
%% $SYS Topics for Clients %% $SYS Topics for Clients
-define(SYSTOP_CLIENTS, [ -define(SYSTOP_CLIENTS, [
'clients/count', % clients connected current 'clients/count', % clients connected current
'clients/max' % max clients connected 'clients/max' % max clients connected
]). ]).
%% $SYS Topics for Sessions %% $SYS Topics for Sessions
@ -72,6 +72,7 @@
'queues/max' % ... 'queues/max' % ...
]). ]).
%%%============================================================================= %%%=============================================================================
%%% API %%% API
%%%============================================================================= %%%=============================================================================
@ -102,7 +103,7 @@ statsfun(Stat, MaxStat) ->
%%------------------------------------------------------------------------------ %%------------------------------------------------------------------------------
-spec getstats() -> [{atom(), non_neg_integer()}]. -spec getstats() -> [{atom(), non_neg_integer()}].
getstats() -> getstats() ->
ets:tab2list(?STATS_TAB). lists:sort(ets:tab2list(?STATS_TAB)).
%%------------------------------------------------------------------------------ %%------------------------------------------------------------------------------
%% @doc Get stats by name %% @doc Get stats by name