@@ -168,18 +168,16 @@ unpack_global(Bin) ->
168168 CGroupMem = {maps :get (memory_max , CgroupsInfo , 0 ),
169169 maps :get (memory_current , CgroupsInfo , 0 )},
170170 {MemLimit , _ } = memory_quota :choose_limit (MemTotal , MemUsed , CGroupMem ),
171+ % % Suppressing dialyzer warning here
172+ % % Dialyzer thinks that system_info can't return 'unknown', while according
173+ % % to doc it seems like it actually can. So, in order to avoid a warning
174+ % % the value is compared with 0 insead of explicit match to 'unknown'
175+ HostCoresAvailable = case erlang :system_info (logical_processors ) of
176+ P when is_number (P ), P > 0 -> P ;
177+ _ -> 0
178+ end ,
171179 CoresAvailable = case maps :get (num_cpu_prc , CgroupsInfo , undefined ) of
172- undefined ->
173- % % Suppressing dialyzer warning here
174- % % Dialyzer thinks that system_info can't return
175- % % 'unknown', while according to doc it seems like
176- % % it actually can. So, in order to avoid a warning
177- % % the value is compared with 0 insead of explicit
178- % % match to 'unknown'
179- case erlang :system_info (logical_processors ) of
180- N when is_number (N ), N > 0 -> N ;
181- _ -> 0
182- end ;
180+ undefined -> HostCoresAvailable ;
183181 N -> N / 100 % % do not round it,
184182 % % cpu utilization will break
185183 end ,
@@ -193,6 +191,7 @@ unpack_global(Bin) ->
193191
194192 Gauges =
195193 [{cpu_cores_available , CoresAvailable },
194+ {cpu_host_cores_available , HostCoresAvailable },
196195 {swap_total , SwapTotal },
197196 {swap_used , SwapUsed },
198197 {mem_limit , MemLimit },
0 commit comments