Search code examples
erlangenvironment-variablessystemintrospection

Obtain a full list of valid system_info atoms


I've guessed a couple of the erlang:system_info/1 variants such as:

10> erlang:system_info(schedulers).
4
11> erlang:system_info(cpu).
** exception error: bad argument
     in function  erlang:system_info/1
        called as erlang:system_info(cpu)

12> erlang:system_info(cpu_arch).
** exception error: bad argument
     in function  erlang:system_info/1
        called as erlang:system_info(cpu_arch)

13> erlang:system_info(memory).
** exception error: bad argument
     in function  erlang:system_info/1
        called as erlang:system_info(memory)

14> erlang:system_info(version).
"5.10.4"

But is there a way, either via introspection, or a global database of some sort, to list all the available system_info arguments ?


Solution

  • Refer to the documentation for erlang:system_info/1. It's listed over several sections with descriptions for what each atom represents. This is the most comprehensive list of supported atoms outside of the Erlang/OTP source itself (and there are a few undocumented parameters).

    There is no language feature which would allow you to list all of the possible atoms.