"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/Ocsinventory/Agent/Backend/OS/MacOS/CPU.pm" between
Ocsinventory-Unix-Agent-2.6.1.tar.gz and Ocsinventory-Unix-Agent-2.8.0.tar.gz

About: Ocsinventory-Agent is a Linux agent for OCS Inventory NG.

CPU.pm  (Ocsinventory-Unix-Agent-2.6.1):CPU.pm  (Ocsinventory-Unix-Agent-2.8.0)
skipping to change at line 19 skipping to change at line 19
return 1; return 1;
} }
sub run { sub run {
my $params = shift; my $params = shift;
my $common = $params->{common}; my $common = $params->{common};
my $processors; my $processors;
my $arch; my $arch;
my $datawidth; my $datawidth;
$processors->{1}->{MANUFACTURER} = `sysctl -n machdep.cpu.vendor`;
$processors->{1}->{TYPE} = `sysctl -n machdep.cpu.brand_string`;
$processors->{1}->{SPEED} = `sysctl -n hw.cpufrequency` / 1000 / 1000;
$processors->{1}->{L2CACHESIZE} = `sysctl -n hw.l2cachesize` / 1024;
$processors->{1}->{CORES} = `sysctl -n machdep.cpu.core_count`;
$processors->{1}->{LOGICAL_CPUS} = `sysctl -n machdep.cpu.thread_count`;
# 32 or 64 bits arch? # 32 or 64 bits arch?
my $sysctl_arch = `sysctl -n hw.cpu64bit_capable`; my $sysctl_arch = `sysctl -n hw.cpu64bit_capable`;
if ($sysctl_arch == 1){ if ($sysctl_arch == 1){
$arch = "x86_64"; $arch = "x86_64";
$datawidth = 64; $datawidth = 64;
} else { } else {
$arch = "x86"; $arch = "x86";
$datawidth = 32; $datawidth = 32;
} }
$processors->{1}->{CPUARCH} = $arch;
$processors->{1}->{DATA_WIDTH} = $datawidth;
# copy cpu infos to other packages # How much processor socket ?
my $ncpu=`sysctl -n hw.packages`; my $ncpu=`sysctl -n hw.packages`;
foreach my $cpu (2..$ncpu) {
$processors->{$cpu}->{MANUFACTURER} = $processors->{1}->{MANUFACTURER}; # For each processor socket
$processors->{$cpu}->{TYPE} = $processors->{1}->{TYPE}; foreach my $cpu (1..$ncpu) {
$processors->{$cpu}->{SPEED} = $processors->{1}->{SPEED}; $processors->{$cpu}->{MANUFACTURER} = `sysctl -n machdep.cpu.vendor`;
$processors->{$cpu}->{L2CACHESIZE} = $processors->{1}->{L2CACHESIZE}; if ($processors->{$cpu}->{MANUFACTURER} =~ /(Authentic|Genuine|)(.+)/i)
$processors->{$cpu}->{CORES} = $processors->{1}->{CORES}; {
$processors->{$cpu}->{LOGICAL_CPUS} = $processors->{1}->{LOGICAL_CPUS}; $processors->{$cpu}->{MANUFACTURER} = $2;
$processors->{$cpu}->{CPUARCH} = $processors->{1}->{CPUARCH}; }
$processors->{$cpu}->{DATA_WIDTH} = $processors->{1}->{DATA_WIDTH}; chomp($processors->{$cpu}->{MANUFACTURER} );
$processors->{$cpu}->{TYPE} = `sysctl -n machdep.cpu.brand_string`;
chomp($processors->{$cpu}->{TYPE} );
$processors->{$cpu}->{SPEED} = `sysctl -n hw.cpufrequency` / 1000 / 1000
;
$processors->{$cpu}->{L2CACHESIZE} = `sysctl -n hw.l2cachesize` / 1024;
$processors->{$cpu}->{CORES} = `sysctl -n machdep.cpu.core_count`;
chomp($processors->{$cpu}->{CORES});
$processors->{$cpu}->{THREADS} = `sysctl -n machdep.cpu.thread_count`;
chomp($processors->{$cpu}->{THREADS});
$processors->{$cpu}->{LOGICAL_CPUS} = `sysctl -n machdep.cpu.logical_per
_package`;
chomp($processors->{$cpu}->{LOGICAL_CPUS});
$processors->{$cpu}->{CPUARCH} = $arch;
$processors->{$cpu}->{DATA_WIDTH} = $datawidth;
$processors->{$cpu}->{NBSOCKET} = $cpu;
chomp($processors->{$cpu}->{NBSOCKET});
$processors->{$cpu}->{SERIALNUMBER} = "N/A";
} }
# Add new cpu infos to inventory # Add new cpu infos to inventory
foreach (keys %{$processors}){ foreach (keys %{$processors}){
$common->addCPU($processors->{$_}); $common->addCPU($processors->{$_});
} }
} }
1; 1;
 End of changes. 4 change blocks. 
19 lines changed or deleted 27 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)