line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Sys::Info::Driver::Unknown::Device::CPU::Env; |
2
|
|
|
|
|
|
|
$Sys::Info::Driver::Unknown::Device::CPU::Env::VERSION = '0.79'; |
3
|
1
|
|
|
1
|
|
9
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
66
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
6
|
use constant RE_VENDOR => qr/(.+?), \s (?:Genuine(Intel)|Authentic(AMD))/xms; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1097
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
my(%INTEL, %AMD, %OTHER_ID, %OTHER, %CPU, $INSTALLED); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub identify { |
11
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
12
|
|
|
|
|
|
|
|
13
|
1
|
50
|
|
|
|
3
|
if ( ! $self->{META_DATA} ) { |
14
|
1
|
50
|
|
|
|
8
|
$self->_INSTALL() if ! $INSTALLED; |
15
|
|
|
|
|
|
|
|
16
|
1
|
50
|
|
|
|
3
|
if ( ! $CPU{id} ) { |
17
|
1
|
|
|
|
|
3
|
$self->{META_DATA} = []; # fake |
18
|
1
|
|
|
|
|
5
|
return; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
0
|
my($cpu, $count, @cpu); |
22
|
0
|
0
|
|
|
|
0
|
if ($CPU{id} =~ RE_VENDOR ) { |
23
|
0
|
|
|
|
|
0
|
my $cid = $1; |
24
|
0
|
|
0
|
|
|
0
|
my $corp = $2 || $3; |
25
|
0
|
0
|
|
|
|
0
|
if ( my %info = $self->_parse( $cid ) ) { |
26
|
0
|
0
|
|
|
|
0
|
if ( my $mn = $self->_corp( $corp, $info{Family} ) ) { |
27
|
0
|
0
|
|
|
|
0
|
if ( my $name = $mn->{ $info{Model} } ) { |
28
|
0
|
0
|
0
|
|
|
0
|
$count = ($CPU{number} && $CPU{number} > 1) ? $CPU{number} : q{}; |
29
|
0
|
|
|
|
|
0
|
$cpu = "$corp $name"; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
0
|
foreach my $other (keys %OTHER_ID) { |
36
|
0
|
0
|
|
|
|
0
|
if ($CPU{id} =~ / \Q$other\E /xms) { |
37
|
0
|
|
|
|
|
0
|
$cpu = $OTHER_ID{$other}; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
0
|
0
|
|
|
|
0
|
$count = 1 if !$count; |
42
|
0
|
|
|
|
|
0
|
for ( 1..$count ) { |
43
|
|
|
|
|
|
|
push @cpu, { |
44
|
0
|
|
|
|
|
0
|
architecture => ($CPU{id} =~ m{ \A (.+?) \s? Family }xmsi), |
45
|
|
|
|
|
|
|
data_width => undef, |
46
|
|
|
|
|
|
|
speed => undef, |
47
|
|
|
|
|
|
|
bus_speed => undef, |
48
|
|
|
|
|
|
|
address_width => undef, |
49
|
|
|
|
|
|
|
name => $cpu, |
50
|
|
|
|
|
|
|
}; |
51
|
|
|
|
|
|
|
} |
52
|
0
|
|
|
|
|
0
|
$self->{META_DATA} = [@cpu]; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
0
|
return $self->_serve_from_cache(wantarray); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# ------------------------[ P R I V A T E ]------------------------ # |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub _INSTALL { |
61
|
1
|
|
|
1
|
|
2
|
my $self = shift; |
62
|
1
|
|
|
|
|
2
|
%INTEL = _INTEL(); |
63
|
1
|
|
|
|
|
3
|
%AMD = _AMD(); |
64
|
1
|
|
|
|
|
3
|
%OTHER_ID = _OTHER_ID(); |
65
|
1
|
|
|
|
|
4
|
%OTHER = _OTHER(); |
66
|
|
|
|
|
|
|
%CPU = ( # PIV 3.0 GHz HT |
67
|
|
|
|
|
|
|
id => $ENV{PROCESSOR_IDENTIFIER}, # x86 Family 15 Model 3 Stepping 3, GenuineIntel |
68
|
|
|
|
|
|
|
number => $ENV{NUMBER_OF_PROCESSORS}, # 2 |
69
|
|
|
|
|
|
|
arch => $ENV{PROCESSOR_ARCHITECTURE}, # x86 |
70
|
|
|
|
|
|
|
rev => $ENV{PROCESSOR_REVISION}, # 0303 |
71
|
|
|
|
|
|
|
level => $ENV{PROCESSOR_LEVEL}, # 15 |
72
|
1
|
|
|
|
|
7
|
); |
73
|
|
|
|
|
|
|
|
74
|
1
|
50
|
33
|
|
|
16
|
if ( ! $CPU{id} && $self->can('__env_pi') ) { |
75
|
0
|
|
|
|
|
0
|
$CPU{id} = $self->__env_pi; |
76
|
|
|
|
|
|
|
} |
77
|
1
|
|
|
|
|
2
|
$INSTALLED = 1; |
78
|
1
|
|
|
|
|
3
|
return; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub _corp { |
82
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
83
|
0
|
|
|
|
|
0
|
my $corp = shift; |
84
|
0
|
|
|
|
|
0
|
my $family = shift; |
85
|
|
|
|
|
|
|
return $corp eq 'Intel' ? $INTEL{$family} |
86
|
0
|
0
|
|
|
|
0
|
: $corp eq 'AMD' ? $AMD{$family} |
|
|
0
|
|
|
|
|
|
87
|
|
|
|
|
|
|
: undef; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub _parse { |
91
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
92
|
0
|
|
|
|
|
0
|
my $id = shift; |
93
|
0
|
|
|
|
|
0
|
my $arch = $CPU{arch}; |
94
|
0
|
0
|
|
|
|
0
|
if ($id =~ /$arch\s(.+?) \z/xms) { |
95
|
0
|
|
|
|
|
0
|
my %h = split /\s+/xms, $1; # Family Model Stepping |
96
|
0
|
|
|
|
|
0
|
for my $k (keys %h) { |
97
|
0
|
0
|
|
|
|
0
|
$h{$k} = q{} unless defined $h{$k}; |
98
|
|
|
|
|
|
|
} |
99
|
0
|
|
|
|
|
0
|
return %h; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub _INTEL { |
104
|
|
|
|
|
|
|
# Family Model Name |
105
|
|
|
|
|
|
|
return |
106
|
1
|
|
|
1
|
|
16
|
'4' => { |
107
|
|
|
|
|
|
|
'0' => '486 DX-25/33', |
108
|
|
|
|
|
|
|
'1' => '486 DX-50', |
109
|
|
|
|
|
|
|
'2' => '486 SX', |
110
|
|
|
|
|
|
|
'3' => '486 DX/2', |
111
|
|
|
|
|
|
|
'4' => '486 SL', |
112
|
|
|
|
|
|
|
'5' => '486 SX/2', |
113
|
|
|
|
|
|
|
'7' => '486 DX/2-WB', |
114
|
|
|
|
|
|
|
'8' => '486 DX/4', |
115
|
|
|
|
|
|
|
'9' => '486 DX/4-WB', |
116
|
|
|
|
|
|
|
}, |
117
|
|
|
|
|
|
|
'5' => { |
118
|
|
|
|
|
|
|
'0' => 'Pentium 60/66 A-step', |
119
|
|
|
|
|
|
|
'1' => 'Pentium 60/66', |
120
|
|
|
|
|
|
|
'2' => 'Pentium 75 - 200', |
121
|
|
|
|
|
|
|
'3' => 'OverDrive PODP5V83', |
122
|
|
|
|
|
|
|
'4' => 'Pentium MMX', |
123
|
|
|
|
|
|
|
'7' => 'Mobile Pentium 75 - 200', |
124
|
|
|
|
|
|
|
'8' => 'Mobile Pentium MMX', |
125
|
|
|
|
|
|
|
}, |
126
|
|
|
|
|
|
|
'6' => { |
127
|
|
|
|
|
|
|
'0' => 'Pentium Pro A-step', |
128
|
|
|
|
|
|
|
'1' => 'Pentium Pro', |
129
|
|
|
|
|
|
|
'3' => 'Pentium II (Klamath)', |
130
|
|
|
|
|
|
|
'5' => 'Pentium II (Deschutes), Celeron (Covington), Mobile Pentium II (Dixon)', |
131
|
|
|
|
|
|
|
'6' => 'Mobile Pentium II, Celeron (Mendocino)', |
132
|
|
|
|
|
|
|
'7' => 'Pentium III (Katmai)', |
133
|
|
|
|
|
|
|
'8' => 'Pentium III (Coppermine)', |
134
|
|
|
|
|
|
|
'9' => 'Mobile Pentium III', |
135
|
|
|
|
|
|
|
'10' => 'Pentium III (0.18 µm)', |
136
|
|
|
|
|
|
|
'11' => 'Pentium III (0.13 µm)', |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
'13' => 'Celeron M', # ??? |
139
|
|
|
|
|
|
|
'15' => 'Core 2 Duo (Merom)', # ??? |
140
|
|
|
|
|
|
|
}, |
141
|
|
|
|
|
|
|
'7' => { |
142
|
|
|
|
|
|
|
'0' => 'Itanium (IA-64)', |
143
|
|
|
|
|
|
|
}, |
144
|
|
|
|
|
|
|
'15' => { |
145
|
|
|
|
|
|
|
'0' => 'Pentium IV (0.18 µm)', |
146
|
|
|
|
|
|
|
'1' => 'Pentium IV (0.18 µm)', |
147
|
|
|
|
|
|
|
'2' => 'Pentium IV (0.13 µm)', |
148
|
|
|
|
|
|
|
'3' => 'Pentium IV (0.09 µm)', |
149
|
|
|
|
|
|
|
# Itanium 2 (IA-64)? |
150
|
|
|
|
|
|
|
}, |
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
sub _AMD { |
154
|
|
|
|
|
|
|
# Family Model Name |
155
|
|
|
|
|
|
|
return |
156
|
1
|
|
|
1
|
|
12
|
'4' => { |
157
|
|
|
|
|
|
|
'3' => '486 DX/2', |
158
|
|
|
|
|
|
|
'7' => '486 DX/2-WB', |
159
|
|
|
|
|
|
|
'8' => '486 DX/4', |
160
|
|
|
|
|
|
|
'9' => '486 DX/4-WB', |
161
|
|
|
|
|
|
|
'14' => 'Am5x86-WT', |
162
|
|
|
|
|
|
|
'15' => 'Am5x86-WB', |
163
|
|
|
|
|
|
|
}, |
164
|
|
|
|
|
|
|
'5' => { |
165
|
|
|
|
|
|
|
'0' => 'K5/SSA5', |
166
|
|
|
|
|
|
|
'1' => 'K5', |
167
|
|
|
|
|
|
|
'2' => 'K5', |
168
|
|
|
|
|
|
|
'3' => 'K5', |
169
|
|
|
|
|
|
|
'6' => 'K6', |
170
|
|
|
|
|
|
|
'7' => 'K6', |
171
|
|
|
|
|
|
|
'8' => 'K6-2', |
172
|
|
|
|
|
|
|
'9' => 'K6-3', |
173
|
|
|
|
|
|
|
'13' => 'K6-2+ or K6-III+', |
174
|
|
|
|
|
|
|
}, |
175
|
|
|
|
|
|
|
'6' => { |
176
|
|
|
|
|
|
|
'0' => 'Athlon (25 µm)', |
177
|
|
|
|
|
|
|
'1' => 'Athlon (25 µm)', |
178
|
|
|
|
|
|
|
'2' => 'Athlon (18 µm)', |
179
|
|
|
|
|
|
|
'3' => 'Duron', |
180
|
|
|
|
|
|
|
'4' => 'Athlon (Thunderbird)', |
181
|
|
|
|
|
|
|
'6' => 'Athlon (Palamino)', |
182
|
|
|
|
|
|
|
'7' => 'Duron (Morgan)', |
183
|
|
|
|
|
|
|
'8' => 'Athlon (Thoroughbred)', |
184
|
|
|
|
|
|
|
'10' => 'Athlon (Barton)', |
185
|
|
|
|
|
|
|
}, |
186
|
|
|
|
|
|
|
'15' => { |
187
|
|
|
|
|
|
|
'4' => 'Athlon 64', |
188
|
|
|
|
|
|
|
'5' => 'Athlon 64 FX Opteron', |
189
|
|
|
|
|
|
|
}, |
190
|
|
|
|
|
|
|
} |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
sub _OTHER_ID { |
193
|
|
|
|
|
|
|
# Vendor Manufacturer Name |
194
|
|
|
|
|
|
|
return |
195
|
1
|
|
|
1
|
|
8
|
'CyrixInstead' => 'Cyrix', |
196
|
|
|
|
|
|
|
'CentaurHauls' => 'Centaur', |
197
|
|
|
|
|
|
|
'NexGenDriven' => 'NexGen', |
198
|
|
|
|
|
|
|
'GenuineTMx86' => 'Transmeta', |
199
|
|
|
|
|
|
|
'RiseRiseRise' => 'Rise', |
200
|
|
|
|
|
|
|
'UMC UMC UMC' => 'UMC', |
201
|
|
|
|
|
|
|
'SiS SiS SiS' => 'SiS', |
202
|
|
|
|
|
|
|
'Geode by NSC' => 'National Semiconductor', |
203
|
|
|
|
|
|
|
} |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
sub _OTHER { |
206
|
|
|
|
|
|
|
return |
207
|
1
|
|
|
1
|
|
27
|
Cyrix => { |
208
|
|
|
|
|
|
|
# Family Model Name |
209
|
|
|
|
|
|
|
'4' => { |
210
|
|
|
|
|
|
|
'4' => 'MediaGX', |
211
|
|
|
|
|
|
|
}, |
212
|
|
|
|
|
|
|
'5' => { |
213
|
|
|
|
|
|
|
'2' => '6x86 / 6x86L (Identifying the difference)', |
214
|
|
|
|
|
|
|
'4' => 'MediaGX MMX Enhanced', |
215
|
|
|
|
|
|
|
}, |
216
|
|
|
|
|
|
|
'6' => { |
217
|
|
|
|
|
|
|
'0' => 'm II (6x86MX)', |
218
|
|
|
|
|
|
|
'5' => 'VIA Cyrix M2 core', |
219
|
|
|
|
|
|
|
'6' => 'WinChip C5A', |
220
|
|
|
|
|
|
|
'7' => 'WinChip C5B ,WinChip C5C', |
221
|
|
|
|
|
|
|
'8' => 'WinChip C5N', |
222
|
|
|
|
|
|
|
'9' => 'WinChip C5XL, WinChip C5P', |
223
|
|
|
|
|
|
|
}, |
224
|
|
|
|
|
|
|
}, |
225
|
|
|
|
|
|
|
UMC => { |
226
|
|
|
|
|
|
|
'4' => { |
227
|
|
|
|
|
|
|
'1' => 'U5D', |
228
|
|
|
|
|
|
|
'2' => 'U5S', |
229
|
|
|
|
|
|
|
}, |
230
|
|
|
|
|
|
|
}, |
231
|
|
|
|
|
|
|
Centaur => { |
232
|
|
|
|
|
|
|
'5' => { |
233
|
|
|
|
|
|
|
'4' => 'C6', |
234
|
|
|
|
|
|
|
'8' => 'C2', |
235
|
|
|
|
|
|
|
'9' => 'C3', |
236
|
|
|
|
|
|
|
}, |
237
|
|
|
|
|
|
|
}, |
238
|
|
|
|
|
|
|
'National Semiconductor' => { |
239
|
|
|
|
|
|
|
'5' => { |
240
|
|
|
|
|
|
|
'4' => 'GX1, GXLV, GXm', |
241
|
|
|
|
|
|
|
'5' => 'GX2', |
242
|
|
|
|
|
|
|
}, |
243
|
|
|
|
|
|
|
}, |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
NexGen => { |
246
|
|
|
|
|
|
|
'5' => { |
247
|
|
|
|
|
|
|
'0' => 'Nx586', |
248
|
|
|
|
|
|
|
}, |
249
|
|
|
|
|
|
|
}, |
250
|
|
|
|
|
|
|
Rise => { |
251
|
|
|
|
|
|
|
'5' => { |
252
|
|
|
|
|
|
|
'0' => 'mP6', |
253
|
|
|
|
|
|
|
'1' => 'mP6', |
254
|
|
|
|
|
|
|
}, |
255
|
|
|
|
|
|
|
}, |
256
|
|
|
|
|
|
|
SiS => { |
257
|
|
|
|
|
|
|
'5' => { |
258
|
|
|
|
|
|
|
'0' => '55x', |
259
|
|
|
|
|
|
|
} |
260
|
|
|
|
|
|
|
}, |
261
|
|
|
|
|
|
|
Transmeta => { |
262
|
|
|
|
|
|
|
'5' => { |
263
|
|
|
|
|
|
|
'4' => 'Crusoe TM3x00 and TM5x00', |
264
|
|
|
|
|
|
|
}, |
265
|
|
|
|
|
|
|
}, |
266
|
|
|
|
|
|
|
} |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
1; |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
__END__ |