line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::BSD::MIPS; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
81116722
|
use strict; |
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
72
|
|
4
|
1
|
|
|
1
|
|
11
|
use warnings; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
71
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
12
|
use Config; |
|
1
|
|
|
|
|
22
|
|
|
1
|
|
|
|
|
73
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
383
|
use FusionInventory::Agent::Tools; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
304
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub isEnabled { |
11
|
0
|
|
|
0
|
0
|
|
return $Config{archname} =~ /^mips/; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub doInventory { |
15
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
16
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
my $inventory = $params{inventory}; |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
my $bios = { |
20
|
|
|
|
|
|
|
SMANUFACTURER => 'SGI', |
21
|
|
|
|
|
|
|
}; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# sysctl infos |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# example on NetBSD: SGI-IP22 |
26
|
|
|
|
|
|
|
# example on OpenBSD: SGI-O2 (IP32) |
27
|
0
|
|
|
|
|
|
$bios->{SMODEL} = getFirstLine(command => 'sysctl -n hw.model'); |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
my $count = getFirstLine(command => 'sysctl -n hw.ncpu'); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# dmesg infos |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# I) Indy |
34
|
|
|
|
|
|
|
# NetBSD: |
35
|
|
|
|
|
|
|
# mainbus0 (root): SGI-IP22 [SGI, 6906e152], 1 processor |
36
|
|
|
|
|
|
|
# cpu0 at mainbus0: MIPS R4400 CPU (0x450) Rev. 5.0 with MIPS R4010 FPC Rev. 0.0 |
37
|
|
|
|
|
|
|
# int0 at mainbus0 addr 0x1fbd9880: bus 75MHz, CPU 150MHz |
38
|
|
|
|
|
|
|
# |
39
|
|
|
|
|
|
|
# II) O2 |
40
|
|
|
|
|
|
|
# NetBSD: |
41
|
|
|
|
|
|
|
# mainbus0 (root): SGI-IP32 [SGI, 8], 1 processor |
42
|
|
|
|
|
|
|
# cpu0 at mainbus0: MIPS R5000 CPU (0x2321) Rev. 2.1 with built-in FPU Rev. 1.0 |
43
|
|
|
|
|
|
|
# OpenBSD: |
44
|
|
|
|
|
|
|
# mainbus0 (root) |
45
|
|
|
|
|
|
|
# cpu0 at mainbus0: MIPS R5000 CPU rev 2.1 180 MHz with R5000 based FPC rev 1.0 |
46
|
|
|
|
|
|
|
# cpu0: cache L1-I 32KB D 32KB 2 way, L2 512KB direct |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
my $cpu; |
49
|
0
|
|
|
|
|
|
foreach my $line (getAllLines(command => 'dmesg')) { |
50
|
0
|
0
|
|
|
|
|
if ($line =~ /$bios->{SMODEL}\s*\[\S*\s*(\S*)\]/) { $bios->{SSN} = $1; } |
|
0
|
|
|
|
|
|
|
51
|
0
|
0
|
|
|
|
|
if ($line =~ /cpu0 at mainbus0:\s*(.*)$/) { $cpu->{NAME} = $1; } |
|
0
|
|
|
|
|
|
|
52
|
0
|
0
|
|
|
|
|
if ($line =~ /CPU\s*.*\D(\d+)\s*MHz/) { $cpu->{SPEED} = $1; } |
|
0
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
$inventory->setBios($bios); |
56
|
|
|
|
|
|
|
|
57
|
0
|
0
|
|
|
|
|
return if $params{no_category}->{cpu}; |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
while ($count--) { |
60
|
0
|
|
|
|
|
|
$inventory->addEntry( |
61
|
|
|
|
|
|
|
section => 'CPUS', |
62
|
|
|
|
|
|
|
entry => $cpu |
63
|
|
|
|
|
|
|
); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |