Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
7701-snmp-test-Tweaked-darwin-analyzis.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 7701-snmp-test-Tweaked-darwin-analyzis.patch of Package erlang
From efeea796511a7944b9eeeb7ad6563b7de9bf565f Mon Sep 17 00:00:00 2001 From: Micael Karlberg <bmk@erlang.org> Date: Wed, 16 Nov 2022 10:04:43 +0100 Subject: [PATCH 1/3] [snmp|test] Tweaked darwin analyzis --- lib/snmp/test/snmp_test_lib.erl | 48 ++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/lib/snmp/test/snmp_test_lib.erl b/lib/snmp/test/snmp_test_lib.erl index aa7ea89c97..9f742c91c5 100644 --- a/lib/snmp/test/snmp_test_lib.erl +++ b/lib/snmp/test/snmp_test_lib.erl @@ -2264,27 +2264,24 @@ analyze_and_print_darwin_host_info(Version) -> HwInfo = analyze_darwin_hardware_info(), ModelName = analyze_darwin_hw_model_name(HwInfo), ModelId = analyze_darwin_hw_model_identifier(HwInfo), - ProcName = analyze_darwin_hw_processor_name(HwInfo), - ProcSpeed = analyze_darwin_hw_processor_speed(HwInfo), - NumProc = analyze_darwin_hw_number_of_processors(HwInfo), - NumCores = analyze_darwin_hw_total_number_of_cores(HwInfo), + %% ProcName = analyze_darwin_hw_processor_name(HwInfo), + %% ProcSpeed = analyze_darwin_hw_processor_speed(HwInfo), + %% NumProc = analyze_darwin_hw_number_of_processors(HwInfo), + %% NumCores = analyze_darwin_hw_total_number_of_cores(HwInfo), + {Processor, CPUFactor} = analyze_darwin_hw_processor(HwInfo), Memory = analyze_darwin_hw_memory(HwInfo), io:format("Darwin:" "~n System Version: ~s" "~n Kernel Version: ~s" "~n Model: ~s (~s)" - "~n Processor: ~s (~s, ~s, ~s)" + "~n Processor: ~s" "~n Memory: ~s" "~n Num Online Schedulers: ~s" "~n", [SystemVersion, KernelVersion, ModelName, ModelId, - ProcName, ProcSpeed, NumProc, NumCores, + Processor, Memory, str_num_schedulers()]), - CPUFactor = analyze_darwin_cpu_to_factor(ProcName, - ProcSpeed, - NumProc, - NumCores), MemFactor = analyze_darwin_memory_to_factor(Memory), if (MemFactor =:= 1) -> {CPUFactor, []}; @@ -2308,6 +2305,31 @@ analyze_darwin_hw_model_name(HwInfo) -> analyze_darwin_hw_model_identifier(HwInfo) -> proplists:get_value("model identifier", HwInfo, "-"). +analyze_darwin_hw_processor(HwInfo) -> + case analyze_darwin_hw_processor_name(HwInfo) of + "-" -> % Maybe Apple Chip + case analyze_darwin_hw_chip(HwInfo) of + "-" -> + "-"; + Chip -> + NumCores = analyze_darwin_hw_total_number_of_cores(HwInfo), + CPUFactor = analyze_darwin_cpu_to_factor(Chip, NumCores), + {f("~s [~s]", [Chip, NumCores]), CPUFactor} + end; + ProcName -> + ProcSpeed = analyze_darwin_hw_processor_speed(HwInfo), + NumProc = analyze_darwin_hw_number_of_processors(HwInfo), + NumCores = analyze_darwin_hw_total_number_of_cores(HwInfo), + CPUFactor = analyze_darwin_cpu_to_factor(ProcName, + ProcSpeed, + NumProc, + NumCores), + {f("~s [~s, ~s, ~s]", [ProcName, ProcSpeed, NumProc, NumCores]), CPUFactor} + end. + +analyze_darwin_hw_chip(HwInfo) -> + proplists:get_value("chip", HwInfo, "-"). + analyze_darwin_hw_processor_name(HwInfo) -> proplists:get_value("processor name", HwInfo, "-"). @@ -2392,6 +2414,12 @@ analyze_darwin_memory_to_factor(Mem) -> end. +analyze_darwin_cpu_to_factor("Apple" ++ _ = _Chip, _NumCores) -> + 1; +analyze_darwin_cpu_to_factor(_Chip, _NumCores) -> + 8. + + %% The speed is a string: "<speed> <unit>" %% the speed may be a float, which we transforms into an integer of MHz. %% To calculate a factor based on processor speed, number of procs -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor