%%%-------------------------------------------------------------------
%%% @author anlicheng
%%% @copyright (C) 2023, <COMPANY>
%%% @doc
%%%
%%% @end
%%% Created : 21. 12月 2023 11:08
%%%-------------------------------------------------------------------
-module(iot_observer).
-author("anlicheng").

%% API
-export([memory_top/1, cpu_top/1, stop/0]).

memory_top(Interval) when is_integer(Interval) ->
    spawn(fun()->etop:start([{output, text}, {interval, Interval}, {lines, 20}, {sort, memory}])end).

cpu_top(Interval) when is_integer(Interval) ->
    spawn(fun()->etop:start([{output, text}, {interval, Interval}, {lines, 20}, {sort, runtime}])end).

stop() ->
    etop:stop().