From bcf62deb7b8534b00ce69c977466a009252ee8a5 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Wed, 13 Jan 2010 11:35:13 +0000 Subject: OTP-8240 Improved GC performance after BIF/NIF call when a lot of heap fragments was created. This will mainly benefit NIFs that return large compound terms. --- erts/emulator/test/statistics_SUITE.erl | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'erts/emulator/test/statistics_SUITE.erl') diff --git a/erts/emulator/test/statistics_SUITE.erl b/erts/emulator/test/statistics_SUITE.erl index bc12821887..9e1732a445 100644 --- a/erts/emulator/test/statistics_SUITE.erl +++ b/erts/emulator/test/statistics_SUITE.erl @@ -1,19 +1,19 @@ %% %% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. -%% +%% +%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved online at http://www.erlang.org/. -%% +%% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. -%% +%% %% %CopyrightEnd% %% @@ -212,17 +212,18 @@ reductions(Config) when is_list(Config) -> %% 300 * 4 is more than CONTEXT_REDS (1000). Thus, there will be one or %% more context switches. - reductions(300, Reductions). + Mask = (1 bsl erlang:system_info(wordsize)*8) - 1, + reductions(300, Reductions, Mask). -reductions(N, Previous) when N > 0 -> +reductions(N, Previous, Mask) when N > 0 -> ?line {Reductions, Diff} = statistics(reductions), ?line build_some_garbage(), ?line if Reductions > 0 -> ok end, ?line if Diff >= 0 -> ok end, io:format("Previous = ~p, Reductions = ~p, Diff = ~p, DiffShouldBe = ~p", - [Previous, Reductions, Diff, Reductions-Previous]), - ?line if Reductions == Previous+Diff -> reductions(N-1, Reductions) end; -reductions(0, _) -> + [Previous, Reductions, Diff, (Reductions-Previous) band Mask]), + ?line if Reductions == ((Previous+Diff) band Mask) -> reductions(N-1, Reductions, Mask) end; +reductions(0, _, _) -> ok. build_some_garbage() -> -- cgit v1.2.3