sys-cpu 1.0.1 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGES.md +22 -0
- data/Gemfile +2 -7
- data/MANIFEST.md +1 -0
- data/README.md +21 -14
- data/Rakefile +4 -1
- data/doc/bsd.md +58 -0
- data/doc/linux.md +46 -0
- data/install.rb +2 -2
- data/lib/sys/cpu.rb +10 -1
- data/lib/sys/darwin/sys/cpu.rb +198 -0
- data/lib/sys/linux/sys/cpu.rb +43 -43
- data/lib/sys/unix/sys/cpu.rb +57 -97
- data/lib/sys/windows/sys/cpu.rb +430 -311
- data/lib/sys-cpu.rb +2 -0
- data/spec/spec_helper.rb +4 -0
- data/spec/sys_cpu_bsd_spec.rb +53 -51
- data/spec/sys_cpu_hpux_spec.rb +33 -28
- data/spec/sys_cpu_linux_spec.rb +32 -26
- data/spec/{sys_cpu_spec.rb → sys_cpu_shared.rb} +10 -4
- data/spec/sys_cpu_sunos_spec.rb +44 -42
- data/spec/sys_cpu_windows_spec.rb +39 -34
- data/sys-cpu.gemspec +4 -4
- data.tar.gz.sig +0 -0
- metadata +40 -11
- metadata.gz.sig +0 -0
- data/doc/bsd.txt +0 -49
- data/doc/linux.txt +0 -41
data/lib/sys/windows/sys/cpu.rb
CHANGED
@@ -1,15 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'win32ole'
|
2
4
|
require 'socket'
|
3
5
|
|
4
|
-
# See Ruby bugs #2618 and #7681. This is a workaround.
|
5
|
-
BEGIN{
|
6
|
-
require 'win32ole'
|
7
|
-
if RUBY_VERSION.to_f < 2.0
|
8
|
-
WIN32OLE.ole_initialize
|
9
|
-
at_exit { WIN32OLE.ole_uninitialize }
|
10
|
-
end
|
11
|
-
}
|
12
|
-
|
13
6
|
# The Sys module serves only as a namespace
|
14
7
|
module Sys
|
15
8
|
# Encapsulates system CPU information
|
@@ -17,10 +10,10 @@ module Sys
|
|
17
10
|
# Error raised if any of the Sys::CPU methods fail.
|
18
11
|
class Error < StandardError; end
|
19
12
|
|
20
|
-
private
|
21
|
-
|
22
13
|
# Base connect string
|
23
|
-
BASE_CS =
|
14
|
+
BASE_CS = 'winmgmts:{impersonationLevel=impersonate}' # :nodoc:
|
15
|
+
|
16
|
+
private_constant :BASE_CS
|
24
17
|
|
25
18
|
# Fields used in the CPUStruct
|
26
19
|
fields = %w[
|
@@ -71,21 +64,21 @@ module Sys
|
|
71
64
|
]
|
72
65
|
|
73
66
|
# The struct returned by the CPU.processors method
|
74
|
-
CPUStruct = Struct.new(
|
67
|
+
CPUStruct = Struct.new('CPUStruct', *fields) # :nodoc:
|
75
68
|
|
76
|
-
|
69
|
+
private_constant :CPUStruct
|
77
70
|
|
78
71
|
# Returns the +host+ CPU's architecture, or nil if it cannot be
|
79
72
|
# determined.
|
80
73
|
#
|
81
|
-
def self.architecture(host=Socket.gethostname)
|
74
|
+
def self.architecture(host = Socket.gethostname)
|
82
75
|
cs = BASE_CS + "//#{host}/root/cimv2:Win32_Processor='cpu0'"
|
83
76
|
begin
|
84
77
|
wmi = WIN32OLE.connect(cs)
|
85
|
-
rescue WIN32OLERuntimeError =>
|
86
|
-
raise Error,
|
78
|
+
rescue WIN32OLERuntimeError => err
|
79
|
+
raise Error, err
|
87
80
|
else
|
88
|
-
|
81
|
+
get_cpu_arch(wmi.Architecture)
|
89
82
|
end
|
90
83
|
end
|
91
84
|
|
@@ -98,10 +91,10 @@ module Sys
|
|
98
91
|
cs = BASE_CS + "//#{host}/root/cimv2:Win32_Processor='cpu#{cpu_num}'"
|
99
92
|
begin
|
100
93
|
wmi = WIN32OLE.connect(cs)
|
101
|
-
rescue WIN32OLERuntimeError =>
|
102
|
-
raise Error,
|
94
|
+
rescue WIN32OLERuntimeError => err
|
95
|
+
raise Error, err
|
103
96
|
else
|
104
|
-
|
97
|
+
wmi.CurrentClockSpeed
|
105
98
|
end
|
106
99
|
end
|
107
100
|
|
@@ -117,10 +110,10 @@ module Sys
|
|
117
110
|
cs = BASE_CS + "//#{host}/root/cimv2:Win32_Processor='cpu#{cpu_num}'"
|
118
111
|
begin
|
119
112
|
wmi = WIN32OLE.connect(cs)
|
120
|
-
rescue WIN32OLERuntimeError =>
|
121
|
-
raise Error,
|
113
|
+
rescue WIN32OLERuntimeError => err
|
114
|
+
raise Error, err
|
122
115
|
else
|
123
|
-
|
116
|
+
wmi.LoadPercentage
|
124
117
|
end
|
125
118
|
end
|
126
119
|
|
@@ -130,10 +123,10 @@ module Sys
|
|
130
123
|
cs = BASE_CS + "//#{host}/root/cimv2:Win32_Processor='cpu0'"
|
131
124
|
begin
|
132
125
|
wmi = WIN32OLE.connect(cs)
|
133
|
-
rescue WIN32OLERuntimeError =>
|
134
|
-
raise Error,
|
126
|
+
rescue WIN32OLERuntimeError => err
|
127
|
+
raise Error, err
|
135
128
|
else
|
136
|
-
|
129
|
+
wmi.Name
|
137
130
|
end
|
138
131
|
end
|
139
132
|
|
@@ -145,10 +138,10 @@ module Sys
|
|
145
138
|
cs = BASE_CS + "//#{host}/root/cimv2:Win32_ComputerSystem='#{host}'"
|
146
139
|
begin
|
147
140
|
wmi = WIN32OLE.connect(cs)
|
148
|
-
rescue WIN32OLERuntimeError =>
|
149
|
-
raise Error,
|
141
|
+
rescue WIN32OLERuntimeError => err
|
142
|
+
raise Error, err
|
150
143
|
else
|
151
|
-
|
144
|
+
wmi.NumberOfProcessors
|
152
145
|
end
|
153
146
|
end
|
154
147
|
|
@@ -201,20 +194,21 @@ module Sys
|
|
201
194
|
# * voltage_caps
|
202
195
|
#
|
203
196
|
# Note that not all of these members will necessarily be defined.
|
204
|
-
|
197
|
+
#--
|
198
|
+
# rubocop:disable Metrics/BlockLength
|
205
199
|
def self.processors(host = Socket.gethostname) # :yields: CPUStruct
|
206
200
|
begin
|
207
201
|
wmi = WIN32OLE.connect(BASE_CS + "//#{host}/root/cimv2")
|
208
|
-
rescue WIN32OLERuntimeError =>
|
209
|
-
raise Error,
|
202
|
+
rescue WIN32OLERuntimeError => err
|
203
|
+
raise Error, err
|
210
204
|
else
|
211
|
-
wmi.InstancesOf(
|
205
|
+
wmi.InstancesOf('Win32_Processor').each do |cpu|
|
212
206
|
yield CPUStruct.new(
|
213
207
|
cpu.AddressWidth,
|
214
|
-
|
215
|
-
|
208
|
+
get_cpu_arch(cpu.Architecture),
|
209
|
+
get_availability(cpu.Availability),
|
216
210
|
cpu.Caption,
|
217
|
-
|
211
|
+
get_cmec(cpu.ConfigManagerErrorCode),
|
218
212
|
cpu.ConfigManagerUserConfig,
|
219
213
|
get_status(cpu.CpuStatus),
|
220
214
|
cpu.CreationClassName,
|
@@ -226,7 +220,7 @@ module Sys
|
|
226
220
|
cpu.ErrorCleared,
|
227
221
|
cpu.ErrorDescription,
|
228
222
|
cpu.ExtClock,
|
229
|
-
|
223
|
+
get_family(cpu.Family),
|
230
224
|
cpu.InstallDate,
|
231
225
|
cpu.L2CacheSize,
|
232
226
|
cpu.L2CacheSpeed,
|
@@ -241,7 +235,7 @@ module Sys
|
|
241
235
|
cpu.PowerManagementSupported,
|
242
236
|
cpu.PowerManagementCapabilities,
|
243
237
|
cpu.ProcessorId,
|
244
|
-
|
238
|
+
get_processor_type(cpu.ProcessorType),
|
245
239
|
cpu.Revision,
|
246
240
|
cpu.Role,
|
247
241
|
cpu.SocketDesignation,
|
@@ -251,24 +245,26 @@ module Sys
|
|
251
245
|
cpu.SystemCreationClassName,
|
252
246
|
cpu.SystemName,
|
253
247
|
cpu.UniqueId,
|
254
|
-
|
248
|
+
get_upgrade_method(cpu.UpgradeMethod),
|
255
249
|
cpu.Version,
|
256
|
-
|
250
|
+
get_voltage_caps(cpu.VoltageCaps)
|
257
251
|
)
|
258
|
-
|
252
|
+
end
|
259
253
|
end
|
260
254
|
end
|
261
255
|
|
256
|
+
# rubocop:enable Metrics/BlockLength
|
257
|
+
|
262
258
|
# Returns a string indicating the type of processor, e.g. GenuineIntel.
|
263
259
|
#
|
264
260
|
def self.cpu_type(host = Socket.gethostname)
|
265
261
|
cs = BASE_CS + "//#{host}/root/cimv2:Win32_Processor='cpu0'"
|
266
262
|
begin
|
267
263
|
wmi = WIN32OLE.connect(cs)
|
268
|
-
rescue WIN32OLERuntimeError =>
|
269
|
-
raise Error,
|
264
|
+
rescue WIN32OLERuntimeError => err
|
265
|
+
raise Error, err
|
270
266
|
else
|
271
|
-
|
267
|
+
wmi.Manufacturer
|
272
268
|
end
|
273
269
|
end
|
274
270
|
|
@@ -280,517 +276,640 @@ module Sys
|
|
280
276
|
def self.get_cmec(num)
|
281
277
|
case num
|
282
278
|
when 0
|
283
|
-
|
284
|
-
return str
|
279
|
+
'The device is working properly.'
|
285
280
|
when 1
|
286
|
-
|
287
|
-
return str
|
281
|
+
'The device is not configured correctly.'
|
288
282
|
when 2
|
289
|
-
|
290
|
-
return str
|
283
|
+
'Windows cannot load the driver for the device.'
|
291
284
|
when 3
|
292
|
-
str =
|
293
|
-
str <<
|
294
|
-
str <<
|
295
|
-
|
285
|
+
str = 'The driver for the device might be corrupted, or the'
|
286
|
+
str << ' system may be running low on memory or other'
|
287
|
+
str << ' resources.'
|
288
|
+
str
|
296
289
|
when 4
|
297
|
-
str =
|
298
|
-
str <<
|
299
|
-
|
290
|
+
str = 'The device is not working properly. One of the drivers'
|
291
|
+
str << ' or the registry might be corrupted.'
|
292
|
+
str
|
300
293
|
when 5
|
301
|
-
str =
|
302
|
-
str <<
|
303
|
-
|
294
|
+
str = 'The driver for this device needs a resource that'
|
295
|
+
str << ' Windows cannot manage.'
|
296
|
+
str
|
304
297
|
when 6
|
305
|
-
str =
|
306
|
-
str <<
|
307
|
-
|
298
|
+
str = 'The boot configuration for this device conflicts with'
|
299
|
+
str << ' other devices.'
|
300
|
+
str
|
308
301
|
when 7
|
309
|
-
|
310
|
-
return str
|
302
|
+
'Cannot filter.'
|
311
303
|
when 8
|
312
|
-
|
313
|
-
return str
|
304
|
+
'The driver loader for the device is missing.'
|
314
305
|
when 9
|
315
|
-
str =
|
316
|
-
str <<
|
317
|
-
str <<
|
318
|
-
|
306
|
+
str = 'This device is not working properly because the'
|
307
|
+
str << ' controlling firmware is reporting the resources'
|
308
|
+
str << ' for the device incorrectly.'
|
309
|
+
str
|
319
310
|
when 10
|
320
|
-
|
321
|
-
return str
|
311
|
+
'This device cannot start.'
|
322
312
|
when 11
|
323
|
-
|
324
|
-
return str
|
313
|
+
'This device failed.'
|
325
314
|
when 12
|
326
|
-
str =
|
327
|
-
str <<
|
328
|
-
|
315
|
+
str = 'This device cannot find enough free resources that'
|
316
|
+
str << ' it can use.'
|
317
|
+
str
|
329
318
|
when 13
|
330
|
-
|
331
|
-
return str
|
319
|
+
"Windows cannot verify this device's resources."
|
332
320
|
when 14
|
333
|
-
str =
|
334
|
-
str <<
|
335
|
-
|
321
|
+
str = 'This device cannot work properly until you restart'
|
322
|
+
str << ' your computer.'
|
323
|
+
str
|
336
324
|
when 15
|
337
|
-
str =
|
338
|
-
str <<
|
339
|
-
|
325
|
+
str = 'This device is not working properly because there is'
|
326
|
+
str << ' probably a re-enumeration problem.'
|
327
|
+
str
|
340
328
|
when 16
|
341
|
-
|
342
|
-
|
343
|
-
|
329
|
+
str = 'Windows cannot identify all the resources this device '
|
330
|
+
str << ' uses.'
|
331
|
+
str
|
344
332
|
when 17
|
345
|
-
|
346
|
-
return str
|
333
|
+
'This device is asking for an unknown resource type.'
|
347
334
|
when 18
|
348
|
-
|
349
|
-
return str
|
335
|
+
'Reinstall the drivers for this device.'
|
350
336
|
when 19
|
351
|
-
|
352
|
-
return str
|
337
|
+
'Failure using the VXD loader.'
|
353
338
|
when 20
|
354
|
-
|
355
|
-
return str
|
339
|
+
'Your registry might be corrupted.'
|
356
340
|
when 21
|
357
|
-
str =
|
358
|
-
str <<
|
359
|
-
str <<
|
360
|
-
|
341
|
+
str = 'System failure: try changing the driver for this device.'
|
342
|
+
str << ' If that does not work, see your hardware documentation.'
|
343
|
+
str << ' Windows is removing this device.'
|
344
|
+
str
|
361
345
|
when 22
|
362
|
-
|
363
|
-
return str
|
346
|
+
'This device is disabled.'
|
364
347
|
when 23
|
365
|
-
str =
|
348
|
+
str = 'System failure: try changing the driver for this device.'
|
366
349
|
str << "If that doesn't work, see your hardware documentation."
|
367
|
-
|
350
|
+
str
|
368
351
|
when 24
|
369
|
-
str =
|
370
|
-
str <<
|
371
|
-
|
372
|
-
when 25
|
373
|
-
|
374
|
-
return str
|
375
|
-
when 26
|
376
|
-
str = "Windows is still setting up this device."
|
377
|
-
return str
|
352
|
+
str = 'This device is not present, not working properly, or'
|
353
|
+
str << ' does not have all its drivers installed.'
|
354
|
+
str
|
355
|
+
when 25, 26
|
356
|
+
'Windows is still setting up this device.'
|
378
357
|
when 27
|
379
|
-
|
380
|
-
return str
|
358
|
+
'This device does not have valid log configuration.'
|
381
359
|
when 28
|
382
|
-
|
383
|
-
return str
|
360
|
+
'The drivers for this device are not installed.'
|
384
361
|
when 29
|
385
|
-
str =
|
386
|
-
str <<
|
387
|
-
|
362
|
+
str = 'This device is disabled because the firmware of the'
|
363
|
+
str << ' device did not give it the required resources.'
|
364
|
+
str
|
388
365
|
when 30
|
389
|
-
str =
|
390
|
-
str <<
|
391
|
-
|
366
|
+
str = 'This device is using an Interrupt Request (IRQ)'
|
367
|
+
str << ' resource that another device is using.'
|
368
|
+
str
|
392
369
|
when 31
|
393
|
-
str =
|
394
|
-
str <<
|
395
|
-
|
396
|
-
else
|
397
|
-
return nil
|
370
|
+
str = 'This device is not working properly because Windows'
|
371
|
+
str << ' cannot load the drivers required for this device'
|
372
|
+
str
|
398
373
|
end
|
399
374
|
end
|
400
375
|
|
376
|
+
private_class_method :get_cmec
|
377
|
+
|
401
378
|
# Convert an cpu architecture number to a string
|
402
379
|
def self.get_cpu_arch(num)
|
403
380
|
case num
|
404
381
|
when 0
|
405
|
-
|
382
|
+
'x86'
|
406
383
|
when 1
|
407
|
-
|
384
|
+
'MIPS'
|
408
385
|
when 2
|
409
|
-
|
386
|
+
'Alpha'
|
410
387
|
when 3
|
411
|
-
|
388
|
+
'PowerPC'
|
412
389
|
when 6
|
413
|
-
|
390
|
+
'IA64'
|
414
391
|
when 9
|
415
|
-
|
416
|
-
else
|
417
|
-
return nil
|
392
|
+
'x64'
|
418
393
|
end
|
419
394
|
end
|
420
395
|
|
396
|
+
private_class_method :get_cpu_arch
|
397
|
+
|
421
398
|
# convert an Availability number into a string
|
422
399
|
def self.get_availability(num)
|
423
400
|
case num
|
424
401
|
when 1
|
425
|
-
|
402
|
+
'Other'
|
426
403
|
when 2
|
427
|
-
|
404
|
+
'Unknown'
|
428
405
|
when 3
|
429
|
-
|
406
|
+
'Running'
|
430
407
|
when 4
|
431
|
-
|
408
|
+
'Warning'
|
432
409
|
when 5
|
433
|
-
|
410
|
+
'In Test'
|
434
411
|
when 6
|
435
|
-
|
412
|
+
'Not Applicable'
|
436
413
|
when 7
|
437
|
-
|
414
|
+
'Power Off'
|
438
415
|
when 8
|
439
|
-
|
416
|
+
'Off Line'
|
440
417
|
when 9
|
441
|
-
|
418
|
+
'Off Duty'
|
442
419
|
when 10
|
443
|
-
|
420
|
+
'Degraded'
|
444
421
|
when 11
|
445
|
-
|
422
|
+
'Not Installed'
|
446
423
|
when 12
|
447
|
-
|
424
|
+
'Install Error'
|
448
425
|
when 13
|
449
|
-
|
426
|
+
'Power Save - Unknown'
|
450
427
|
when 14
|
451
|
-
|
428
|
+
'Power Save - Low Power Mode'
|
452
429
|
when 15
|
453
|
-
|
430
|
+
'Power Save - Standby'
|
454
431
|
when 16
|
455
|
-
|
432
|
+
'Power Cycle'
|
456
433
|
when 17
|
457
|
-
|
434
|
+
'Power Save - Warning'
|
458
435
|
when 18
|
459
|
-
|
436
|
+
'Paused'
|
460
437
|
when 19
|
461
|
-
|
438
|
+
'Not Ready'
|
462
439
|
when 20
|
463
|
-
|
440
|
+
'Not Configured'
|
464
441
|
when 21
|
465
|
-
|
466
|
-
else
|
467
|
-
return nil
|
442
|
+
'Quiesced'
|
468
443
|
end
|
469
444
|
end
|
470
445
|
|
446
|
+
private_class_method :get_availability
|
447
|
+
|
471
448
|
# convert CpuStatus to a string form. Note that values 5 and 6 are
|
472
449
|
# skipped because they're reserved.
|
473
450
|
def self.get_status(num)
|
474
451
|
case num
|
475
452
|
when 0
|
476
|
-
|
453
|
+
'Unknown'
|
477
454
|
when 1
|
478
|
-
|
455
|
+
'Enabled'
|
479
456
|
when 2
|
480
|
-
|
457
|
+
'Disabled by User via BIOS Setup'
|
481
458
|
when 3
|
482
|
-
|
459
|
+
'Disabled By BIOS (POST Error)'
|
483
460
|
when 4
|
484
|
-
|
461
|
+
'Idle'
|
485
462
|
when 7
|
486
|
-
|
487
|
-
else
|
488
|
-
return nil
|
463
|
+
'Other'
|
489
464
|
end
|
490
465
|
end
|
491
466
|
|
467
|
+
private_class_method :get_status
|
468
|
+
|
492
469
|
# Convert a family number into the equivalent string
|
470
|
+
#
|
471
|
+
# NOTE: This could be out of date as new data is added occasionally.
|
472
|
+
# If there's a nicer way to do this, please send a PR my way.
|
473
|
+
#
|
493
474
|
def self.get_family(num)
|
494
475
|
case num
|
495
476
|
when 1
|
496
|
-
|
477
|
+
'Other'
|
497
478
|
when 2
|
498
|
-
|
479
|
+
'Unknown'
|
499
480
|
when 3
|
500
|
-
|
481
|
+
'8086'
|
501
482
|
when 4
|
502
|
-
|
483
|
+
'80286'
|
503
484
|
when 5
|
504
|
-
|
485
|
+
'80386'
|
505
486
|
when 6
|
506
|
-
|
487
|
+
'80486'
|
507
488
|
when 7
|
508
|
-
|
489
|
+
'8087'
|
509
490
|
when 8
|
510
|
-
|
491
|
+
'80287'
|
511
492
|
when 9
|
512
|
-
|
493
|
+
'80387'
|
513
494
|
when 10
|
514
|
-
|
495
|
+
'80487'
|
515
496
|
when 11
|
516
|
-
|
497
|
+
'Pentium'
|
517
498
|
when 12
|
518
|
-
|
499
|
+
'Pentium Pro'
|
519
500
|
when 13
|
520
|
-
|
501
|
+
'Pentium II'
|
521
502
|
when 14
|
522
|
-
|
503
|
+
'Pentium with MMX'
|
523
504
|
when 15
|
524
|
-
|
505
|
+
'Celeron'
|
525
506
|
when 16
|
526
|
-
|
507
|
+
'Pentium II Xeon'
|
527
508
|
when 17
|
528
|
-
|
509
|
+
'Pentium III'
|
529
510
|
when 18
|
530
|
-
|
511
|
+
'M1'
|
531
512
|
when 19
|
532
|
-
|
513
|
+
'M2'
|
533
514
|
when 24
|
534
|
-
|
515
|
+
'K5'
|
535
516
|
when 25
|
536
|
-
|
517
|
+
'K6'
|
537
518
|
when 26
|
538
|
-
|
519
|
+
'K6-2'
|
539
520
|
when 27
|
540
|
-
|
521
|
+
'K6-3'
|
541
522
|
when 28
|
542
|
-
|
523
|
+
'AMD Athlon'
|
543
524
|
when 29
|
544
|
-
|
525
|
+
'AMD Duron'
|
545
526
|
when 30
|
546
|
-
|
527
|
+
'AMD2900'
|
547
528
|
when 31
|
548
|
-
|
529
|
+
'K6-2+'
|
549
530
|
when 32
|
550
|
-
|
531
|
+
'Power PC'
|
551
532
|
when 33
|
552
|
-
|
533
|
+
'Power 601'
|
553
534
|
when 34
|
554
|
-
|
535
|
+
'Power 603'
|
555
536
|
when 35
|
556
|
-
|
537
|
+
'Power 603+'
|
557
538
|
when 36
|
558
|
-
|
539
|
+
'Power 604'
|
559
540
|
when 37
|
560
|
-
|
541
|
+
'Power 620'
|
561
542
|
when 38
|
562
|
-
|
543
|
+
'Power X704'
|
563
544
|
when 39
|
564
|
-
|
545
|
+
'Power 750'
|
565
546
|
when 48
|
566
|
-
|
547
|
+
'Alpha'
|
567
548
|
when 49
|
568
|
-
|
549
|
+
'Alpha 21064'
|
569
550
|
when 50
|
570
|
-
|
551
|
+
'Alpha 21066'
|
571
552
|
when 51
|
572
|
-
|
553
|
+
'Alpha 21164'
|
573
554
|
when 52
|
574
|
-
|
555
|
+
'Alpha 21164PC'
|
575
556
|
when 53
|
576
|
-
|
557
|
+
'Alpha 21164a'
|
577
558
|
when 54
|
578
|
-
|
559
|
+
'Alpha 21264'
|
579
560
|
when 55
|
580
|
-
|
561
|
+
'Alpha 21364'
|
581
562
|
when 64
|
582
|
-
|
563
|
+
'MIPS'
|
583
564
|
when 65
|
584
|
-
|
565
|
+
'MIPS R4000'
|
585
566
|
when 66
|
586
|
-
|
567
|
+
'MIPS R4200'
|
587
568
|
when 67
|
588
|
-
|
569
|
+
'MIPS R4400'
|
589
570
|
when 68
|
590
|
-
|
571
|
+
'MIPS R4600'
|
591
572
|
when 69
|
592
|
-
|
573
|
+
'MIPS R10000'
|
593
574
|
when 80
|
594
|
-
|
575
|
+
'SPARC'
|
595
576
|
when 81
|
596
|
-
|
577
|
+
'SuperSPARC'
|
597
578
|
when 82
|
598
|
-
|
579
|
+
'microSPARC II'
|
599
580
|
when 83
|
600
|
-
|
581
|
+
'microSPARC IIep'
|
601
582
|
when 84
|
602
|
-
|
583
|
+
'UltraSPARC'
|
603
584
|
when 85
|
604
|
-
|
585
|
+
'UltraSPARC II'
|
605
586
|
when 86
|
606
|
-
|
587
|
+
'UltraSPARC IIi'
|
607
588
|
when 87
|
608
|
-
|
589
|
+
'UltraSPARC III'
|
609
590
|
when 88
|
610
|
-
|
591
|
+
'UltraSPARC IIIi'
|
611
592
|
when 96
|
612
|
-
|
593
|
+
'68040'
|
613
594
|
when 97
|
614
|
-
|
595
|
+
'68xxx'
|
615
596
|
when 98
|
616
|
-
|
597
|
+
'68000'
|
617
598
|
when 99
|
618
|
-
|
599
|
+
'68010'
|
619
600
|
when 100
|
620
|
-
|
601
|
+
'68020'
|
621
602
|
when 101
|
622
|
-
|
603
|
+
'68030'
|
623
604
|
when 112
|
624
|
-
|
605
|
+
'Hobbit'
|
625
606
|
when 120
|
626
|
-
|
607
|
+
'Crusoe TM5000'
|
627
608
|
when 121
|
628
|
-
|
609
|
+
'Crusoe TM3000'
|
629
610
|
when 128
|
630
|
-
|
611
|
+
'Weitek'
|
631
612
|
when 130
|
632
|
-
|
613
|
+
'Itanium'
|
614
|
+
when 131
|
615
|
+
'AMD Athlon 64'
|
616
|
+
when 132
|
617
|
+
'AMD Opteron'
|
618
|
+
when 133
|
619
|
+
'AMD Sempron'
|
620
|
+
when 134
|
621
|
+
'AMD Turion 64 Mobile'
|
622
|
+
when 135
|
623
|
+
'AMD Opteron Dual-Core'
|
624
|
+
when 136
|
625
|
+
'AMD Athlon 64 X2 Dual-Core'
|
626
|
+
when 137
|
627
|
+
'AMD Turion 64 X2 Mobile'
|
628
|
+
when 138
|
629
|
+
'AMD Opteron Quad-Core'
|
630
|
+
when 139
|
631
|
+
'AMD Opteron Third Generation'
|
632
|
+
when 140
|
633
|
+
'AMD Phenom FX Quad-Core'
|
634
|
+
when 141
|
635
|
+
'AMD Phenom X4 Quad-Core'
|
636
|
+
when 142
|
637
|
+
'AMD Phenom X2 Dual-Core'
|
638
|
+
when 143
|
639
|
+
'AMD Athlon X2 Dual-Core'
|
633
640
|
when 144
|
634
|
-
|
641
|
+
'PA-RISC'
|
635
642
|
when 145
|
636
|
-
|
643
|
+
'PA-RISC 8500'
|
637
644
|
when 146
|
638
|
-
|
645
|
+
'PA-RISC 8000'
|
639
646
|
when 147
|
640
|
-
|
647
|
+
'PA-RISC 7300LC'
|
641
648
|
when 148
|
642
|
-
|
649
|
+
'PA-RISC 7200'
|
643
650
|
when 149
|
644
|
-
|
651
|
+
'PA-RISC 7100LC'
|
645
652
|
when 150
|
646
|
-
|
653
|
+
'PA-RISC 7100'
|
647
654
|
when 160
|
648
|
-
|
655
|
+
'V30'
|
656
|
+
when 161
|
657
|
+
'Intel Xeon 3200 Quad-Core'
|
658
|
+
when 162
|
659
|
+
'Intel Xeon 3000 Dual-Core'
|
660
|
+
when 163
|
661
|
+
'Intel Xeon 5300 Quad-Core'
|
662
|
+
when 164
|
663
|
+
'Intel Xeon 5100 Dual-Core'
|
664
|
+
when 165
|
665
|
+
'Intel Xeon 5000 Dual-Core'
|
666
|
+
when 166
|
667
|
+
'Intel Xeon LV Dual-Core'
|
668
|
+
when 167
|
669
|
+
'Intel Xeon ULV Dual-Core'
|
670
|
+
when 168
|
671
|
+
'Intel Xeon 7100 Dual-Core'
|
672
|
+
when 169
|
673
|
+
'Intel Xeon 5400 Quad-Core'
|
674
|
+
when 170
|
675
|
+
'Intel Xeon Quad-Core'
|
676
|
+
when 171
|
677
|
+
'Intel Xeon 5200 Dual-Core'
|
678
|
+
when 172
|
679
|
+
'Intel Xeon 7200 Dual-Core'
|
680
|
+
when 173
|
681
|
+
'Intel Xeon 7300 Quad-Core'
|
682
|
+
when 174
|
683
|
+
'Intel Xeon 7400 Quad-Core'
|
684
|
+
when 175
|
685
|
+
'Intel Xeon 7400 Multi-Core'
|
649
686
|
when 176
|
650
|
-
|
687
|
+
'Pentium III Xeon'
|
651
688
|
when 177
|
652
|
-
|
689
|
+
'Pentium III with SpeedStep'
|
653
690
|
when 178
|
654
|
-
|
691
|
+
'Pentium 4'
|
655
692
|
when 179
|
656
|
-
|
693
|
+
'Intel Xeon'
|
657
694
|
when 180
|
658
|
-
|
695
|
+
'AS400'
|
659
696
|
when 181
|
660
|
-
|
697
|
+
'Intel Xeon MP'
|
661
698
|
when 182
|
662
|
-
|
699
|
+
'AMD Athlon XP'
|
663
700
|
when 183
|
664
|
-
|
701
|
+
'AMD Athlon MP'
|
665
702
|
when 184
|
666
|
-
|
703
|
+
'Intel Itanium 2'
|
667
704
|
when 185
|
668
|
-
|
705
|
+
'Intel Pentium M'
|
706
|
+
when 186
|
707
|
+
'Intel Celeron D'
|
708
|
+
when 187
|
709
|
+
'Intel Pentium D'
|
710
|
+
when 188
|
711
|
+
'Intel Pentium Extreme Edition'
|
712
|
+
when 189
|
713
|
+
'Intel Core Solo'
|
669
714
|
when 190
|
670
|
-
|
715
|
+
'K7'
|
716
|
+
when 191
|
717
|
+
'Intel Core2 Duo'
|
718
|
+
when 192
|
719
|
+
'Intel Core2 Solo'
|
720
|
+
when 193
|
721
|
+
'Intel Core2 Extreme'
|
722
|
+
when 194
|
723
|
+
'Intel Core2 Quad'
|
724
|
+
when 195
|
725
|
+
'Intel Core2 Extreme Mobile'
|
726
|
+
when 196
|
727
|
+
'Intel Core2 Duo Mobile'
|
728
|
+
when 197
|
729
|
+
'Intel Core2 Solo Mobile'
|
730
|
+
when 198
|
731
|
+
'Intel Core i7 Mobile'
|
732
|
+
when 199
|
733
|
+
'Intel Celeron Dual-Core'
|
671
734
|
when 200
|
672
|
-
|
735
|
+
'zSeries S/390'
|
673
736
|
when 201
|
674
|
-
|
737
|
+
'ESA/390 G4'
|
675
738
|
when 202
|
676
|
-
|
739
|
+
'ESA/390 G5'
|
740
|
+
when 203
|
741
|
+
'ESA/390 G6'
|
742
|
+
when 204
|
743
|
+
'z/Architectur'
|
744
|
+
when 205
|
745
|
+
'Intel Core i5'
|
746
|
+
when 206
|
747
|
+
'Intel Core i3'
|
748
|
+
when 210
|
749
|
+
'VIA C7-M'
|
750
|
+
when 211
|
751
|
+
'VIA C7-D'
|
752
|
+
when 212
|
753
|
+
'VIA C7'
|
754
|
+
when 213
|
755
|
+
'VIA Eden'
|
756
|
+
when 214
|
757
|
+
'Intel Xeon Multi-Core'
|
758
|
+
when 215
|
759
|
+
'Intel Xeon 3xxx Dual-Core'
|
760
|
+
when 216
|
761
|
+
'Intel Xeon 3xxx Quad-Core'
|
762
|
+
when 217
|
763
|
+
'VIA Nano'
|
764
|
+
when 218
|
765
|
+
'Intel Xeon 5xxx Dual-Core'
|
766
|
+
when 219
|
767
|
+
'Intel Xeon 5xxx Quad-Core'
|
768
|
+
when 221
|
769
|
+
'Intel Xeon 7xxx Dual-Core'
|
770
|
+
when 222
|
771
|
+
'Intel Xeon 7xxx Quad-Core'
|
772
|
+
when 223
|
773
|
+
'Intel Xeon 7xxx Multi-Core'
|
774
|
+
when 224
|
775
|
+
'Intel Xeon 3400 Multi-Core'
|
776
|
+
when 230
|
777
|
+
'AMD Opteron Embedded Quad-Core'
|
778
|
+
when 231
|
779
|
+
'AMD Phenom Triple-Core'
|
780
|
+
when 232
|
781
|
+
'AMD Turion Ultra Dual-Core Mobile'
|
782
|
+
when 233
|
783
|
+
'AMD Turion Dual-Core Mobile'
|
784
|
+
when 234
|
785
|
+
'AMD Athlon Dual-Core'
|
786
|
+
when 235
|
787
|
+
'AMD Sempron SI'
|
788
|
+
when 236
|
789
|
+
'AMD Phenom II'
|
790
|
+
when 237
|
791
|
+
'AMD Athlon II'
|
792
|
+
when 238
|
793
|
+
'AMD Opteron Six-Core'
|
794
|
+
when 239
|
795
|
+
'AMD Sempron M'
|
677
796
|
when 250
|
678
|
-
|
797
|
+
'i860'
|
679
798
|
when 251
|
680
|
-
|
799
|
+
'i960'
|
681
800
|
when 260
|
682
|
-
|
801
|
+
'SH-3'
|
683
802
|
when 261
|
684
|
-
|
803
|
+
'SH-4'
|
685
804
|
when 280
|
686
|
-
|
805
|
+
'ARM'
|
687
806
|
when 281
|
688
|
-
|
807
|
+
'StrongARM'
|
689
808
|
when 300
|
690
|
-
|
809
|
+
'6x86'
|
691
810
|
when 301
|
692
|
-
|
811
|
+
'MediaGX'
|
693
812
|
when 302
|
694
|
-
|
813
|
+
'MII'
|
695
814
|
when 320
|
696
|
-
|
815
|
+
'WinChip'
|
697
816
|
when 350
|
698
|
-
|
817
|
+
'DSP'
|
699
818
|
when 500
|
700
|
-
|
701
|
-
else
|
702
|
-
return nil
|
819
|
+
'Video'
|
703
820
|
end
|
704
821
|
end
|
705
822
|
|
823
|
+
private_class_method :get_family
|
824
|
+
|
706
825
|
# Convert power management capabilities number to its equivalent string
|
707
826
|
def self.get_pmc(num)
|
708
827
|
case num
|
709
828
|
when 0
|
710
|
-
|
829
|
+
'Unknown'
|
711
830
|
when 1
|
712
|
-
|
831
|
+
'Not Supported'
|
713
832
|
when 2
|
714
|
-
|
833
|
+
'Disabled'
|
715
834
|
when 3
|
716
|
-
|
835
|
+
'Enabled'
|
717
836
|
when 4
|
718
|
-
|
837
|
+
'Power Saving Modes Entered Automatically'
|
719
838
|
when 5
|
720
|
-
|
839
|
+
'Power State Settable'
|
721
840
|
when 6
|
722
|
-
|
841
|
+
'Power Cycling Supported'
|
723
842
|
when 7
|
724
|
-
|
725
|
-
else
|
726
|
-
return nil
|
843
|
+
'Timed Power On Supported'
|
727
844
|
end
|
728
845
|
end
|
729
846
|
|
847
|
+
private_class_method :get_pmc
|
848
|
+
|
730
849
|
# Convert a processor type into its equivalent string
|
731
850
|
def self.get_processor_type(num)
|
732
851
|
case num
|
733
852
|
when 1
|
734
|
-
|
853
|
+
'Other'
|
735
854
|
when 2
|
736
|
-
|
855
|
+
'Unknown'
|
737
856
|
when 3
|
738
|
-
|
857
|
+
'Central Processor'
|
739
858
|
when 4
|
740
|
-
|
859
|
+
'Math Processor'
|
741
860
|
when 5
|
742
|
-
|
861
|
+
'DSP Processor'
|
743
862
|
when 6
|
744
|
-
|
745
|
-
else
|
746
|
-
return nil
|
863
|
+
'Video Processor'
|
747
864
|
end
|
748
865
|
end
|
749
866
|
|
867
|
+
private_class_method :get_processor_type
|
868
|
+
|
750
869
|
# Convert an upgrade method into its equivalent string
|
751
870
|
def self.get_upgrade_method(num)
|
752
871
|
case num
|
753
872
|
when 1
|
754
|
-
|
873
|
+
'Other'
|
755
874
|
when 2
|
756
|
-
|
875
|
+
'Unknown'
|
757
876
|
when 3
|
758
|
-
|
877
|
+
'Daughter Board'
|
759
878
|
when 4
|
760
|
-
|
879
|
+
'ZIF Socket'
|
761
880
|
when 5
|
762
|
-
|
881
|
+
'Replacement/Piggy Back'
|
763
882
|
when 6
|
764
|
-
|
883
|
+
'None'
|
765
884
|
when 7
|
766
|
-
|
885
|
+
'LIF Socket'
|
767
886
|
when 8
|
768
|
-
|
887
|
+
'Slot 1'
|
769
888
|
when 9
|
770
|
-
|
889
|
+
'Slot 2'
|
771
890
|
when 10
|
772
|
-
|
891
|
+
'370 Pin Socket'
|
773
892
|
when 11
|
774
|
-
|
893
|
+
'Slot A'
|
775
894
|
when 12
|
776
|
-
|
777
|
-
else
|
778
|
-
return nil
|
895
|
+
'Slot M'
|
779
896
|
end
|
780
897
|
end
|
781
898
|
|
899
|
+
private_class_method :get_upgrade_method
|
900
|
+
|
782
901
|
# Convert return values to voltage cap values (floats)
|
783
902
|
def self.get_voltage_caps(num)
|
784
903
|
case num
|
785
904
|
when 1
|
786
|
-
|
905
|
+
5.0
|
787
906
|
when 2
|
788
|
-
|
907
|
+
3.3
|
789
908
|
when 4
|
790
|
-
|
791
|
-
else
|
792
|
-
return nil
|
909
|
+
2.9
|
793
910
|
end
|
794
911
|
end
|
912
|
+
|
913
|
+
private_class_method :get_voltage_caps
|
795
914
|
end
|
796
915
|
end
|