X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;f=src%2Fbeam_stats_consumer_csv.erl;h=8380b95f91c0c64f51ac7fda890435654502c500;hb=a3fdbec97580ab23bdb68e61d4321d08b1c599da;hp=c9d27855de4959c54dc88fc8bf509296373c8fd5;hpb=f079a56c67f6d3210dc1e4e876eab915fe299013;p=beam_stats.git diff --git a/src/beam_stats_consumer_csv.erl b/src/beam_stats_consumer_csv.erl index c9d2785..8380b95 100644 --- a/src/beam_stats_consumer_csv.erl +++ b/src/beam_stats_consumer_csv.erl @@ -49,8 +49,7 @@ consume(Q, #state{}=State1) -> -spec terminate(state()) -> {}. terminate(#state{file=FileOpt}) -> - ok = hope_option:iter(FileOpt, fun file:close/1), - {}. + hope_option:iter(FileOpt, fun file:close/1). %% ============================================================================ @@ -101,9 +100,9 @@ beam_stats_to_bin(#beam_stats ) -> <> = timestamp_to_bin(Timestamp), <> = node_id_to_bin(NodeID), - PairToBin = make_pair_to_bin(NodeIDBin, TimestampBin), + MemoryPairToBin = make_pair_to_bin(NodeIDBin, TimestampBin, <<"memory">>), MemoryBinPairs = lists:map(fun atom_int_to_bin_bin/1, Memory), - MemoryBins = lists:map(PairToBin, MemoryBinPairs), + MemoryBins = lists:map(MemoryPairToBin, MemoryBinPairs), AllBins = [ MemoryBins ], @@ -131,14 +130,16 @@ timestamp_to_float({ComponentMega, ComponentWhole, ComponentMicro}) -> TotalMicroSeconds = (TotalWholeSeconds * OneMillion) + ComponentMicro, TotalMicroSeconds / OneMillion. --spec make_pair_to_bin(binary(), binary()) -> +-spec make_pair_to_bin(binary(), binary(), binary()) -> fun(({binary(), binary()}) -> binary()). -make_pair_to_bin(<>, <>) -> +make_pair_to_bin(<>, <>, <>) -> fun ({<>, <>}) -> << TimestampBin/binary , "|" , NodeID/binary , "|" + , Type/binary + , "|" , K/binary , "|" , V/binary