diff options
author | Rickard Green <[email protected]> | 2017-09-05 14:40:33 +0200 |
---|---|---|
committer | Rickard Green <[email protected]> | 2017-09-05 14:40:33 +0200 |
commit | 67f6114d3701dd38614acf520f13c07174a99d11 (patch) | |
tree | f0fa9d412359ba9ee3b8be2c098fc49bc72fc8f3 /erts/emulator/test | |
parent | 60c836afbb7c993f3bd635e12c80f018aa017e3b (diff) | |
parent | 5a45d2917cd14bf5eab690453e8a191549de4c2c (diff) | |
download | otp-67f6114d3701dd38614acf520f13c07174a99d11.tar.gz otp-67f6114d3701dd38614acf520f13c07174a99d11.tar.bz2 otp-67f6114d3701dd38614acf520f13c07174a99d11.zip |
Merge branch 'rickard/statistics-time-fixes/OTP-14597/ERL-465' into maint
* rickard/statistics-time-fixes/OTP-14597/ERL-465:
Bug fixes of statistics(wall_clock) and statistics(runtime)
Conflicts:
erts/emulator/beam/erl_time_sup.c
Diffstat (limited to 'erts/emulator/test')
-rw-r--r-- | erts/emulator/test/statistics_SUITE.erl | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/erts/emulator/test/statistics_SUITE.erl b/erts/emulator/test/statistics_SUITE.erl index 7690557fda..40cc940a94 100644 --- a/erts/emulator/test/statistics_SUITE.erl +++ b/erts/emulator/test/statistics_SUITE.erl @@ -23,8 +23,10 @@ %% Tests the statistics/1 bif. -export([all/0, suite/0, groups/0, + wall_clock_sanity/1, wall_clock_zero_diff/1, wall_clock_update/1, - runtime_zero_diff/1, + runtime_sanity/1, + runtime_zero_diff/1, runtime_update/1, runtime_diff/1, run_queue_one/1, scheduler_wall_time/1, @@ -54,11 +56,23 @@ all() -> groups() -> [{wall_clock, [], - [wall_clock_zero_diff, wall_clock_update]}, + [wall_clock_sanity, wall_clock_zero_diff, wall_clock_update]}, {runtime, [], - [runtime_zero_diff, runtime_update, runtime_diff]}, + [runtime_sanity, runtime_zero_diff, runtime_update, runtime_diff]}, {run_queue, [], [run_queue_one]}]. +wall_clock_sanity(Config) when is_list(Config) -> + erlang:yield(), + {WallClock, _} = statistics(wall_clock), + MT = erlang:monotonic_time(), + Time = erlang:convert_time_unit(MT - erlang:system_info(start_time), + native, millisecond), + io:format("Time=~p WallClock=~p~n", + [Time, WallClock]), + true = WallClock =< Time, + true = Time - 100 =< WallClock, + ok. + %%% Testing statistics(wall_clock). %% Tests that the 'Wall clock since last call' element of the result @@ -102,6 +116,20 @@ wall_clock_update1(0) -> %%% Test statistics(runtime). +runtime_sanity(Config) when is_list(Config) -> + case erlang:system_info(logical_processors_available) of + unknown -> + {skipped, "Don't know available logical processors"}; + LP when is_integer(LP) -> + erlang:yield(), + {RunTime, _} = statistics(runtime), + MT = erlang:monotonic_time(), + Time = erlang:convert_time_unit(MT - erlang:system_info(start_time), + native, millisecond), + io:format("Time=~p RunTime=~p~n", + [Time, RunTime]), + true = RunTime =< Time*LP + end. %% Tests that the difference between the times returned from two consectuitive %% calls to statistics(runtime) is zero. |