Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
27 lines (24 sloc) 698 Bytes
-module(system).
-export([get/0, get/1]).
%% Returns information about the system and node we're currently running on
get() ->
{H, M, S} = erlang:time(),
Formatter = fun(X) ->
case X < 10 of
true ->
"0" ++ integer_to_list(X);
false ->
integer_to_list(X)
end
end,
Clock = lists:concat([Formatter(H),":",Formatter(M),":",Formatter(S)]),
Data = [
[<<"Node">>, node()],
[<<"Clock">>, Clock]
],
%% Memory information
Unit = fun(B) -> integer_to_list(B) ++ " bytes" end,
Memory = [[Key, Unit(Value)] || {Key, Value} <- erlang:memory()],
Data ++ Memory.
get(Arg) ->
Arg.