diff options
author | Björn-Egil Dahlberg <[email protected]> | 2016-04-06 19:46:34 +0200 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2016-04-07 12:10:13 +0200 |
commit | 8ccea1c2c756d8bc548ee6ba3e10f5a583aca7e7 (patch) | |
tree | db703599c096483483796be01982d5a1bf75c072 /lib/tools/test/fprof_SUITE.erl | |
parent | 146dfa9ddc3b31649ef581d65f3cb00ef95af10f (diff) | |
download | otp-8ccea1c2c756d8bc548ee6ba3e10f5a583aca7e7.tar.gz otp-8ccea1c2c756d8bc548ee6ba3e10f5a583aca7e7.tar.bz2 otp-8ccea1c2c756d8bc548ee6ba3e10f5a583aca7e7.zip |
Modernize use of timetraps
Diffstat (limited to 'lib/tools/test/fprof_SUITE.erl')
-rw-r--r-- | lib/tools/test/fprof_SUITE.erl | 46 |
1 files changed, 5 insertions, 41 deletions
diff --git a/lib/tools/test/fprof_SUITE.erl b/lib/tools/test/fprof_SUITE.erl index 0a2b85ff45..de946a609a 100644 --- a/lib/tools/test/fprof_SUITE.erl +++ b/lib/tools/test/fprof_SUITE.erl @@ -22,8 +22,7 @@ -include_lib("common_test/include/ct.hrl"). %% Test server framework exports --export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2, not_run/1]). +-export([all/0, suite/0, not_run/1]). %% Test suites -export([stack_seq/1, tail_seq/1, create_file_slow/1, spawn_simple/1, @@ -33,14 +32,10 @@ %% Other exports -export([create_file_slow/2]). - %% Debug exports -export([parse/1, verify/2]). -export([spawn_simple_test/3]). - --define(line_trace,true). - %-define(debug,true). -ifdef(debug). -define(dbg(Str,Args), io:format(Str,Args)). @@ -49,14 +44,14 @@ -endif. - %%%--------------------------------------------------------------------- %%% Test suites %%%--------------------------------------------------------------------- - -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{seconds,60}}]. all() -> case test_server:is_native(fprof_SUITE) of @@ -67,21 +62,6 @@ all() -> cpu_create_file_slow] end. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - not_run(Config) when is_list(Config) -> {skipped, "Native code"}. @@ -93,7 +73,6 @@ stack_seq(doc) -> stack_seq(suite) -> []; stack_seq(Config) when is_list(Config) -> - Timetrap = ?t:timetrap(?t:seconds(20)), PrivDir = ?config(priv_dir, Config), TraceFile = filename:join(PrivDir, ?MODULE_STRING"_stack_seq.trace"), @@ -131,7 +110,6 @@ stack_seq(Config) when is_list(Config) -> ets:delete(T), file:delete(TraceFile), file:delete(AnalysisFile), - ?t:timetrap_cancel(Timetrap), Acc1 = ts_sub(TS1, TS0), Acc2 = ts_sub(TS2, TS1), io:format("ts:~w, fprof:~w, bare:~w.~n", [Acc, Acc1, Acc2]), @@ -144,7 +122,6 @@ tail_seq(doc) -> tail_seq(suite) -> []; tail_seq(Config) when is_list(Config) -> - Timetrap = ?t:timetrap(?t:seconds(10)), PrivDir = ?config(priv_dir, Config), TraceFile = filename:join(PrivDir, ?MODULE_STRING"_tail_seq.trace"), @@ -184,7 +161,6 @@ tail_seq(Config) when is_list(Config) -> ets:delete(T), file:delete(TraceFile), file:delete(AnalysisFile), - ?t:timetrap_cancel(Timetrap), Acc1 = ts_sub(TS1, TS0), Acc2 = ts_sub(TS2, TS1), io:format("ts:~w, fprof:~w, bare:~w.~n", [Acc, Acc2, Acc1]), @@ -203,7 +179,6 @@ create_file_slow(Config) -> end. do_create_file_slow(Config) -> - Timetrap = ?t:timetrap(?t:seconds(40)), PrivDir = ?config(priv_dir, Config), TraceFile = filename:join(PrivDir, ?MODULE_STRING"_create_file_slow.trace"), @@ -244,7 +219,6 @@ do_create_file_slow(Config) -> file:delete(DataFile), file:delete(TraceFile), file:delete(AnalysisFile), - ?t:timetrap_cancel(Timetrap), Acc1 = ts_sub(TS1, TS0), Acc3 = ts_sub(TS3, TS2), io:format("ts:~w, fprof:~w, bare:~w.~n", [Acc, Acc3, Acc1]), @@ -259,7 +233,6 @@ spawn_simple(doc) -> spawn_simple(suite) -> []; spawn_simple(Config) when is_list(Config) -> - Timetrap = ?t:timetrap(?t:seconds(30)), PrivDir = ?config(priv_dir, Config), TraceFile = filename:join(PrivDir, ?MODULE_STRING"_spawn_simple.trace"), @@ -321,7 +294,6 @@ spawn_simple(Config) when is_list(Config) -> ets:delete(T), file:delete(TraceFile), file:delete(AnalysisFile), - ?t:timetrap_cancel(Timetrap), Acc1 = ts_sub(TS1, TS0), Acc2 = ts_sub(TS2, TS1), io:format("ts:~w, fprof:~w, bare:~w.~n", [Acc, Acc2, Acc1]), @@ -355,7 +327,6 @@ imm_tail_seq(doc) -> imm_tail_seq(suite) -> []; imm_tail_seq(Config) when is_list(Config) -> - Timetrap = ?t:timetrap(?t:seconds(10)), PrivDir = ?config(priv_dir, Config), AnalysisFile = filename:join(PrivDir, ?MODULE_STRING"_imm_tail_seq.analysis"), @@ -402,7 +373,6 @@ imm_tail_seq(Config) when is_list(Config) -> %% ets:delete(T), file:delete(AnalysisFile), - ?t:timetrap_cancel(Timetrap), Acc1 = ts_sub(TS1, TS0), Acc3 = ts_sub(TS3, TS2), Acc5 = ts_sub(TS5, TS4), @@ -419,7 +389,6 @@ imm_create_file_slow(doc) -> imm_create_file_slow(suite) -> []; imm_create_file_slow(Config) when is_list(Config) -> - Timetrap = ?t:timetrap(?t:seconds(60)), PrivDir = ?config(priv_dir, Config), DataFile = filename:join(PrivDir, ?MODULE_STRING"_imm_create_file_slow.data"), @@ -456,7 +425,6 @@ imm_create_file_slow(Config) when is_list(Config) -> ets:delete(T), file:delete(DataFile), file:delete(AnalysisFile), - ?t:timetrap_cancel(Timetrap), Acc1 = ts_sub(TS1, TS0), Acc3 = ts_sub(TS3, TS2), io:format("ts:~w, fprof:~w, bare:~w.~n", [Acc, Acc3, Acc1]), @@ -470,7 +438,7 @@ imm_compile(doc) -> imm_compile(suite) -> []; imm_compile(Config) when is_list(Config) -> - Timetrap = ?t:timetrap(?t:minutes(20)), + ct:timetrap({minutes, 20}), DataDir = ?config(data_dir, Config), SourceFile = filename:join(DataDir, "foo.erl"), PrivDir = ?config(priv_dir, Config), @@ -519,7 +487,6 @@ imm_compile(Config) when is_list(Config) -> %% ets:delete(T), file:delete(AnalysisFile), - ?t:timetrap_cancel(Timetrap), io:format("~p (plain), ~p (eprof), ~p (fprof), ~p(cpu)~n", [Acc1/1000, Acc3/1000, Acc5/1000, Acc/1000]), {comment, io_lib:format("~p/~p (fprof/eprof) times slower", @@ -532,7 +499,6 @@ cpu_create_file_slow(doc) -> cpu_create_file_slow(suite) -> []; cpu_create_file_slow(Config) when is_list(Config) -> - Timetrap = ?t:timetrap(?t:seconds(40)), PrivDir = ?config(priv_dir, Config), TraceFile = filename:join(PrivDir, ?MODULE_STRING"_cpu_create_file_slow.trace"), @@ -587,11 +553,9 @@ cpu_create_file_slow(Config) when is_list(Config) -> _ -> test_server:fail(Result) end, - ?t:timetrap_cancel(Timetrap), TestResult. - %%%--------------------------------------------------------------------- %%% Functions to test %%%--------------------------------------------------------------------- |