sigar/bindings/erl/examples/uptime.erl
2009-06-14 21:29:08 -07:00

20 lines
340 B
Erlang
Executable File

#!/usr/bin/env escript
-include(sigar).
main(_) ->
{ok, S} = sigar:start(),
case sigar:loadavg(S) of
{ok, Avg} ->
lists:map(
fun(A) ->
io:format("~w% ", [A]) end,
Avg);
{error, Err} ->
Err
end,
io:format("~n"),
sigar:stop(S).