[erlang-questions] process_info/1 and process_info/2

Edwin Fine erlang-questions_efine@REDACTED
Thu May 15 09:58:34 CEST 2008


Hi all,

I don't know if my first post just didn't make it, or got ignored because I
inadvertently offended someone, or perhaps it asked too boring a question. I
am trying again in the hope that it just got missed.

What I need to do is find out, at run time, which info items (e.g.
heap_size) process_info/2 supports. This is so I don't have to go changing
code every time an item is added (or removed, which seems unlikely). What I
have done is use the process_info/1 BIF (which I know is for debugging only)
to get a list of supported info items, something like this:

5> [K || {K,_} <- process_info(pid(0,0,0))].
[registered_name,current_function,initial_call,status,
 message_queue_len,messages,links,dictionary,trap_exit,
 error_handler,priority,group_leader,total_heap_size,
 heap_size,stack_size,reductions,garbage_collection,
 suspending]

Short of hard-coding the names of all the info items, or scanning the
documentation at run-time, is there any "legal" way to do what I want to do
other than what I have described?

Regards,
Edwin Fine
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080515/9ff213fc/attachment.htm>


More information about the erlang-questions mailing list