| 1 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 4 | ▶ | use 5.012; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 4 | ▶ | use autodie; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | package Text::Cadenceparser; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 4 | $Text::Cadenceparser::VERSION = '1.12'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 4 | ▶ | use Carp qw/croak carp/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 4 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 4 | ▶ | use constant DEBUG => $ENV{TEXT_CADENCEPARSER_DEBUG}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 4 | ▶ | use constant DEBUG1 => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 4 | $ENV{TEXT_CADENCEPARSER_DEBUG1}; # more verbose debugging info | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 11 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=12 SCAR=28.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 11 | my ( $pkg, %p ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 11 | my $self = bless { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | _msg => {}, # Internal message hash, will store the report results | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | _files_parsed => 0, # Number of files parsed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | %p | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | }, $pkg; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 11 | ▶ | if ( defined $self->{folder} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | # When folder is defined, then we need to produce a synthesis report synopsis | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 3 | $self->{_files_parsed} = $self->_read_logfiles(); # Gather the data | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | # Gather file info for displaying area/power | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | # First check the input parameters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | # Key is required | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 8 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition44%4/9
not defined $self->{"key"} or $self->{"key"} ne "area" and $self->{"key"} ne "active" and $self->{"key"} ne "leakage"
$self->{"key"} ne "area" and $self->{"key"} ne "active" and $self->{"key"} ne "leakage"
$self->{"key"} ne "area" and $self->{"key"} ne "active"
MC/DC0%0/4
not defined $self->{"key"} or $self->{"key"} ne "area" and $self->{"key"} ne "active" and $self->{"key"} ne "leakage"
not defined $self->{"key"}
$self->{"key"} ne "area"
$self->{"key"} ne "active"
$self->{"key"} ne "leakage"
Truth table40%2/5
not(A) or B and C and D
A= not defined $self->{"key"}B= $self->{"key"} ne "area"C= $self->{"key"} ne "active"D= $self->{"key"} ne "leakage"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | !defined $self->{key} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | || ( $self->{key} ne 'area' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | && $self->{key} ne 'active' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | && $self->{key} ne 'leakage' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | croak | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | "'key' is a required input parameter and should be 'area', 'active' or 'leakage'"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | # Threshold not, defaults to 1 if it is not defined | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 8 | ▶ | $self->{threshold} = $self->{threshold} || 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{'threshold'} || 1
MC/DC100%1/1
$self->{'threshold'} || 1
$self->{'threshold'}
Truth table100%2/2
A
A= $self->{'threshold'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | # Sanity check on input files based on the sort key | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 8 | ▶ | if ( $self->{key} eq 'area' && ( !defined $self->{area_rpt} ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"key"} eq "area" and not defined $self->{"area_rpt"}
MC/DC0%0/2
$self->{"key"} eq "area" and not defined $self->{"area_rpt"}
$self->{"key"} eq "area"
not defined $self->{"area_rpt"}
Truth table66%2/3
A and not(B)
A= $self->{"key"} eq "area"B= not defined $self->{"area_rpt"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | croak | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | "Please specify an area report file if you want to sort according to area"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 8 | ▶ | if ( ( $self->{key} eq 'active' || $self->{key} eq 'leakage' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
$self->{"key"} eq "active" || $self->{"key"} eq "leakage" and not defined $self->{"power_rpt"}
$self->{"key"} eq "active" or $self->{"key"} eq "leakage"
MC/DC0%0/3
$self->{"key"} eq "active" || $self->{"key"} eq "leakage" and not defined $self->{"power_rpt"}
$self->{"key"} eq "active"
$self->{"key"} eq "leakage"
not defined $self->{"power_rpt"}
Truth table40%2/5
A or B and not(C)
A= $self->{"key"} eq "active"B= $self->{"key"} eq "leakage"C= not defined $self->{"power_rpt"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | && ( !defined $self->{power_rpt} ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | croak | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | "Please specify a power report file if you want to sort according to power numbers"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | # Read the reports | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 8 | $self->{_files_parsed} = $self->_read_reports(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | # And sort the results | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 7 | $self->_sort_data(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 10 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 2 | ▶ | sub files_parsed { shift->{_files_parsed} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
files_parsed: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 3 | ▶ | sub count { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
count: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 3 | my ( $self, $type ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 3 | my $count = keys %{ $self->{_msg}->{$type} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 3 | return $count; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | sub overview { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
overview: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | my ( $self, $type ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | # Report slack | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | ▶ | if ( $self->{_slack}->{_negative} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | print "ERROR: "; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | foreach my $clock ( keys %{ $self->{_slack} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | ▶ | next if ( $clock eq '_negative' ); # Skip housekeeping variable | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | my $slack = $self->{_slack}->{$clock}->{slack}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | ▶ | my $violators = $self->{_slack}->{$clock}->{violators} || 'no'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{'_slack'}{$clock}{'violators'} || 'no'
MC/DC0%0/1
$self->{'_slack'}{$clock}{'violators'} || 'no'
$self->{'_slack'}{$clock}{'violators'}
Truth table0%0/2
A
A= $self->{'_slack'}{$clock}{'violators'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | say "Clock '$clock' slack is $slack ps. (# $violators nets);"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | say "-------------"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | # Report info/warning/errors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | my @types = ( 'info', 'warning', 'error' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | foreach my $type (@types) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | my $count = keys %{ $self->{_msg}->{$type} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | say "$count '$type' messages found"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | say "-------------"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 36 | ▶ | sub get { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 36 | my ( $self, $type ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 36 | ▶ | return $self->{_msg}->{$type} if ( $type ~~ [qw(info warning error)] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | return $self->{_data}->{root}->{$type}->{total} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 36 | ▶ | if ( $type ~~ [qw(area active leakage)] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 2 | return $self->{$type}; # Enable self-checking of parameters in tests | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | sub list { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
list: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | my ( $self, $type ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | my $messages = $self->get($type); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | ▶ | say "* Detected $type messages:" if ( keys %{$messages} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | foreach my $key ( keys %{$messages} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | $self->_nice_print( $key, $messages->{$key} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 1 | ▶ | sub slack { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
slack: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 1 | my ( $self, $clock ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 1 | return $self->{_slack}->{$clock}->{slack}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 5 | ▶ | sub report { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
report: called CC=12 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 5 | my ( $self, %p ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 5 | my $data = $self->{_data}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | # First report the totals | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 5 | ▶ | say "Total area : " . $self->get('area') . " um2" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | if ( $self->get('area') ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 5 | ▶ | say "Total active : " . $self->get('active') . " mW" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | if ( $self->get('active') ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 5 | ▶ | say "Total leakage: " . $self->get('leakage') . " mW" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | if ( $self->get('leakage') ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 5 | say "% : " . $self->_format_str("Name") . "\tArea\tActive\tLeakage "; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 5 | say " " . $self->_format_str("") . "\t(um2)\t(mW)\t(mW)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 5 | say "----------------------------------------------------------------"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 5 | foreach my $procent ( sort { $b <=> $a } keys %{$data->{detail}} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 30 | foreach my $item ( sort keys %{$data->{detail}->{$procent}} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 234 | my $leaf = $data->{detail}->{$procent}->{$item}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 234 | ▶ | my $area = $leaf->{area} || '--'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$leaf->{'area'} || '--'
MC/DC100%1/1
$leaf->{'area'} || '--'
$leaf->{'area'}
Truth table100%2/2
A
A= $leaf->{'area'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 234 | ▶ | my $active = $leaf->{active} || '--'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$leaf->{'active'} || '--'
MC/DC100%1/1
$leaf->{'active'} || '--'
$leaf->{'active'}
Truth table100%2/2
A
A= $leaf->{'active'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 234 | ▶ | my $leak = $leaf->{leakage} || '--'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$leaf->{'leakage'} || '--'
MC/DC100%1/1
$leaf->{'leakage'} || '--'
$leaf->{'leakage'}
Truth table100%2/2
A
A= $leaf->{'leakage'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | say $self->_format_int($procent) . " : " | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | . $self->_format_str( $leaf->{name} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 234 | . "\t$area\t$active\t$leak"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | # Output formatting in case the value is zero (file not read) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 5 | ▶ | my $stash_area = $data->{stash}->{area} || '--'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$data->{'stash'}{'area'} || '--'
MC/DC100%1/1
$data->{'stash'}{'area'} || '--'
$data->{'stash'}{'area'}
Truth table100%2/2
A
A= $data->{'stash'}{'area'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 5 | ▶ | my $stash_active = $data->{stash}->{active} || '--'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$data->{'stash'}{'active'} || '--'
MC/DC100%1/1
$data->{'stash'}{'active'} || '--'
$data->{'stash'}{'active'}
Truth table100%2/2
A
A= $data->{'stash'}{'active'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 5 | ▶ | my $stash_leakage = $data->{stash}->{leakage} || '--'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$data->{'stash'}{'leakage'} || '--'
MC/DC100%1/1
$data->{'stash'}{'leakage'} || '--'
$data->{'stash'}{'leakage'}
Truth table100%2/2
A
A= $data->{'stash'}{'leakage'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 5 | say $self->_format_int( $data->{stash}->{percent} ) . " : " | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | . $self->_format_str('<other units>') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | . "\t$stash_area\t$stash_active\t$stash_leakage"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 3 | ▶ | sub get_final { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_final: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 3 | my ( $self, $key) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 3 | return $self->{_final}->{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | # Private function to display a single message to STDOUT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | ▶ | sub _nice_print { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_nice_print: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | my ( $self, $key, $message ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | my $count = $message->{count}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | my $msg = $message->{message}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | printf "%s\t%4i %s\n", $key, $count, $msg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | # Internal function to read the logfiles from the source folder and place the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | # messages into the data hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 3 | ▶ | sub _read_logfiles { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_read_logfiles: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 3 | my ( $self, %p ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | # Glob all relevant logfiles (=gather their names) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 3 | my $foldername = $self->{folder}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 3 | ▶ | if ( !-e $foldername ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | croak "Result folder '$foldername' does not exist"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 4 | ▶ | my @files = glob( $foldername . "/*.summary" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 3 | print "Going to parse files from folder '$foldername': \n" . Dumper(@files) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | if DEBUG1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | # Go over the files one by one and extract info | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 3 | foreach my $file (@files) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 6 | $self->_gather_entries($file); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 3 | print "Found: \n" . Dumper( $self->{_msg} ) if DEBUG; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 3 | my @timing_logs = glob( $foldername . "/report_qor_map_*" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | # Go over the files one by one and extract slack info | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 3 | foreach my $file (@timing_logs) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 1 | $self->_gather_slack($file); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 1 | push @files, $file; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 3 | my $final_file = $foldername . "/final.rpt"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 3 | ▶ | if (-e $foldername . "/final.rpt") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 2 | $self->_gather_final($final_file); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 2 | push @files, $final_file; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 3 | return scalar @files; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | # Internal function to read the power/area reports | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 8 | ▶ | sub _read_reports { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_read_reports: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 8 | my ( $self, %p ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 8 | my @files; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 8 | ▶ | push @files, $self->_parse_area() if ( defined $self->{area_rpt} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 8 | ▶ | push @files, $self->_parse_power() if ( defined $self->{power_rpt} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 7 | return @files; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | # Parse the area log report, expecting Encounter RTL compiler file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 6 | ▶ | sub _parse_area { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_area: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 6 | my ( $self, %p ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 6 | my $filename = $self->{area_rpt}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 6 | ▶ | open my $fh, "<", $filename | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | or die "Could not open $filename: $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 6 | say "Parsing area report $filename"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 6 | my $line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | # Skip until we enter the 'data' zone | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 6 | ▶ | while (<$fh>) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 90 | $line = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 90 | ▶ | if ( $line =~ /\-{5}/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 6 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | # Now parse :-) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 6 | my $regexp = '(\w+)\s+\w+\s+\d+\s+(\d+)'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 6 | ▶ | while (<$fh>) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 8496 | $line = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 8496 | ▶ | if ( $line =~ /^$regexp/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | #say "root: $1 \t$2"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 6 | $self->{_data}->{root}->{name} = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 6 | $self->{_data}->{root}->{area}->{total} = $2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 6 | $self->{_data}->{root}->{area}->{sum_leaves} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 8496 | ▶ | if ( $line =~ /^\s\s$regexp/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 654 | my $partial_area = $2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 654 | $self->{_data}->{leaf}->{$1}->{area} = $partial_area; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 654 | $self->{_data}->{root}->{area}->{sum_leaves} += $partial_area; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 6 | close $fh; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 6 | return $filename; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | # Parse the power log report, expecting Encouter output file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 7 | ▶ | sub _parse_power { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_power: called CC=10 SCAR=23.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 7 | my ( $self, %p ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 7 | my $filename = $self->{power_rpt}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 7 | ▶ | open my $fh, "<", $filename | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | or die "Could not open $filename: $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 7 | say "Parsing power report $filename"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 7 | my $line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 7 | my $file_type = 'normal'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | # Skip until we enter the 'data' zone | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 7 | ▶ | while (<$fh>) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 75 | $line = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | # Detect if we're reading a file in normal output mode or in verbose mode | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 75 | ▶ | $file_type = 'verbose' if (/Leakage\s+Internal\s+Net/); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 75 | ▶ | if ( $line =~ /\-{5}/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 6 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | # Now parse :-) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | # Regexp for normal mode parsing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 7 | my $regexp = '(\w+)\s+\w+\s+\d+\s+([0-9]*\.?[0-9]+)\s+([0-9]*\.?[0-9]+)'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | # In case the file is verbose mode output then we need another regexp! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 7 | ▶ | $regexp = '(\w+)\s+\w+\s+\d+\s+([0-9]*\.?[0-9]+)\s+[0-9]*\.?[0-9]+\s+[0-9]*\.?[0-9]+\s+([0-9]*\.?[0-9]+)' if ($file_type eq 'verbose'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 7 | ▶ | while (<$fh>) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 5676 | $line = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 5676 | ▶ | if ( $line =~ /^$regexp/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | # TODO check for same root name here as a test to see if area and power reports match. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | #say "root: $1 \t$2"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 6 | $self->{_data}->{root}->{name} = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 6 | $self->{_data}->{root}->{leakage}->{total} = $2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 6 | $self->{_data}->{root}->{active}->{total} = $3; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 6 | $self->{_data}->{root}->{active}->{sum_leaves} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 5676 | ▶ | if ( $line =~ /^\s\s$regexp/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 442 | $self->{_data}->{leaf}->{$1}->{leakage} = $2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 442 | $self->{_data}->{leaf}->{$1}->{active} = $3; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 442 | $self->{_data}->{root}->{leakage}->{sum_leaves} += $2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 442 | $self->{_data}->{root}->{active}->{sum_leaves} += $3; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 7 | close $fh; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 7 | ▶ | croak "Power input report '$filename' was empty, please check it." if (!defined $self->{_data}->{root}->{active}->{total}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 6 | return $filename; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | # This function gathers the entries from a single logfile and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | # puts them in the $msg hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 6 | ▶ | sub _gather_entries { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_gather_entries: called CC=8 SCAR=20.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 6 | my ( $self, $fname ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 6 | print "Gathering messages in file '$fname'\n" if DEBUG; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 6 | ▶ | open my $fh, '<', $fname | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | or croak "Could not open file '$fname' for reading: $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 6 | my $type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | my $code; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 6 | ▶ | SKIP_HEADER: while (<$fh>) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 28 | ▶ | last if (/-----/); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 6 | ▶ | PARSE_ENTRIES: while ( my $line = <$fh> ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | # Typical line we're looking for looks like this: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | # ' 2 Warning ENC-6 Problems detected during configuration file' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 90 | ▶ | if ( $line =~ /^\s*(\d+)\s(\w+)\s([-\w]+)\s+(.+\S)\s+/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | # When we encounter such line, make a new entry in the message hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 20 | my $count = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 20 | $type = lc($2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 20 | $code = $3; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 20 | my $message = $4; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 20 | print "$count -- $type -- $code -- $message\n" if DEBUG1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 20 | $self->{_msg}->{$type}->{$code}->{message} = $message; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 20 | $self->{_msg}->{$type}->{$code}->{count} = $count; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 20 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 70 | ▶ | if ( $line =~ /\s*(\S.+\S)\s+/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 67 | ▶ | croak "Parsing error: found text before info line in '$fname'" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | if ( !defined $type ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | # Append other lines to the last seen message | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 67 | $self->{_msg}->{$type}->{$code}->{message} .= " $1"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 6 | close $fh; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | # This function gathers the slack entries from a single logfile and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | # puts them in the $msg hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 1 | ▶ | sub _gather_slack { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_gather_slack: called CC=6 SCAR=18.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 1 | my ( $self, $fname ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 1 | print "Gathering messages in file '$fname'\n" if DEBUG; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 1 | ▶ | open my $fh, '<', $fname | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | or croak "Could not open file '$fname' for reading: $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 1 | ▶ | SKIP_HEADER: while (<$fh>) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 24 | ▶ | last if (/Slack/); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | # Skip next line | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 1 | my $line = <$fh>; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | # Next one is the one we need | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 1 | $line = <$fh>; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | # PARSE_ENTRIES: while ( $line = <$fh> ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 1 | ▶ | if ( $line =~ /\w+\s+(\w+)\s+(-?\d+.?\d*)\s+(\d*)\s/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 1 | my $group = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 1 | my $slack = $2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 1 | my $nr_paths = $3; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 1 | $self->{_slack}->{$group}->{slack} = $slack; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 1 | $self->{_slack}->{$group}->{violators} = $nr_paths; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 1 | ▶ | if ( $slack < 0 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 1 | $self->{_slack}->{_negative} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | carp "Warning: could not extract slack information from logfiles"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 1 | close $fh; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | # Extract the information from the final.rpt file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 2 | ▶ | sub _gather_final { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_gather_final: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 2 | my ( $self, $fname ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 2 | print "Gathering messages in file '$fname'\n" if DEBUG; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 2 | ▶ | open my $fh, '<', $fname | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | or croak "Could not open file '$fname' for reading: $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 2 | my $match_col; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | my $line; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | # We want to know in what column the total ('final') data is present. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | # We need to autodetect this because it differes depending on the flow type that was run | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 2 | ▶ | DETECT_COLUMN: while ($line = <$fh>) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 12 | ▶ | if ($line =~ /Metric/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 2 | my @columns = split /\s+/, $line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | # Use an index hash to find what the index is of the column we're looking for | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 2 | my %indhash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 2 | @indhash{@columns} = (0 .. $#columns); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 2 | $match_col = $indhash{'final'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 2 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | # Data begins until next empty line | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 2 | ▶ | FETCH_DATA : while ($line = <$fh>) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 62 | ▶ | if ($line =~ /====/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | # Skip separator lines | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 6 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | } elsif ($line eq "\n") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | # Stop processing on empty line beacuse we need to switch the handling of the data from here on (other format) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 2 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | # Data -> process it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | # First the metric (everything before the :) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 54 | my @data = split /:/, $line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 54 | my $metric = $data[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | # Remove leading spaces in the metric; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 54 | $metric =~ s/^\s+//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | # Then the values | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 54 | my @columns = split /\s+/, $data[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 54 | my $value = $columns[$match_col]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 54 | $self->{_final}->{$metric} = $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | # TODO Check if we need to strip the untis from the metric and put them on another place in the hash. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | # skip 3 lines | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | #$line = <$fh>; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | #$line = <$fh>; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | #$line = <$fh>; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | # TODO Fetch the totals and store them too. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | #PARSE_TOTALS: while ($line = <$fh>) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | # if ($line =~ /^([^:]):\s+(\.+)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | # $self->{_final}->{$1} = $2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | #} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 2 | close $fh; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | # Nicely print a string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 249 | ▶ | sub _format_str { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_format_str: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 249 | my ( $self, $val ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 249 | my $len = $self->{_presentation}->{namelength}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 249 | return sprintf( "%-" . $len . "s", $val ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | # nicely print an int | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 239 | ▶ | sub _format_int { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_format_int: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 239 | my ( $self, $val ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 239 | ▶ | $val = $val || 0; # Catch cases where the val is not initialized | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$val || 0
MC/DC100%1/1
$val || 0
$val
Truth table100%2/2
A
A= $val
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 239 | return sprintf( "%2i", $val ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | # Sort the data according to the passed key | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 7 | ▶ | sub _sort_data { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_sort_data: called CC=14 SCAR=26.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 7 | my ( $self, %p ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 7 | my $key = $self->{key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 7 | my $threshold = $self->{threshold}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 7 | my $total = $self->get($key); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 7 | my $threshold_abs = $total * $threshold / 100; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 7 | ▶ | my $unit = $self->{key} eq 'area' ? 'um2' : 'mW'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 7 | say "Sorting on '$key'"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 7 | $self->{_presentation}->{namelength} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | # Insert an entry for the toplevel so that it get reported if required | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 7 | my ($top_area, $top_active, $top_leakage); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 7 | ▶ | $top_area = $self->{_data}->{root}->{area}->{total} - $self->{_data}->{root}->{area}->{sum_leaves} if (defined $self->{_data}->{root}->{area}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 7 | ▶ | $top_active = $self->{_data}->{root}->{active}->{total} - $self->{_data}->{root}->{active}->{sum_leaves} if (defined $self->{_data}->{root}->{active}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 7 | ▶ | $top_leakage = $self->{_data}->{root}->{leakage}->{total} - $self->{_data}->{root}->{leakage}->{sum_leaves} if (defined $self->{_data}->{root}->{leakage}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | # Ensure the right format is used | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 7 | ▶ | $top_area = sprintf("%d", $top_area) if (defined $top_area); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 7 | ▶ | $top_active = sprintf("%1.3f", $top_active) if (defined $top_active); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 7 | ▶ | $top_leakage = sprintf("%1.3f", $top_leakage) if (defined $top_leakage); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 7 | $self->{_data}->{leaf}->{'toplevel'}->{area} = $top_area; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | 7 | $self->{_data}->{leaf}->{'toplevel'}->{active} = $top_active; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 7 | $self->{_data}->{leaf}->{'toplevel'}->{leakage} = $top_leakage; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 7 | foreach my $entry ( keys %{$self->{_data}->{leaf}} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 558 | my $value = $self->{_data}->{leaf}->{$entry}->{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 558 | my $percentage = $value / $total * 100; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 558 | ▶ | if ( $percentage >= $threshold ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | # Store in the 'to be printed with details' hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 258 | $percentage = int($percentage); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 258 | $self->{_data}->{leaf}->{$entry}->{name} = $entry; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 258 | $self->{_data}->{detail}->{$percentage}->{$entry} = $self->{_data}->{leaf}->{$entry}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | # Update the length of the name for printing later | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 258 | my $namelength = length($entry); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | $self->{_presentation}->{namelength} = $namelength | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 258 | ▶ | if ( $self->{_presentation}->{namelength} < $namelength ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 300 | $self->{_data}->{stash}->{percent} += $percentage; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | $self->{_data}->{stash}->{area} += | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 300 | ▶ | $self->{_data}->{leaf}->{$entry}->{area} || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{'_data'}{'leaf'}{$entry}{'area'} || 0
MC/DC0%0/1
$self->{'_data'}{'leaf'}{$entry}{'area'} || 0
$self->{'_data'}{'leaf'}{$entry}{'area'}
Truth table50%1/2
A
A= $self->{'_data'}{'leaf'}{$entry}{'area'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | $self->{_data}->{stash}->{active} += | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 300 | ▶ | $self->{_data}->{leaf}->{$entry}->{active} || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{'_data'}{'leaf'}{$entry}{'active'} || 0
MC/DC0%0/1
$self->{'_data'}{'leaf'}{$entry}{'active'} || 0
$self->{'_data'}{'leaf'}{$entry}{'active'}
Truth table50%1/2
A
A= $self->{'_data'}{'leaf'}{$entry}{'active'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | $self->{_data}->{stash}->{leakage} += | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 300 | ▶ | $self->{_data}->{leaf}->{$entry}->{leakage} || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{'_data'}{'leaf'}{$entry}{'leakage'} || 0
MC/DC0%0/1
$self->{'_data'}{'leaf'}{$entry}{'leakage'} || 0
$self->{'_data'}{'leaf'}{$entry}{'leakage'}
Truth table50%1/2
A
A= $self->{'_data'}{'leaf'}{$entry}{'leakage'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 4 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | # ABSTRACT: Perl module to parse Cadence synthesis tool logfiles | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||