From d88db21b19fc6a104e7b8a8533892e9c0452337e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20H=C3=B6gberg?= Date: Fri, 29 Nov 2019 14:19:50 +0100 Subject: instrument: Include allocation types in carrier statistics --- lib/tools/test/instrument_SUITE.erl | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'lib/tools/test') diff --git a/lib/tools/test/instrument_SUITE.erl b/lib/tools/test/instrument_SUITE.erl index f474669836..c1a5921e04 100644 --- a/lib/tools/test/instrument_SUITE.erl +++ b/lib/tools/test/instrument_SUITE.erl @@ -194,23 +194,19 @@ verify_carriers_output(#{ histogram_start := HistStart, %% Do the carriers look alright? CarrierSet = ordsets:from_list(AllCarriers), Verified = [C || {AllocType, + InPool, TotalSize, UnscannedSize, - AllocatedSize, - AllocatedCount, - InPool, + Allocations, FreeBlockHist} = C <- CarrierSet, is_atom(AllocType), + is_boolean(InPool), is_integer(TotalSize), TotalSize >= 1, is_integer(UnscannedSize), UnscannedSize < TotalSize, UnscannedSize >= 0, - is_integer(AllocatedSize), AllocatedSize < TotalSize, - AllocatedSize >= 0, - is_integer(AllocatedCount), AllocatedCount =< AllocatedSize, - AllocatedCount >= 0, - is_boolean(InPool), + is_list(Allocations), tuple_size(FreeBlockHist) =:= HistWidth, - carrier_block_check(AllocatedCount, FreeBlockHist)], + carrier_block_check(Allocations, FreeBlockHist)], [] = ordsets:subtract(CarrierSet, Verified), %% Do we have at least as many carriers as we've generated? @@ -229,8 +225,12 @@ verify_carriers_output(#{ histogram_start := HistStart, verify_carriers_output(#{}, {error, not_enabled}) -> ok. -carrier_block_check(AllocCount, FreeHist) -> - %% A carrier must contain at least one block, and th. number of free blocks +carrier_block_check(Allocations, FreeHist) -> + AllocCount = lists:foldl(fun({_Type, Count, _Size}, Acc) -> + Count + Acc + end, 0, Allocations), + + %% A carrier must contain at least one block, and the number of free blocks %% must not exceed the number of allocated blocks + 1. FreeCount = hist_sum(FreeHist), -- cgit v1.2.1