system_info模块

本文介绍了Erlang新增的system_information模块,该模块能够收集详细的系统信息,包括VM启动参数、加载模块路径、系统环境变量等。这些信息对于调试和性能分析非常有用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在看了[url=http://blog.yufeng.info/archives/2799]Erlang新增全面的系统信息收集器-system_information模块[/url]之后,自己下载最新的代码,查看该模块,仔细看了一下

report() -> [
{init_arguments, init:get_arguments()},
{code_paths, code:get_path()},
{code, code()},
{system_info, erlang_system_info()},
{erts_compile_info, erlang:system_info(compile_info)},
{beam_dynamic_libraries, get_dynamic_libraries()},
{environment_erts, os_getenv_erts_specific()},
{environment, [split_env(Env) || Env <- os:getenv()]}
].

[list]
[*]{init_arguments, init:get_arguments()},对应的是vm的启动参数,详细信息参考文档中的erts中的init模块。
[*]{code_paths, code:get_path()},对应的是加载到vm中模块的路径
[*]{code, code()},对应的是加载路径内相应代码的详细信息:
当路径是一个application的路径时,对应的信息是:
{application,
{AppName, [
{description, proplists:get_value(description, Info, [])},
{vsn, proplists:get_value(vsn, Info, [])},
{path, Path},
{modules, [
{Mod, [
{loaded, Loaded},
{native, beam_is_native_compiled(Beam)},
{compiler, get_compiler_version(Beam)},
{md5, hexstring(Md5)}
]}]}]}}

[*]{system_info, erlang_system_info()},对应的是调用erlang:system_info(Ele)获得信息列表,其中Ele组成的列表是:

[
allocator,
check_io,
otp_release,
port_limit,
process_limit,
% procs, % not needed
smp_support,
system_version,
system_architecture,
threads,
thread_pool_size,
{wordsize,internal},
{wordsize,external},
{cpu_topology, defined},
{cpu_topology, detected},
scheduler_bind_type,
scheduler_bindings,
compat_rel,
schedulers_state,
build_type,
logical_processors,
logical_processors_online,
logical_processors_available,
driver_version,
emu_args,
ethread_info,
beam_jump_table,
taints
]

[*]{erts_compile_info, erlang:system_info(compile_info)},对应的信息参考erlang模块
[*]{beam_dynamic_libraries, get_dynamic_libraries()},对应的是:vm依赖的动态库情况
[*]{environment_erts, os_getenv_erts_specific()},对应的是:erts运行的环境变量
[*]{environment, [split_env(Env) || Env <- os:getenv()]},对应的是所有的系统环境变量
[/list]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值