aboutsummaryrefslogtreecommitdiffstats
path: root/lib/observer/src/etop_txt.erl
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2016-12-12 16:34:32 +0100
committerSiri Hansen <[email protected]>2016-12-12 16:34:32 +0100
commit40e5a09362042adfccc5964bde48a2dce27373fd (patch)
tree349f52daef265910e884d698f1d258e0458d795b /lib/observer/src/etop_txt.erl
parentb47d104994c6f11301f23b0675ed5f06f3e25922 (diff)
downloadotp-40e5a09362042adfccc5964bde48a2dce27373fd.tar.gz
otp-40e5a09362042adfccc5964bde48a2dce27373fd.tar.bz2
otp-40e5a09362042adfccc5964bde48a2dce27373fd.zip
[etop] Show CPU utilization for last interval only
Since commit 265998a7e412cd382315632964846569c370a5a2, etop reports the CPU (scheduler) utilization since the tool was started instead of for the last interval only. This is now corrected.
Diffstat (limited to 'lib/observer/src/etop_txt.erl')
-rw-r--r--lib/observer/src/etop_txt.erl24
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/observer/src/etop_txt.erl b/lib/observer/src/etop_txt.erl
index 3b4c176478..6b8f9df24f 100644
--- a/lib/observer/src/etop_txt.erl
+++ b/lib/observer/src/etop_txt.erl
@@ -22,35 +22,35 @@
%%-compile(export_all).
-export([init/1,stop/1]).
--export([do_update/3]).
+-export([do_update/4]).
-include("etop.hrl").
-include("etop_defs.hrl").
--import(etop,[loadinfo/1,meminfo/2]).
+-import(etop,[loadinfo/2,meminfo/2]).
-define(PROCFORM,"~-15w~-20s~8w~8w~8w~8w ~-20s~n").
stop(Pid) -> Pid ! stop.
init(Config) ->
- loop(Config).
+ loop(#etop_info{},Config).
-loop(Config) ->
- Info = do_update(Config),
+loop(Prev,Config) ->
+ Info = do_update(Prev,Config),
receive
stop -> stopped;
- {dump,Fd} -> do_update(Fd,Info,Config), loop(Config);
- {config,_,Config1} -> loop(Config1)
- after Config#opts.intv -> loop(Config)
+ {dump,Fd} -> do_update(Fd,Info,Prev,Config), loop(Info,Config);
+ {config,_,Config1} -> loop(Info,Config1)
+ after Config#opts.intv -> loop(Info,Config)
end.
-do_update(Config) ->
+do_update(Prev,Config) ->
Info = etop:update(Config),
- do_update(standard_io,Info,Config).
+ do_update(standard_io,Info,Prev,Config).
-do_update(Fd,Info,Config) ->
- {Cpu,NProcs,RQ,Clock} = loadinfo(Info),
+do_update(Fd,Info,Prev,Config) ->
+ {Cpu,NProcs,RQ,Clock} = loadinfo(Info,Prev),
io:nl(Fd),
writedoubleline(Fd),
case Info#etop_info.memi of