File Coverage

blib/lib/Sys/Info/Driver/Unknown/Device/CPU.pm
Criterion Covered Total %
statement 23 25 92.0
branch 2 4 50.0
condition 3 5 60.0
subroutine 8 8 100.0
pod 3 3 100.0
total 39 45 86.6


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