|
|
@ -76,21 +76,21 @@ flush(State) -> |
|
|
|
|
|
|
|
flushMostActiveSenders(State = #state{senders = Senders}) -> |
|
|
|
List = lists:sublist(lists:reverse(lists:keysort(2, maps:to_list(Senders))), 1, 100), |
|
|
|
formatByCnt(<<"They sent the most messages">>, List, State). |
|
|
|
formatByCnt(<<"The send the most messages">>, List, State). |
|
|
|
|
|
|
|
flushMostActiveReceivers(State = #state{receivers = Receivers}) -> |
|
|
|
List = lists:sublist(lists:reverse(lists:keysort(2, maps:to_list(Receivers))), 1, 100), |
|
|
|
formatByCnt(<<"They received the most messages">>, List, State). |
|
|
|
formatByCnt(<<"The received the most messages">>, List, State). |
|
|
|
|
|
|
|
flush_most_non_existing(State = #state{nonExisting = NonExisting}) -> |
|
|
|
List = lists:sublist(lists:reverse(lists:keysort(2, maps:to_list(NonExisting))), 1, 100), |
|
|
|
formatByCnt(<<"They sent the most messages to dead processes">>, List, State). |
|
|
|
formatByCnt(<<"The send the most messages to dead processes">>, List, State). |
|
|
|
|
|
|
|
formatByCnt(Title, List, State) -> |
|
|
|
MsgCols = case io:columns() of {ok, Cols} -> Cols;_ -> 80 end, |
|
|
|
io:format( |
|
|
|
"~n~s~n~s~n~n" |
|
|
|
"Process ID Count (Label) OR Message sent~n" |
|
|
|
"Process ID Count (Label) OR Message send~n" |
|
|
|
"---------- ----- -----------------------~n", |
|
|
|
[Title, lists:duplicate(byte_size(Title), $=)] |
|
|
|
), |
|
|
@ -112,11 +112,11 @@ labelOrMsg(P, #state{meta = Meta, lastMsgs = LastMsgs}) -> |
|
|
|
|
|
|
|
flushMostActivePairUnidirectional(State = #state{pairs = Pairs}) -> |
|
|
|
List = lists:sublist(lists:reverse(lists:keysort(2, maps:to_list(Pairs))), 1, 100), |
|
|
|
Title = <<"They sent the most messages to one other process">>, |
|
|
|
Title = <<"The send the most messages to one other process">>, |
|
|
|
MsgCols = case io:columns() of {ok, Cols} -> Cols; _ -> 80 end, |
|
|
|
io:format( |
|
|
|
"~n~s~n~s~n~n" |
|
|
|
"From pid To pid Count (Label) OR Message sent~n" |
|
|
|
"From pid To pid Count (Label) OR Message send~n" |
|
|
|
"-------- ------ ----- -----------------------~n", |
|
|
|
[Title, lists:duplicate(byte_size(Title), $=)] |
|
|
|
), |
|
|
@ -131,22 +131,20 @@ flushMostActivePairUnidirectional(State = #state{pairs = Pairs}) -> |
|
|
|
flushMostActivePairBidirectional(State = #state{pairs = Pairs}) -> |
|
|
|
TemPairs = maps:fold(fun mergePairs/3, #{}, Pairs), |
|
|
|
List = lists:sublist(lists:reverse(lists:keysort(2, maps:to_list(TemPairs))), 1, 100), |
|
|
|
Title = <<"They sent the most messages to each other">>, |
|
|
|
Title = <<"The send the most messages to each other">>, |
|
|
|
MsgCols = case io:columns() of {ok, Cols} -> Cols;_ -> 80 end, |
|
|
|
io:format( |
|
|
|
"~n~s~n~s~n~n" |
|
|
|
"Count Pid 1 (Label) OR Message sent~n" |
|
|
|
" Pid 2 by the corresponding process~n" |
|
|
|
"----- ----- ----------------------------~n", |
|
|
|
"Count Pid 1 <<===>> Pid 2 (Label) OR Message send by the corresponding process~n" |
|
|
|
"----- ------------------- ------------------------ ----------------------------~n", |
|
|
|
[Title, lists:duplicate(byte_size(Title), $=)] |
|
|
|
), |
|
|
|
[ |
|
|
|
begin |
|
|
|
{FPrefix, FLabel, FSuffix} = labelOrMsg(F, State), |
|
|
|
{TPrefix, TLabel, TSuffix} = labelOrMsg(T, State), |
|
|
|
io:format( |
|
|
|
"~-10b ~-15w ~s~" ++ integer_to_list(MsgCols) ++ "P~s~n" |
|
|
|
" ~-15w ~s~" ++ integer_to_list(MsgCols) ++ "P~s~n", [C, F, FPrefix, FLabel, 5, FSuffix, T, TPrefix, TLabel, 5, TSuffix]) |
|
|
|
io:format("~-10b ~w~s <<===>> ~-15w~-10s~" ++ integer_to_list(MsgCols) ++ "P~s ~" ++ integer_to_list(MsgCols) ++ "P~s~n", |
|
|
|
[C, F, FPrefix, T, TPrefix, FLabel, 20, FSuffix, TLabel, 20, TSuffix]) |
|
|
|
end || {{F, T}, C} <- List |
|
|
|
], |
|
|
|
ok. |
|
|
|