anchor.diff:                  "~p", [Mem div 1024 div 1024 div 1024]))
               ++ "GB"
       end.
  +
  +readable_pid_name(Pid) ->
  +    Name = case pid_groups:group_and_name_of(Pid) of
  +               failed ->
  +                   try element(2, process_info(Pid, registered_name))
  +                   catch _Level:_Reason ->
  +                           try_process_info(Pid, initial_call, dead_pid)
  +                   end;
  +               N -> element(2, N)
  +           end,
  +    case is_list(Name) of
  +        false -> io_lib:write(Name);
  +        true -> Name
  +    end.
  +
  +readable_grp_and_pid_name(Pid) ->
  +    case pid_groups:group_and_name_of(Pid) of
  +        failed ->
  +            try element(2, process_info(Pid, registered_name))
  +            catch _Level:_Reason ->
  +                    try_process_info(Pid, initial_call, dead_pid)
  +            end;
  +        N -> N
  +    end.
  +
  +try_process_info(Pid, Types) ->
  +    try erlang:process_info(Pid, Types)
  +    catch _:_ -> []
  +    end.
  +
  +try_process_info(Pid, Type, DefaultVal) ->
  +    try element(2, erlang:process_info(Pid, Type))
  +    catch _:_ -> DefaultVal
  +    end.
  +
  +process_info_get(undefined, _Type, DefaultVal) ->
  +    DefaultVal;
  +process_info_get(PropList, Type, DefaultVal) ->
  +    case lists:keyfind(Type, 1, PropList) of
  +        false -> DefaultVal;
  +        X -> element(2, X)
  +    end.
  
positive.code:                   pdb:set(V1, TableName)
            end
        end || {P, NewVals} <- T, is_pid(P), undefined =/= NewVals],
      comm:send_local_after(1, self(), {start_mon}),
      inc_counter(State);
  on({start_mon}, State) -> State;
  
  on({output_data}, State) when element(3, State) ->
      TableName = table(State),
      %%Now = os:timestamp(),
      %%Delay = timer:now_diff(Now, timestamp(State)) / 1000000,
      Count = counter(State),
      ProcsMem = erlang:memory(processes),
      ProcsMemUsed = erlang:memory(processes_used),
  
negative.code: -export([top/0]).
  
  -type state() :: { pdb:tableid(),
                     false | all | pid, %% sampling: no, all or a single pid
                     false | all | pid, %% output: no, all, or a single pid
                     erlang_timestamp(), %% last output
                     non_neg_integer(), %% # of measures
                     non_neg_integer(), %% sort by
                     no_exclude | pid()
                   }.
  
  -spec start_link(list()) -> {ok, pid()}.
  start_link(Group) ->
      gen_component:start_link(?MODULE, fun ?MODULE:on/2, [],
                               [{erlang_register, ?MODULE},
                                {pid_groups_join_as, Group, ?MODULE}]).
  
  -spec init([]) -> state().
  init([]) ->
  