Beta Shell
v2.0 ยท web2.us.cloudlogin.co
[FM]
[CMD]
[PHP]
[DB]
[INFO]
[SEC]
File Manager
~
/
usr
/
share
/
perl5
/
vendor_perl
/
Ocsinventory
/
Agent
/
Backend
/
OS
/
Linux
/
Archs
/
ARM
Upload
4 items
Name
Size
Perms
Modified
Actions
[ .. / .. ]
Bios.pm
1.55 KB
-rw-r--r--
2024-10-28 14:52:47
Edit
Del
CPU.pm
1.52 KB
-rw-r--r--
2024-10-28 14:52:47
Edit
Del
Editing: CPU.pm
(1.52 KB)
Path: /usr/share/perl5/vendor_perl/Ocsinventory/Agent/Backend/OS/Linux/Archs/ARM/CPU.pm
Back
package Ocsinventory::Agent::Backend::OS::Linux::Archs::ARM::CPU; use strict; use warnings; sub check { my $params = shift; my $common = $params->{common}; $common->can_run("lscpu"); $common->can_run("vcgencmd"); } sub run { my $params = shift; my $common = $params->{common}; my @cpuinfos=`LANG=C lscpu 2>/dev/null`; my $cpu; my $nbcpus; my $freq; foreach my $info (@cpuinfos){ chomp $info; $cpu->{CPUARCH}=$1 if ($info =~ /Architecture:\s*(.*)/i); $cpu->{NBCPUS}=$1 if ($info =~ /^CPU\(s\):\s*(\d+)/i); $cpu->{THREADS}=$1 if ($info =~ /Thread\(s\)\sper\score:\s*(\d+)/i); $cpu->{CORES}=$1 if ($info =~ /Core\(s\)\sper\ssocket:\s*(\d+)/i); $cpu->{NBSOCKET}=$1 if ($info =~ /Socket\(s\):\s*(\d+)/i); $cpu->{TYPE}=$1 if ($info =~ /Model\sname:\s*(.*)/i); $cpu->{MANUFACTURER}=$1 if ($info =~ /Vendor ID:\s*(.+)/i); $cpu->{SPEED}=$1 if ($info =~ /CPU max MHZ:\s*(.*)/i); if ($cpu->{CPUARCH} && $cpu->{CPUARCH} =~ /(armv[1-7])/){ $cpu->{DATA_WIDTH}='32'; } else { $cpu->{DATA_WIDTH}='64'; } } # Frequency $cpu->{CURRENT_SPEED}=`vcgencmd get_config arm_freq | cut -d"=" -f 2`; # Total Threads = number of cores x number of threads per core $cpu->{THREADS}=$cpu->{CORES}*$cpu->{THREADS}; # Set LOGICAL_CPUS with THREADS value $cpu->{LOGICAL_CPUS}=$cpu->{THREADS}; for (my $i=0;$i<$cpu->{NBSOCKET};$i++) { $common->addCPU($cpu); } } 1;