File Coverage

blib/lib/Sys/Info/Driver/Unknown/Device/CPU.pm
Criterion Covered Total %
statement 21 23 91.3
branch 2 4 50.0
condition 3 5 60.0
subroutine 8 8 100.0
pod 3 3 100.0
total 37 43 86.0


line stmt bran cond sub pod time code
1             package Sys::Info::Driver::Unknown::Device::CPU;
2             $Sys::Info::Driver::Unknown::Device::CPU::VERSION = '0.79';
3 1     1   1167 use strict;
  1         2  
  1         32  
4 1     1   6 use warnings;
  1         2  
  1         45  
5 1     1   5 use vars qw($UP);
  1         2  
  1         40  
6 1     1   6 use base qw(Sys::Info::Driver::Unknown::Device::CPU::Env);
  1         1  
  1         504  
7              
8             BEGIN {
9 1     1   6 local $SIG{__DIE__};
10 1         2 local $@;
11 1         2 my $eok = eval {
12 1         426 require Unix::Processors;
13 1         1280 Unix::Processors->import;
14             };
15 1 50 33     159 $UP = Unix::Processors->new if ! $@ && $eok;
16             }
17              
18       5 1   sub load {}
19       1 1   sub bitness {}
20              
21             sub identify {
22 6     6 1 4034 my $self = shift;
23             $self->{META_DATA} ||= [
24             !$UP ? $self->SUPER::identify(@_) : map {{
25 0         0 processor_id => $_->id, # cpu id 0,1,2,3...
26             data_width => undef,
27             address_width => undef,
28             bus_speed => undef,
29             speed => $_->clock,
30             name => $_->type,
31             family => undef,
32             manufacturer => undef,
33             model => undef,
34             stepping => undef,
35             number_of_cores => $UP->max_physical,
36             number_of_logical_processors => $UP->max_online,
37             L1_cache => undef,
38             flags => undef,
39 6 50 100     31 }} @{ $UP->processors }
  0         0  
40             ];
41 6         17 return $self->_serve_from_cache(wantarray);
42             }
43              
44             1;
45              
46             __END__