diff options
author | Björn-Egil Dahlberg <[email protected]> | 2016-03-16 18:36:18 +0100 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2016-03-16 18:45:15 +0100 |
commit | e7473f6810b249d1115361f005fb8b44fe59f474 (patch) | |
tree | ec27b307eb4cb7f8499db6ec6da99270970c8624 /lib | |
parent | 5eb0a3f256d6f816ebd56ba5d991eecaf580dd88 (diff) | |
download | otp-e7473f6810b249d1115361f005fb8b44fe59f474.tar.gz otp-e7473f6810b249d1115361f005fb8b44fe59f474.tar.bz2 otp-e7473f6810b249d1115361f005fb8b44fe59f474.zip |
Use monotonic_time/1 instead of now/0
Diffstat (limited to 'lib')
-rw-r--r-- | lib/percept/src/percept.erl | 6 | ||||
-rw-r--r-- | lib/percept/test/percept_SUITE.erl | 14 |
2 files changed, 9 insertions, 11 deletions
diff --git a/lib/percept/src/percept.erl b/lib/percept/src/percept.erl index badb3f3d66..f1a2002c9d 100644 --- a/lib/percept/src/percept.erl +++ b/lib/percept/src/percept.erl @@ -226,7 +226,7 @@ stop_webserver(Port) -> parse_and_insert(Filename, DB) -> io:format("Parsing: ~p ~n", [Filename]), - T0 = erlang:now(), + T0 = erlang:monotonic_time(milli_seconds), Pid = dbg:trace_client(file, Filename, mk_trace_parser(self())), Ref = erlang:monitor(process, Pid), parse_and_insert_loop(Filename, Pid, Ref, DB, T0). @@ -239,8 +239,8 @@ parse_and_insert_loop(Filename, Pid, Ref, DB, T0) -> {parse_complete, {Pid, Count}} -> receive {'DOWN', Ref, process, Pid, normal} -> ok after 0 -> ok end, DB ! {action, consolidate}, - T1 = erlang:now(), - io:format("Parsed ~p entries in ~p s.~n", [Count, ?seconds(T1, T0)]), + T1 = erlang:monotonic_time(milli_seconds), + io:format("Parsed ~w entries in ~w ms.~n", [Count, T1 - T0]), io:format(" ~p created processes.~n", [length(percept_db:select({information, procs}))]), io:format(" ~p opened ports.~n", [length(percept_db:select({information, ports}))]), ok; diff --git a/lib/percept/test/percept_SUITE.erl b/lib/percept/test/percept_SUITE.erl index 06d62630ba..afb8bbdd5b 100644 --- a/lib/percept/test/percept_SUITE.erl +++ b/lib/percept/test/percept_SUITE.erl @@ -116,11 +116,10 @@ analyze(Config) when is_list(Config) -> Begin = processes(), Path = ?config(data_dir, Config), File = filename:join([Path,"profile_test.dat"]), - T0 = erlang:now(), + T0 = erlang:monotonic_time(milli_seconds), ?line ok = percept:analyze(File), - T1 = erlang:now(), - Secs = timer:now_diff(T1,T0)/1000000, - io:format("percept:analyze/1 took ~.2f s.~n", [Secs]), + T1 = erlang:monotonic_time(milli_seconds), + io:format("percept:analyze/1 took ~w ms.~n", [T1 - T0]), ?line {stopped, _} = percept_db:stop(), print_remainers(remainers(Begin, processes())), ok. @@ -133,11 +132,10 @@ analyze_dist(Config) when is_list(Config) -> Begin = processes(), Path = ?config(data_dir, Config), File = filename:join([Path,"ipc-dist.dat"]), - T0 = erlang:now(), + T0 = erlang:monotonic_time(milli_seconds), ?line ok = percept:analyze(File), - T1 = erlang:now(), - Secs = timer:now_diff(T1,T0)/1000000, - io:format("percept:analyze/1 took ~.2f s.~n", [Secs]), + T1 = erlang:monotonic_time(milli_seconds), + io:format("percept:analyze/1 took ~w ms.~n", [T1 - T0]), ?line {stopped, _} = percept_db:stop(), print_remainers(remainers(Begin, processes())), ok. |