line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::Solaris::Memory; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
102357317
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
66
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
83
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
7
|
use English qw(-no_match_vars); |
|
2
|
|
|
|
|
45
|
|
|
2
|
|
|
|
|
25
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
1264
|
use FusionInventory::Agent::Tools; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
234
|
|
9
|
2
|
|
|
2
|
|
769
|
use FusionInventory::Agent::Tools::Solaris; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
533
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub isEnabled { |
12
|
0
|
|
|
0
|
0
|
0
|
my (%params) = @_; |
13
|
0
|
0
|
|
|
|
0
|
return 0 if $params{no_category}->{memory}; |
14
|
0
|
|
|
|
|
0
|
return 1; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub doInventory { |
18
|
0
|
|
|
0
|
0
|
0
|
my (%params) = @_; |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
0
|
my $inventory = $params{inventory}; |
21
|
0
|
|
|
|
|
0
|
my $logger = $params{logger}; |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
0
|
my $memorySize = getFirstMatch( |
24
|
|
|
|
|
|
|
command => '/usr/sbin/prtconf', |
25
|
|
|
|
|
|
|
logger => $logger, |
26
|
|
|
|
|
|
|
pattern => qr/^Memory\ssize:\s+(\S+)/ |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
0
|
my $swapSize = getFirstMatch( |
30
|
|
|
|
|
|
|
command => '/usr/sbin/swap -l', |
31
|
|
|
|
|
|
|
logger => $logger, |
32
|
|
|
|
|
|
|
pattern => qr/\s+(\d+)$/ |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
0
|
$inventory->setHardware({ |
36
|
|
|
|
|
|
|
MEMORY => $memorySize, |
37
|
|
|
|
|
|
|
SWAP => $swapSize |
38
|
|
|
|
|
|
|
}); |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
0
|
my $zone = getZone(); |
41
|
|
|
|
|
|
|
|
42
|
0
|
0
|
|
|
|
0
|
my @memories = $zone eq 'global' ? |
43
|
|
|
|
|
|
|
_getMemoriesPrtdiag() : |
44
|
|
|
|
|
|
|
_getZoneAllocatedMemories($memorySize) ; |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
0
|
foreach my $memory (@memories) { |
47
|
0
|
|
|
|
|
0
|
$inventory->addEntry( |
48
|
|
|
|
|
|
|
section => 'MEMORIES', |
49
|
|
|
|
|
|
|
entry => $memory |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub _getMemoriesPrtdiag { |
55
|
8
|
|
|
8
|
|
2156
|
my $info = getPrtdiagInfos(@_); |
56
|
|
|
|
|
|
|
|
57
|
8
|
50
|
|
|
|
60
|
return $info->{memories} ? @{$info->{memories}} : (); |
|
8
|
|
|
|
|
29
|
|
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub _getZoneAllocatedMemories { |
61
|
0
|
|
|
0
|
|
|
my ($size) = @_; |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
my @memories; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# Just format one virtual memory slot with the detected memory size |
66
|
0
|
|
|
|
|
|
push @memories, { |
67
|
|
|
|
|
|
|
DESCRIPTION => "Allocated memory", |
68
|
|
|
|
|
|
|
CAPTION => "Shared memory", |
69
|
|
|
|
|
|
|
NUMSLOTS => 1, |
70
|
|
|
|
|
|
|
CAPACITY => $size |
71
|
|
|
|
|
|
|
}; |
72
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
return @memories; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
1; |