aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/test/old_scheduler_SUITE.erl
diff options
context:
space:
mode:
Diffstat (limited to 'erts/emulator/test/old_scheduler_SUITE.erl')
-rw-r--r--erts/emulator/test/old_scheduler_SUITE.erl304
1 files changed, 152 insertions, 152 deletions
diff --git a/erts/emulator/test/old_scheduler_SUITE.erl b/erts/emulator/test/old_scheduler_SUITE.erl
index 99c143e2d0..9d40417d0a 100644
--- a/erts/emulator/test/old_scheduler_SUITE.erl
+++ b/erts/emulator/test/old_scheduler_SUITE.erl
@@ -23,7 +23,7 @@
-include_lib("common_test/include/ct.hrl").
-export([all/0, suite/0,
- init_per_testcase/2, end_per_testcase/2]).
+ init_per_testcase/2, end_per_testcase/2]).
-export([equal/1, many_low/1, few_low/1, max/1, high/1]).
suite() ->
@@ -32,13 +32,13 @@ suite() ->
all() ->
case catch erlang:system_info(modified_timing_level) of
- Level when is_integer(Level) ->
- {skipped,
- "Modified timing (level " ++
- integer_to_list(Level) ++
- ") is enabled. Testcases gets messed "
- "up by modfied timing."};
- _ -> [equal, many_low, few_low, max, high]
+ Level when is_integer(Level) ->
+ {skipped,
+ "Modified timing (level " ++
+ integer_to_list(Level) ++
+ ") is enabled. Testcases gets messed "
+ "up by modfied timing."};
+ _ -> [equal, many_low, few_low, max, high]
end.
@@ -63,8 +63,8 @@ all() ->
init_per_testcase(_Case, Config) ->
%% main test process needs max prio
- ?line Prio = process_flag(priority, max),
- ?line MS = erlang:system_flag(multi_scheduling, block),
+ Prio = process_flag(priority, max),
+ MS = erlang:system_flag(multi_scheduling, block),
[{prio,Prio},{multi_scheduling, MS}|Config].
end_per_testcase(_Case, Config) ->
@@ -75,17 +75,17 @@ end_per_testcase(_Case, Config) ->
ok(Config) when is_list(Config) ->
case proplists:get_value(multi_scheduling, Config) of
- blocked ->
- {comment,
- "Multi-scheduling blocked during test. This testcase was not "
- "written to work with multiple schedulers."};
- _ -> ok
+ blocked ->
+ {comment,
+ "Multi-scheduling blocked during test. This testcase was not "
+ "written to work with multiple schedulers."};
+ _ -> ok
end.
%% Run equal number of low and normal prio processes.
equal(Config) when is_list(Config) ->
- ?line Self = self(),
+ Self = self(),
%% specify number of test processes to run
Normal = {normal,500},
@@ -95,87 +95,87 @@ equal(Config) when is_list(Config) ->
Time = 30,
%% start controllers
- ?line Receiver =
- spawn(fun() -> receiver(erlang:monotonic_time(), Time, Self, Normal, Low) end),
- ?line Starter =
- spawn(fun() -> starter(Normal, Low, Receiver) end),
+ Receiver =
+ spawn(fun() -> receiver(erlang:monotonic_time(), Time, Self, Normal, Low) end),
+ Starter =
+ spawn(fun() -> starter(Normal, Low, Receiver) end),
%% receive test data from Receiver
- ?line {NRs,NAvg,LRs,LAvg,Ratio} =
- receive
- {Receiver,Res} -> Res
- end,
+ {NRs,NAvg,LRs,LAvg,Ratio} =
+ receive
+ {Receiver,Res} -> Res
+ end,
%% stop controllers and test processes
- ?line exit(Starter, kill),
- ?line exit(Receiver, kill),
+ exit(Starter, kill),
+ exit(Receiver, kill),
io:format("Reports: ~w normal (~w/proc), ~w low (~w/proc). Ratio: ~w~n",
- [NRs,NAvg,LRs,LAvg,Ratio]),
+ [NRs,NAvg,LRs,LAvg,Ratio]),
%% runtime ratio between normal and low should be ~8
if Ratio < 7.5 ; Ratio > 8.5 ->
- ct:fail({bad_ratio,Ratio});
+ ct:fail({bad_ratio,Ratio});
true ->
- ok(Config)
+ ok(Config)
end.
%% Run many low and few normal prio processes.
many_low(Config) when is_list(Config) ->
- ?line Self = self(),
+ Self = self(),
Normal = {normal,1},
Low = {low,1000},
%% specify time of test (in seconds)
Time = 30,
- ?line Receiver =
- spawn(fun() -> receiver(erlang:monotonic_time(), Time, Self, Normal, Low) end),
- ?line Starter =
- spawn(fun() -> starter(Normal, Low, Receiver) end),
- ?line {NRs,NAvg,LRs,LAvg,Ratio} =
- receive
- {Receiver,Res} -> Res
- end,
- ?line exit(Starter, kill),
- ?line exit(Receiver, kill),
+ Receiver =
+ spawn(fun() -> receiver(erlang:monotonic_time(), Time, Self, Normal, Low) end),
+ Starter =
+ spawn(fun() -> starter(Normal, Low, Receiver) end),
+ {NRs,NAvg,LRs,LAvg,Ratio} =
+ receive
+ {Receiver,Res} -> Res
+ end,
+ exit(Starter, kill),
+ exit(Receiver, kill),
io:format("Reports: ~w normal (~w/proc), ~w low (~w/proc). Ratio: ~w~n",
- [NRs,NAvg,LRs,LAvg,Ratio]),
+ [NRs,NAvg,LRs,LAvg,Ratio]),
if Ratio < 7.5 ; Ratio > 8.5 ->
- ct:fail({bad_ratio,Ratio});
+ ct:fail({bad_ratio,Ratio});
true ->
- ok(Config)
+ ok(Config)
end.
%% Run few low and many normal prio processes.
few_low(Config) when is_list(Config) ->
- ?line Self = self(),
+ Self = self(),
Normal = {normal,1000},
Low = {low,1},
%% specify time of test (in seconds)
Time = 30,
- ?line Receiver =
- spawn(fun() -> receiver(erlang:monotonic_time(), Time, Self, Normal, Low) end),
- ?line Starter =
- spawn(fun() -> starter(Normal, Low, Receiver) end),
- ?line {NRs,NAvg,LRs,LAvg,Ratio} =
- receive
- {Receiver,Res} -> Res
- end,
- ?line exit(Starter, kill),
- ?line exit(Receiver, kill),
+ Receiver =
+ spawn(fun() -> receiver(erlang:monotonic_time(), Time, Self, Normal, Low) end),
+ Starter =
+ spawn(fun() -> starter(Normal, Low, Receiver) end),
+ {NRs,NAvg,LRs,LAvg,Ratio} =
+ receive
+ {Receiver,Res} -> Res
+ end,
+ exit(Starter, kill),
+ exit(Receiver, kill),
io:format("Reports: ~w normal (~w/proc), ~w low (~w/proc). Ratio: ~w~n",
- [NRs,NAvg,LRs,LAvg,Ratio]),
+ [NRs,NAvg,LRs,LAvg,Ratio]),
if Ratio < 7.0 ; Ratio > 8.5 ->
- ct:fail({bad_ratio,Ratio});
+ ct:fail({bad_ratio,Ratio});
true ->
- ok(Config)
+ ok(Config)
end.
@@ -184,7 +184,7 @@ few_low(Config) when is_list(Config) ->
max(Config) when is_list(Config) ->
max = process_flag(priority, max), % should already be max (init_per_tc)
- ?line Self = self(),
+ Self = self(),
Max = {max,2},
High = {high,2},
Normal = {normal,100},
@@ -193,58 +193,58 @@ max(Config) when is_list(Config) ->
%% specify time of test (in seconds)
Time = 30,
- ?line Receiver1 =
- spawn(fun() -> receiver(erlang:monotonic_time(), Time, Self, Max, High) end),
- ?line Starter1 =
- spawn(fun() -> starter(Max, High, Receiver1) end),
- ?line {M1Rs,M1Avg,HRs,HAvg,Ratio1} =
- receive
- {Receiver1,Res1} -> Res1
- end,
- ?line exit(Starter1, kill),
- ?line exit(Receiver1, kill),
+ Receiver1 =
+ spawn(fun() -> receiver(erlang:monotonic_time(), Time, Self, Max, High) end),
+ Starter1 =
+ spawn(fun() -> starter(Max, High, Receiver1) end),
+ {M1Rs,M1Avg,HRs,HAvg,Ratio1} =
+ receive
+ {Receiver1,Res1} -> Res1
+ end,
+ exit(Starter1, kill),
+ exit(Receiver1, kill),
io:format("Reports: ~w max (~w/proc), ~w high (~w/proc). Ratio: ~w~n",
- [M1Rs,M1Avg,HRs,HAvg,Ratio1]),
+ [M1Rs,M1Avg,HRs,HAvg,Ratio1]),
if Ratio1 < 1.0 ->
- ct:fail({bad_ratio,Ratio1});
+ ct:fail({bad_ratio,Ratio1});
true ->
- ok(Config)
+ ok(Config)
end,
- ?line Receiver2 =
- spawn(fun() -> receiver(erlang:monotonic_time(), Time, Self, Max, Normal) end),
- ?line Starter2 =
- spawn(fun() -> starter(Max, Normal, Receiver2) end),
- ?line {M2Rs,M2Avg,NRs,NAvg,Ratio2} =
- receive
- {Receiver2,Res2} -> Res2
- end,
- ?line exit(Starter2, kill),
- ?line exit(Receiver2, kill),
+ Receiver2 =
+ spawn(fun() -> receiver(erlang:monotonic_time(), Time, Self, Max, Normal) end),
+ Starter2 =
+ spawn(fun() -> starter(Max, Normal, Receiver2) end),
+ {M2Rs,M2Avg,NRs,NAvg,Ratio2} =
+ receive
+ {Receiver2,Res2} -> Res2
+ end,
+ exit(Starter2, kill),
+ exit(Receiver2, kill),
io:format("Reports: ~w max (~w/proc), ~w normal (~w/proc). Ratio: ~w~n",
- [M2Rs,M2Avg,NRs,NAvg,Ratio2]),
+ [M2Rs,M2Avg,NRs,NAvg,Ratio2]),
if Ratio2 < 1.0 ->
- ct:fail({bad_ratio,Ratio2});
+ ct:fail({bad_ratio,Ratio2});
true ->
- ok
+ ok
end,
- ?line Receiver3 =
- spawn(fun() -> receiver(erlang:monotonic_time(), Time, Self, Max, Low) end),
- ?line Starter3 =
- spawn(fun() -> starter(Max, Low, Receiver3) end),
- ?line {M3Rs,M3Avg,LRs,LAvg,Ratio3} =
- receive
- {Receiver3,Res3} -> Res3
- end,
- ?line exit(Starter3, kill),
- ?line exit(Receiver3, kill),
+ Receiver3 =
+ spawn(fun() -> receiver(erlang:monotonic_time(), Time, Self, Max, Low) end),
+ Starter3 =
+ spawn(fun() -> starter(Max, Low, Receiver3) end),
+ {M3Rs,M3Avg,LRs,LAvg,Ratio3} =
+ receive
+ {Receiver3,Res3} -> Res3
+ end,
+ exit(Starter3, kill),
+ exit(Receiver3, kill),
io:format("Reports: ~w max (~w/proc), ~w low (~w/proc). Ratio: ~w~n",
- [M3Rs,M3Avg,LRs,LAvg,Ratio3]),
+ [M3Rs,M3Avg,LRs,LAvg,Ratio3]),
if Ratio3 < 1.0 ->
- ct:fail({bad_ratio,Ratio3});
+ ct:fail({bad_ratio,Ratio3});
true ->
- ok(Config)
+ ok(Config)
end.
@@ -253,7 +253,7 @@ max(Config) when is_list(Config) ->
high(Config) when is_list(Config) ->
max = process_flag(priority, max), % should already be max (init_per_tc)
- ?line Self = self(),
+ Self = self(),
High = {high,2},
Normal = {normal,100},
Low = {low,100},
@@ -261,40 +261,40 @@ high(Config) when is_list(Config) ->
%% specify time of test (in seconds)
Time = 30,
- ?line Receiver1 =
- spawn(fun() -> receiver(erlang:monotonic_time(), Time, Self, High, Normal) end),
- ?line Starter1 =
- spawn(fun() -> starter(High, Normal, Receiver1) end),
- ?line {H1Rs,H1Avg,NRs,NAvg,Ratio1} =
- receive
- {Receiver1,Res1} -> Res1
- end,
- ?line exit(Starter1, kill),
- ?line exit(Receiver1, kill),
+ Receiver1 =
+ spawn(fun() -> receiver(erlang:monotonic_time(), Time, Self, High, Normal) end),
+ Starter1 =
+ spawn(fun() -> starter(High, Normal, Receiver1) end),
+ {H1Rs,H1Avg,NRs,NAvg,Ratio1} =
+ receive
+ {Receiver1,Res1} -> Res1
+ end,
+ exit(Starter1, kill),
+ exit(Receiver1, kill),
io:format("Reports: ~w high (~w/proc), ~w normal (~w/proc). Ratio: ~w~n",
- [H1Rs,H1Avg,NRs,NAvg,Ratio1]),
+ [H1Rs,H1Avg,NRs,NAvg,Ratio1]),
if Ratio1 < 1.0 ->
- ct:fail({bad_ratio,Ratio1});
+ ct:fail({bad_ratio,Ratio1});
true ->
- ok
+ ok
end,
- ?line Receiver2 =
- spawn(fun() -> receiver(erlang:monotonic_time(), Time, Self, High, Low) end),
- ?line Starter2 =
- spawn(fun() -> starter(High, Low, Receiver2) end),
- ?line {H2Rs,H2Avg,LRs,LAvg,Ratio2} =
- receive
- {Receiver2,Res2} -> Res2
- end,
- ?line exit(Starter2, kill),
- ?line exit(Receiver2, kill),
+ Receiver2 =
+ spawn(fun() -> receiver(erlang:monotonic_time(), Time, Self, High, Low) end),
+ Starter2 =
+ spawn(fun() -> starter(High, Low, Receiver2) end),
+ {H2Rs,H2Avg,LRs,LAvg,Ratio2} =
+ receive
+ {Receiver2,Res2} -> Res2
+ end,
+ exit(Starter2, kill),
+ exit(Receiver2, kill),
io:format("Reports: ~w high (~w/proc), ~w low (~w/proc). Ratio: ~w~n",
- [H2Rs,H2Avg,LRs,LAvg,Ratio2]),
+ [H2Rs,H2Avg,LRs,LAvg,Ratio2]),
if Ratio2 < 1.0 ->
- ct:fail({bad_ratio,Ratio2});
+ ct:fail({bad_ratio,Ratio2});
true ->
- ok(Config)
+ ok(Config)
end.
@@ -309,38 +309,38 @@ receiver(T0, TimeSec, Main, {P1,P1N}, {P2,P2N}) ->
%% uncomment lines below to get life sign (debug)
receiver(T0, Time, Main, P1,P1N,P1Rs, P2,P2N,P2Rs, 0) ->
-% T = erlang:convert_time_unit(erlang:monotonic_time() - T0, native, milli_seconds),
-% erlang:display({round(T/1000),P1Rs,P2Rs}),
+ % T = erlang:convert_time_unit(erlang:monotonic_time() - T0, native, milli_seconds),
+ % erlang:display({round(T/1000),P1Rs,P2Rs}),
receiver(T0, Time, Main, P1,P1N,P1Rs, P2,P2N,P2Rs, 100000);
receiver(T0, Time, Main, P1,P1N,P1Rs, P2,P2N,P2Rs, C) ->
Remain = Time - erlang:convert_time_unit(erlang:monotonic_time() - T0,
- native, milli_seconds), % test time remaining
+ native, milli_seconds), % test time remaining
Remain1 = if Remain < 0 ->
- 0;
- true ->
- Remain
- end,
+ 0;
+ true ->
+ Remain
+ end,
{P1Rs1,P2Rs1} =
- receive
- {_Pid,P1} -> % report from a P1 process
- {P1Rs+1,P2Rs};
- {_Pid,P2} -> % report from a P2 process
- {P1Rs,P2Rs+1}
- after Remain1 ->
- {P1Rs,P2Rs}
- end,
+ receive
+ {_Pid,P1} -> % report from a P1 process
+ {P1Rs+1,P2Rs};
+ {_Pid,P2} -> % report from a P2 process
+ {P1Rs,P2Rs+1}
+ after Remain1 ->
+ {P1Rs,P2Rs}
+ end,
if Remain > 0 -> % keep going
- receiver(T0, Time, Main, P1,P1N,P1Rs1, P2,P2N,P2Rs1, C-1);
+ receiver(T0, Time, Main, P1,P1N,P1Rs1, P2,P2N,P2Rs1, C-1);
true -> % finish
- %% calculate results and send to main test process
- P1Avg = P1Rs1/P1N,
- P2Avg = P2Rs1/P2N,
- Ratio = if P2Avg < 1.0 -> P1Avg;
- true -> P1Avg/P2Avg
- end,
- Main ! {self(),{P1Rs1,round(P1Avg),P2Rs1,round(P2Avg),Ratio}},
- flush_loop()
+ %% calculate results and send to main test process
+ P1Avg = P1Rs1/P1N,
+ P2Avg = P2Rs1/P2N,
+ Ratio = if P2Avg < 1.0 -> P1Avg;
+ true -> P1Avg/P2Avg
+ end,
+ Main ! {self(),{P1Rs1,round(P1Avg),P2Rs1,round(P2Avg),Ratio}},
+ flush_loop()
end.
starter({P1,P1N}, {P2,P2N}, Receiver) ->
@@ -366,8 +366,8 @@ p_loop(100, Prio, Receiver) ->
receive after 0 -> ok end,
%% if Receiver gone, we're done
case is_process_alive(Receiver) of
- false -> exit(bye);
- true -> ok
+ false -> exit(bye);
+ true -> ok
end,
%% send report
Receiver ! {self(),Prio},
@@ -375,10 +375,10 @@ p_loop(100, Prio, Receiver) ->
p_loop(N, Prio, Receiver) ->
p_loop(N+1, Prio, Receiver).
-
+
flush_loop() ->
receive _ ->
- ok
+ ok
end,
flush_loop().