diff options
author | Rickard Green <[email protected]> | 2017-09-05 14:44:01 +0200 |
---|---|---|
committer | Rickard Green <[email protected]> | 2017-09-05 14:44:01 +0200 |
commit | 4c27e0d703df7ee6786fba6d9e75c63d231a2b17 (patch) | |
tree | f20ffa38df3cf5c8bad2306ec709bbc64b772a88 /erts/emulator/test | |
parent | 7636e282042f5ea1e8ffcd019ef2f4fae36c8fb7 (diff) | |
parent | 67f6114d3701dd38614acf520f13c07174a99d11 (diff) | |
download | otp-4c27e0d703df7ee6786fba6d9e75c63d231a2b17.tar.gz otp-4c27e0d703df7ee6786fba6d9e75c63d231a2b17.tar.bz2 otp-4c27e0d703df7ee6786fba6d9e75c63d231a2b17.zip |
Merge branch 'maint'
* maint:
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 6c01bfd45c..7a396d273c 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. |