From cf20035dc7a4fbab47ce17b99b674e4db5eb7a07 Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson Date: Thu, 14 Nov 2013 15:34:55 +0100 Subject: observer: Fix memory and scheduler info and handle missing fields Fix app viewer crash --- lib/runtime_tools/src/observer_backend.erl | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'lib/runtime_tools') diff --git a/lib/runtime_tools/src/observer_backend.erl b/lib/runtime_tools/src/observer_backend.erl index 202129c61a..68ef04f20c 100644 --- a/lib/runtime_tools/src/observer_backend.erl +++ b/lib/runtime_tools/src/observer_backend.erl @@ -53,6 +53,13 @@ sys_info() -> Mem -> Mem catch _:_ -> [] end, + + SchedulersOnline = erlang:system_info(schedulers_online), + SchedulersAvailable = case erlang:system_info(multi_scheduling) of + enabled -> SchedulersOnline; + _ -> 1 + end, + {{_,Input},{_,Output}} = erlang:statistics(io), [{process_count, erlang:system_info(process_count)}, {process_limit, erlang:system_info(process_limit)}, @@ -60,9 +67,13 @@ sys_info() -> {run_queue, erlang:statistics(run_queue)}, {io_input, Input}, {io_output, Output}, + {logical_processors, erlang:system_info(logical_processors)}, - {logical_processors_available, erlang:system_info(logical_processors_available)}, {logical_processors_online, erlang:system_info(logical_processors_online)}, + {logical_processors_available, erlang:system_info(logical_processors_available)}, + {schedulers, erlang:system_info(schedulers)}, + {schedulers_online, SchedulersOnline}, + {schedulers_available, SchedulersAvailable}, {otp_release, erlang:system_info(otp_release)}, {version, erlang:system_info(version)}, @@ -221,7 +232,7 @@ fetch_stats_loop(Parent, Time) -> _M = Parent ! {stats, 1, erlang:statistics(scheduler_wall_time), erlang:statistics(io), - erlang:memory()}, + try erlang:memory() catch _:_ -> [] end}, fetch_stats_loop(Parent, Time) end. %% -- cgit v1.2.3