| 1 | package Lab::Data::Analysis; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | #ABSTRACT: Analyze data from 'Trace' files | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 2 | $Lab::Data::Analysis::VERSION = '3.881'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use v5.20; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use Clone qw(clone); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | # default config values, copied to $self->{CONFIG} initially | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 2 | our $DEFAULT_CONFIG = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | use_ftell => 0, # use ftell/fsetpos for positioning | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | clone_headers => 1, # clone run/file headers into events | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | combined_gpib => 0, # also combine GPIB from all streams | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 2 | our $_DefaultAnalyzer = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 1 => { # order in which to check for match | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | MATCH => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | '(?i)^Lab::Instrument::(TDS|TPS|TBS)(1\d\d\d|2\d\d\d?)(B|C)?::', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | TYPE => 'Lab::Data::Analysis::TekTDS', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | COMMENT => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 'Tektronix TDS/TPS/TBS 1000 and 2000 series, TDS200 series, oscilloscopes' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 2 => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | MATCH => '(?i)^Lab::Instrument::DPO4\d\d\d(A-C)?::', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | TYPE => 'Lab::Data::Analysis::TekDPO', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | COMMENT => 'Tektronix DPO4000 series oscilloscopes', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 3 => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | MATCH => '(?i)^Lab::Instrument::WR\d+::', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | TYPE => 'Lab::Data::Analysis::WaveRunner', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | COMMENT => 'LeCroy WaveRunner series oscilloscopes', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 2 | our $_LOADED = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 1 | ▶ | my $proto = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=6 SCAR=18.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 1 | ▶ | my $class = ref($proto) || $proto; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
ref $proto || $proto
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table33%1/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 1 | my $self = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 1 | bless $self, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 1 | my ( $file, $tail ) = $self->_check_args( \@_, qw(file) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 1 | $self->{FILE} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 1 | $self->{FH} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 1 | $self->{INDEX} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 1 | $self->{CONFIG} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 1 | $self->{FILEHEADER} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 1 | $self->{RUNHEADER} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | # set up the default config variables | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 1 | foreach my $k ( keys( %{$DEFAULT_CONFIG} ) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 3 | $self->{CONFIG}->{$k} = $DEFAULT_CONFIG->{$k}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | # override default config with user-provided parameters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 1 | foreach my $k ( keys( %{$tail} ) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | ▶ | next unless exists $self->{CONFIG}->{$k}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | $self->{CONFIG}->{$k} = $tail->{$k}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 1 | ▶ | $self->open($file) if defined($file); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 1 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | ################ internal routines ######################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | # calling argument parsing; this is an extension of the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | # _check_args and _check_args_strict routines in Instrument.pm, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | # allowing more flexibility in how routines are called. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | # In particular routine(a=>1,b=>2,..) and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | # routine({a=>1,b=>2,..}) can both be used. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | # note: if this code does not properly recognize the syntax, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | # then you have to use the {key=>value...} form. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | # calling: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | # ($par1,$par2,$par3,$tail) = $self->_check_args(\@_,qw(par1 par2 par3)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | # or, for compatibility: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | # ($par1,$par2,$par3,$tail) = $self->_check_args(\@_,[qw(par1 par2 par3)]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | # can also call without the $self-> pointer, since not used. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | sub _check_args { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 10 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check_args: called CC=17 SCAR=29.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 10 | my $args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 10 | ▶ | if ( ref($self) eq 'ARRAY' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 9 | $args = $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 1 | $args = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 10 | my $params = [@_]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 10 | ▶ | $params = $params->[0] if ref( $params->[0] ) eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 10 | my $arguments = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 10 | ▶ | if ( $#{$args} == 0 && ref( $args->[0] ) eq 'HASH' ) { # case 3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$#{$args;} == 0 and ref $args->[0] eq "HASH"
MC/DC0%0/2
$#{$args;} == 0 and ref $args->[0] eq "HASH"
$#{$args;} == 0
ref $args->[0] eq "HASH"
Truth table66%2/3
A and B
A= $#{$args;} == 0B= ref $args->[0] eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | %{$arguments} = ( %{ $args->[0] } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 10 | my $simple = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 10 | ▶ | if ( $#{$args} & 1 == 1 ) { # must have even # arguments | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 8 | my $found = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 8 | ▶ | for ( my $j = 0; $j <= $#{$args}; $j += 2 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 6 | ▶ | if ( ref( $args->[$j] ) ne '' ) { # a ref for a key? no | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | $simple = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 6 | foreach my $p ( @{$params} ) { # named param | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 14 | ▶ | $simple = 0 if $p eq $args->[$j]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 6 | ▶ | if ( exists( $found->{ $args->[$j] } ) ) { # key used 2x? no | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | $simple = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 6 | $found->{ $args->[$j] } = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 10 | ▶ | if ($simple) { # case 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 6 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 6 | my $j = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 6 | foreach my $arg ( @{$args} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 2 | ▶ | if ( defined @{$params}[$i] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 2 | $arguments->{ @{$params}[$i] } = $arg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 2 | $i++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | $arguments->{"_tail$j"} = $arg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | $j++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | else { # case 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 4 | %{$arguments} = ( @{$args} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 10 | my @return_args = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 10 | foreach my $param ( @{$params} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 17 | ▶ | if ( exists $arguments->{$param} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 8 | push( @return_args, $arguments->{$param} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 8 | delete $arguments->{$param}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 9 | push( @return_args, undef ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 10 | push( @return_args, $arguments ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 10 | ▶ | if (wantarray) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 10 | return @return_args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | return $return_args[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | sub _check_args_strict { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check_args_strict: called CC=6 SCAR=19.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 1 | my $args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 1 | ▶ | if ( ref($self) eq 'ARRAY' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 1 | $args = $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | $args = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 1 | my $params = [@_]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 1 | ▶ | $params = $params->[0] if ref( $params->[0] ) eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 1 | my @result = _check_args( $args, $params ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 1 | my $num_params = @result - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 1 | ▶ | for ( my $i = 0; $i < $num_params; ++$i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 1 | ▶ | if ( not defined $result[$i] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | croak("missing mandatory argument '$params->[$i]'"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 1 | ▶ | if (wantarray) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 1 | return @result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | return $result[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | # get file position, make use of CONFIG option | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | sub _tell { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 380 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tell: called CC=3 SCAR=12.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 380 | ▶ | croak("no file open") unless defined $self->{FH}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 380 | ▶ | if ( $self->{CONFIG}->{use_ftell} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | return $self->{FH}->getpos(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 380 | return $self->{FH}->tell(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | # set file absolute position, making use of CONFIG option | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | # ignores any 'whence' parameter | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | sub _seek { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 9 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_seek: called CC=3 SCAR=11.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 9 | my $p = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 9 | ▶ | croak("no file open") unless defined $self->{FH}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 9 | ▶ | if ( $self->{CONFIG}->{use_ftell} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | return $self->{FH}->setpos($p); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 9 | return $self->{FH}->seek( $p, 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | sub open { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
open: called CC=5 SCAR=16.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 1 | my ( $file, $tail ) = _check_args_strict( \@_, 'file' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 1 | ▶ | croak("input file '$file' does not exist") unless -e $file; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 1 | ▶ | croak("input file '$file' not readable") unless -r $file; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 1 | ▶ | $self->{FH}->close() if defined $self->{FH}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 1 | $self->{FH} = IO::File->new( $file, "r" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | croak("unable to open file '$file' for reading") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 1 | ▶ | unless defined $self->{FH}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 1 | $self->{FILE} = $file; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 1 | $self->{FILE_BEGIN} = $self->_tell(); # beginning position | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 1 | $self->{INDEX} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 1 | $self->{FSTAT} = [ ( $self->{FH}->stat() ) ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | sub rewind { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rewind: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | my ($tail) = _check_args( \@_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | ▶ | croak("tracefile not opened") unless defined $self->{FH}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | $self->_seek( $self->{FILE_BEGIN} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | sub MakeIndex { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
MakeIndex: called CC=18 SCAR=29.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 1 | my ($tail) = _check_args( \@_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 1 | my $fh = $self->{FH}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 1 | ▶ | croak("no tracefile opened") unless defined $fh; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 1 | my $iloc = $self->_tell(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 1 | my $p = $self->{FILE_BEGIN}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 1 | $self->_seek($p); # beginning | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 1 | $self->{INDEX} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 1 | $self->{INDEX}->{RUN} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 1 | $self->{INDEX}->{STREAM} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 1 | $self->{RUN} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 1 | $self->{EVENT} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 1 | my $run = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 1 | my $n = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 1 | ▶ | while (<$fh>) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 152 | my $pnext = $self->_tell(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 152 | ▶ | if ( !/^(\d+)(.)(.*)\s*$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | carp("Error parsing trace file at line $n: $_"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | $p = $pnext; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 152 | my $str = $1 + 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 152 | my $cc = $2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 152 | my $rest = eval($3); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 152 | ▶ | if ( !exists( $self->{INDEX}->{STREAM}->{$str} ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 2 | $self->{INDEX}->{STREAM}->{$str} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 2 | $self->{INDEX}->{STREAM}->{$str}->{COMMENT} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 2 | $self->{INDEX}->{STREAM}->{$str}->{NUMBER} = $str; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 152 | ▶ | if ( $cc ne '<' && $cc ne '>' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$cc ne "<" and $cc ne ">"
MC/DC100%2/2
$cc ne "<" and $cc ne ">"
$cc ne "<"
$cc ne ">"
Truth table100%3/3
A and B
A= $cc ne "<"B= $cc ne ">"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 6 | ▶ | if ( $cc eq '*' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 5 | ▶ | if ( $rest =~ /^Lab::[\w\:]+::new\s/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 1 | $self->{INDEX}->{STREAM}->{$str}->{CONNECT} = $rest; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | elsif ( $rest =~ /^start\s+run\s*(\d+)\s*\\?\@\s*([\d\.]+)/i ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 1 | $run = $1 + 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 1 | my $t0 = $2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | carp("duplicate run '$run' at line $n") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 1 | ▶ | if exists $self->{INDEX}->{RUN}->{$run}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 1 | ▶ | if ( !defined( $self->{RUN} ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 1 | $self->{RUN} = $run; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 1 | $self->{EVENT} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 1 | $self->{INDEX}->{RUN}->{$run} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 1 | $self->{INDEX}->{RUN}->{$run}->{POSITION} = $p; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 1 | $self->{INDEX}->{RUN}->{$run}->{STARTTIME} = $t0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 1 | $self->{INDEX}->{RUN}->{$run}->{EVENT} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | elsif ( $rest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | =~ /^event\s*(\d+)\s*run\s*(\d+)\s*\\?\@\s*([\d\.]+)/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 2 | ▶ | carp("event found outside of its run at line $n") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | unless $run == $2 + 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 2 | my $event = $1 + 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 2 | my $te = $3; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | carp("duplicate event '$event', run '$run' at line $n") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | if exists $self->{INDEX}->{RUN}->{$run}->{EVENT} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 2 | ▶ | ->{$event}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 2 | $self->{INDEX}->{RUN}->{$run}->{EVENT}->{$event} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | $self->{INDEX}->{RUN}->{$run}->{EVENT}->{$event} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 2 | ->{POSITION} = $p; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | $self->{INDEX}->{RUN}->{$run}->{EVENT}->{$event}->{TIME} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 2 | = $te; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | elsif ( $rest =~ /^stop\s+run(\d+)\s.*\\?\@\s*([\d\.]+)/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 1 | ▶ | carp("run # mismatch at start/stop at line $n") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | unless $run == $1 + 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 1 | $run = $1 + 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 1 | my $t1 = $2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 1 | $self->{INDEX}->{RUN}->{$run}->{STOPTIME} = $t1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 1 | $run = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | carp( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | "ignoring unknown control sequence at line $n: $rest" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | elsif ( $cc eq '|' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 1 | $self->{INDEX}->{STREAM}->{$str}->{COMMENT}->{$p} = $rest; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | carp("unknown trace control char at line $n\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 152 | $p = $pnext; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 152 | $n++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 1 | $self->_seek($iloc); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | sub PrintIndex { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
PrintIndex: not called CC=20 SCAR=60.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | my ( $print_events, $tail ) = _check_args( \@_, qw(print_events) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | ▶ | if ( !defined( $self->{INDEX} ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | carp "No index generated yet"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | my $dirty = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | foreach my $str ( sort( keys( %{ $self->{INDEX}->{STREAM} } ) ) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | ▶ | next if $str == 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | ▶ | if ( !$dirty ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | print "======= DATA STREAMS ==========\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | $dirty = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | my $text = $self->{INDEX}->{STREAM}->{$str}->{CONNECT}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | $text =~ s/\\"/"/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | my $len = length($text); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | my $j = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | ▶ | while ( $j == 0 || $j < $len ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$j == 0 or $j < $len
MC/DC0%0/2
$j == 0 or $j < $len
$j == 0
$j < $len
Truth table0%0/3
A or B
A= $j == 0B= $j < $len
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | ▶ | print "$str :" if $j == 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | ▶ | print "\t", substr( $text, $j, 64 ) if $j < $len; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | print "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | $j += 64; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | # print "$str\t",$self->{INDEX}->{STREAM}->{$str}->{CONNECT},"\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | my $d2 = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | foreach my $c ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | sort( keys( %{ $self->{INDEX}->{STREAM}->{$str}->{COMMENT} } ) ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | $d2 = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | print "\t", $self->{INDEX}->{STREAM}->{$str}->{COMMENT}->{$c}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | ▶ | print "\n" if $d2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | ▶ | print "\n" if $dirty; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | $dirty = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | foreach my $run ( sort( keys( %{ $self->{INDEX}->{RUN} } ) ) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | ▶ | if ( !$dirty ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | print "======= RUNS ==========\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | $dirty = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 0 | my (@e) = ( keys( %{ $self->{INDEX}->{RUN}->{$run}->{EVENT} } ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 0 | my $t0 = localtime( $self->{INDEX}->{RUN}->{$run}->{STARTTIME} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | my $t1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | $t1 = localtime( $self->{INDEX}->{RUN}->{$run}->{STOPTIME} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | ▶ | if exists( $self->{INDEX}->{RUN}->{$run}->{STOPTIME} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | ▶ | if ( !defined($t1) ) { # use file modification time | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | $t1 = localtime( $self->{FSTAT}->[9] ) . '?'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | printf( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | "RUN %08d :\t% 8d events\t(%s)..(%s)\n", $run, $#e + 1, $t0, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | $t1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | ▶ | if ( defined($print_events) && $print_events ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $print_events and $print_events
MC/DC0%0/2
defined $print_events and $print_events
defined $print_events
$print_events
Truth table0%0/3
A and B
A= defined $print_eventsB= $print_events
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | print "\t EVENT\t FILE POSITION \t TIME\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | foreach my $ev ( sort(@e) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | $t0 = localtime( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 0 | $self->{INDEX}->{RUN}->{$run}->{EVENT}->{$ev}->{TIME} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | my $pos = $self->{INDEX}->{RUN}->{$run}->{EVENT}->{$ev} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | ->{POSITION}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | printf( "\t% 8d\t% 16d\t%s\n", $ev, $pos, $t0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 0 | print "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | ▶ | print "\n" if $dirty; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | sub ReadEvent { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ReadEvent: called CC=52 SCAR=52.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 2 | my ( $stream, $inrun, $inevent, $tail ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | = _check_args( \@_, qw(stream run event) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | # turn stream selection into an array ref, however passed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 2 | my $streams = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 2 | ▶ | if ( defined($stream) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | ▶ | if ( ref($stream) eq '' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | $stream = [$stream]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 0 | foreach my $s ( @{$stream} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | $streams->{$s} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | $streams->{0} = 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | ▶ | unless exists( $tail->{no_global} ) && !$tail->{no_global}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $tail->{"no_global"} and not $tail->{"no_global"}
MC/DC0%0/2
exists $tail->{"no_global"} and not $tail->{"no_global"}
exists $tail->{"no_global"}
not $tail->{"no_global"}
Truth table0%0/3
A and not(B)
A= exists $tail->{"no_global"}B= not $tail->{"no_global"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 2 | my $fh = $self->{FH}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 2 | ▶ | croak("data file is not open") unless defined $fh; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 2 | ▶ | if ( defined($inrun) || defined($inevent) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $inrun or defined $inevent
MC/DC50%1/2
defined $inrun or defined $inevent
defined $inrun
defined $inevent
Truth table66%2/3
A or B
A= defined $inrunB= defined $inevent
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | return undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | unless | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 1 | ▶ | defined( $self->FindEvent( run => $inrun, event => $inevent ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 2 | my $p = $self->_tell(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | my $ev = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | GPIB => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | COMMENT => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | STREAM => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | FILEHEADER => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | RUNHEADER => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 2 | CONFIG => clone( $self->{CONFIG} ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 2 | ▶ | if ( !defined( $self->{INDEX} ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 1 | my $inevent = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 1 | ▶ | while (<$fh>) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 116 | chomp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 116 | my $pnext = $self->_tell(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 116 | ▶ | if ( !/^(\d+)(.)(.*)\s*$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | carp("Error parsing trace file: $_"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | $p = $pnext; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 116 | my $str = $1 + 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 116 | my $cc = $2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 116 | my $rest = eval($3); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 116 | ▶ | if ( $cc eq '*' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 4 | ▶ | if ( $rest =~ /^Lab::[\w\:]+::new\s/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | elsif ( $rest =~ /^start\s+run\s*(\d+)\s*\\?\@\s*([\d\.]+)/i ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 1 | ▶ | last if $inevent; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | elsif ( $rest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | =~ /^event\s*(\d+)\s*run\s*(\d+)\s*\\?\@\s*([\d\.]+)/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 2 | ▶ | last if $inevent; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 1 | $inevent = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 1 | $ev->{EVENT} = $1 + 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 1 | $ev->{RUN} = $2 + 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 1 | $ev->{TIME} = $3; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 1 | $ev->{POSITION} = $p; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 1 | ▶ | if ( $self->{CONFIG}->{clone_headers} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | $ev->{FILEHEADER} = clone( $self->{FILEHEADER} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 1 | ▶ | if defined $self->{FILEHEADER}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | $ev->{RUNHEADER} = clone( $self->{RUNHEADER} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 1 | ▶ | if defined $self->{RUNHEADER}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | elsif ( $rest =~ /^stop\s+run(\d+)\s.*\\?\@\s*([\d\.]+)/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 0 | ▶ | last if $inevent; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 0 | carp("ignoring unknown control sequence: $rest"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | elsif ( $cc eq '|' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 1 | ▶ | if ( $inevent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition16%1/6
$inevent and !defined($stream) || exists $streams->{$str}
not defined $stream or exists $streams->{$str}
MC/DC0%0/3
$inevent and !defined($stream) || exists $streams->{$str}
$inevent
not defined $stream
exists $streams->{$str}
Truth table25%1/4
A and not(B) or C
A= $ineventB= not defined $streamC= exists $streams->{$str}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | && ( !defined($stream) || exists( $streams->{$str} ) ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 0 | push( @{ $ev->{COMMENT} }, $rest ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | $ev->{STREAM}->{$str} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | COMMENT => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | GPIB => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | NUMBER => $str, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | CONFIG => clone( $self->{CONFIG} ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 0 | ▶ | } unless exists $ev->{STREAM}->{$str}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | push( @{ $ev->{STREAM}->{$str}->{COMMENT} }, $rest ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | ▶ | elsif ( $cc eq '<' || $cc eq '>' ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$cc eq "<" or $cc eq ">"
MC/DC0%0/2
$cc eq "<" or $cc eq ">"
$cc eq "<"
$cc eq ">"
Truth table66%2/3
A or B
A= $cc eq "<"B= $cc eq ">"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 111 | ▶ | if ( $inevent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
$inevent and !defined($stream) || exists $streams->{$str}
not defined $stream or exists $streams->{$str}
MC/DC0%0/3
$inevent and !defined($stream) || exists $streams->{$str}
$inevent
not defined $stream
exists $streams->{$str}
Truth table25%1/4
A and not(B) or C
A= $ineventB= not defined $streamC= exists $streams->{$str}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | && ( !defined($stream) || exists( $streams->{$str} ) ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 0 | push( @{ $ev->{GPIB} }, $cc . $rest ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 21 | ▶ | if $self->{CONFIG}->{combine_gpib}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | $ev->{STREAM}->{$str} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | COMMENT => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | GPIB => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | NUMBER => $str, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | CONFIG => clone( $self->{CONFIG} ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 21 | ▶ | } unless exists $ev->{STREAM}->{$str}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 21 | push( @{ $ev->{STREAM}->{$str}->{GPIB} }, $cc . $rest ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | carp("unknown trace control char '$cc'\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 115 | $p = $pnext; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 1 | ▶ | return undef unless $inevent; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 1 | $self->_seek($p); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 1 | $self->{RUN} = $ev->{RUN}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 1 | $self->{EVENT} = $ev->{EVENT}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 1 | my $run = $self->{RUN}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 1 | my $event = $self->{EVENT} + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 1 | ▶ | return undef unless exists $self->{INDEX}->{RUN}->{$run}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | return undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 1 | ▶ | unless exists $self->{INDEX}->{RUN}->{$run}->{EVENT}->{$event}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | my $pev | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | 1 | = $self->{INDEX}->{RUN}->{$run}->{EVENT}->{$event}->{POSITION}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 1 | $ev->{RUN} = $run; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 1 | $ev->{EVENT} = $self->{EVENT} = $event; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 1 | $ev->{POSITION} = $pev; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | $ev->{TIME} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 1 | = $self->{INDEX}->{RUN}->{$run}->{EVENT}->{$event}->{TIME}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 1 | $ev->{STREAM} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 1 | $ev->{GPIB} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 1 | $ev->{COMMENT} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 1 | $ev->{CONFIG} = clone( $self->{CONFIG} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 1 | ▶ | if ( $self->{CONFIG}->{clone_headers} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | $ev->{FILEHEADER} = clone( $self->{FILEHEADER} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 1 | ▶ | if defined $self->{FILEHEADER}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | $ev->{RUNHEADER} = clone( $self->{RUNHEADER} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 1 | ▶ | if defined $self->{RUNHEADER}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 1 | $self->_seek($pev); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 1 | my $foo = <$fh>; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 1 | my $p; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 1 | ▶ | while (<$fh>) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 22 | $p = $self->_tell(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 22 | ▶ | if ( !/^(\d+)(.)(.*)\s*$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 0 | carp("Error parsing trace file at line : $_"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 22 | my $str = $1 + 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 22 | my $cc = $2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 22 | my $rest = eval($3); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 22 | ▶ | last if $cc eq '*'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | 21 | ▶ | next unless !defined($stream) || exists( $streams->{$str} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $stream or exists $streams->{$str}
MC/DC0%0/2
not defined $stream or exists $streams->{$str}
not defined $stream
exists $streams->{$str}
Truth table33%1/3
not(A) or B
A= not defined $streamB= exists $streams->{$str}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | $ev->{STREAM}->{$str} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | COMMENT => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | GPIB => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | NUMBER => $str, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | CONFIG => clone( $self->{CONFIG} ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 21 | ▶ | } unless exists $ev->{STREAM}->{$str}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 21 | ▶ | if ( $cc eq '|' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 0 | push( @{ $ev->{COMMENT} }, $rest ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 0 | push( @{ $ev->{STREAM}->{$str}->{COMMENT} }, $rest ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | ▶ | elsif ( $cc eq '>' || $cc eq '<' ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$cc eq ">" or $cc eq "<"
MC/DC0%0/2
$cc eq ">" or $cc eq "<"
$cc eq ">"
$cc eq "<"
Truth table66%2/3
A or B
A= $cc eq ">"B= $cc eq "<"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 0 | push( @{ $ev->{GPIB} }, $cc . $rest ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 21 | ▶ | if $self->{CONFIG}->{combine_gpib}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 21 | push( @{ $ev->{STREAM}->{$str}->{GPIB} }, $cc . $rest ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 0 | carp("unknown trace control char '$cc'\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 2 | $self->_seek($p); # position at start of next event/control line | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | 2 | return $ev; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | sub ReadFileHeader { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ReadFileHeader: called CC=16 SCAR=30.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 1 | my ( $in, $tail ) = _check_args( \@_, 'shift' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | 1 | my $fh = $self->{FH}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 1 | ▶ | croak("No trace file open") unless defined $fh; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | 1 | my $shift = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 1 | ▶ | if ( defined($in) && $in =~ /^\s*(Y|T|[1-9])/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $in and $in =~ /^\s*(Y|T|[1-9])/iu
MC/DC0%0/2
defined $in and $in =~ /^\s*(Y|T|[1-9])/iu
defined $in
$in =~ /^\s*(Y|T|[1-9])/iu
Truth table33%1/3
A and B
A= defined $inB= $in =~ /^\s*(Y|T|[1-9])/iu
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 0 | $shift = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | 1 | $self->{FILEHEADER} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | 1 | my $ipos = $self->_tell(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | 1 | my $p = $self->{FILE_BEGIN}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | 1 | $self->_seek($p); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | 1 | my $hdr = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | 1 | $hdr->{POSITION} = $p; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 1 | $hdr->{STREAM} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | 1 | ▶ | while (<$fh>) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | 85 | my $pnext = $self->_tell(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | 85 | ▶ | if ( !/^(\d+)(.)(.*)\s*$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | 0 | carp("Error parsing trace file : $_"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 0 | $p = $pnext; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | 85 | my $str = $1 + 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 85 | my $cc = $2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 85 | my $rest = eval($3); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | $hdr->{STREAM}->{$str} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | COMMENT => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | GPIB => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | NUMBER => $str, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | CONNECT => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | 85 | ▶ | } unless exists $hdr->{STREAM}->{$str}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 85 | ▶ | if ( $cc eq '*' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | 2 | ▶ | last if $rest =~ /^start\s+run/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 1 | ▶ | last if $rest =~ /^event/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 1 | ▶ | last if $rest =~ /^stop/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | 1 | ▶ | if ( $rest =~ /^Lab::/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | 1 | $hdr->{STREAM}->{$str}->{CONNECT} = $rest; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 0 | carp("ignoring unknown control sequence: $rest"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | elsif ( $cc eq '|' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 1 | push( @{ $hdr->{STREAM}->{$str}->{COMMENT} }, $rest ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | ▶ | elsif ( $cc eq '<' || $cc eq '>' ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$cc eq "<" or $cc eq ">"
MC/DC0%0/2
$cc eq "<" or $cc eq ">"
$cc eq "<"
$cc eq ">"
Truth table66%2/3
A or B
A= $cc eq "<"B= $cc eq ">"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 82 | push( @{ $hdr->{STREAM}->{$str}->{GPIB} }, $cc . $rest ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | 0 | carp("unknown trace control char '$cc' at line\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | 84 | $p = $pnext; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | 1 | ▶ | if ($shift) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | 0 | $self->_seek($p); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | 1 | $self->_seek($ipos); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 1 | $self->{FILEHEADER} = $hdr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | 1 | return $hdr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | sub ReadRunHeader { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ReadRunHeader: not called CC=22 SCAR=62.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | 0 | my ( $selrun, $tail ) = _check_args( \@_, qw(run) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | 0 | my $fh = $self->{FH}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | 0 | ▶ | croak("no tracefile opened") unless defined $fh; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 0 | my $hdr = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | STREAM => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 0 | my $ipos = $self->_tell(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | 0 | ▶ | if ( defined( $self->{INDEX} ) && defined($selrun) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $self->{"INDEX"} and defined $selrun
MC/DC0%0/2
defined $self->{"INDEX"} and defined $selrun
defined $self->{"INDEX"}
defined $selrun
Truth table0%0/3
A and B
A= defined $self->{"INDEX"}B= defined $selrun
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 0 | ▶ | if ( exists( $self->{INDEX}->{RUN}->{$selrun} ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 0 | $self->_seek( $self->{INDEX}->{RUN}->{$selrun}->{POSITION} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | 0 | $self->{RUN} = $selrun; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | 0 | my $p = $ipos; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | 0 | my $foundrun = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | 0 | ▶ | while (<$fh>) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 0 | my $pnext = $self->_tell(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | 0 | ▶ | if ( !/^(\d+)(.)(.*)\s*$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | 0 | carp("Error parsing trace file : $_"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | 0 | my $str = $1 + 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 0 | my $cc = $2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | 0 | my $rest = eval($3); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | 0 | ▶ | if ( $cc eq '*' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | 0 | ▶ | if ( $rest =~ /^start\s+run\s*(\d+)\s*\\?\@\s*([\d\.]+)/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | 0 | my $run = $1 + 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | 0 | ▶ | if ( !defined($selrun) || $selrun == $run ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $selrun or $selrun == $run
MC/DC0%0/2
not defined $selrun or $selrun == $run
not defined $selrun
$selrun == $run
Truth table0%0/3
not(A) or B
A= not defined $selrunB= $selrun == $run
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | 0 | $foundrun = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | 0 | $self->{RUN} = $run; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | 0 | $p = $pnext; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | 0 | ▶ | if ( !$foundrun ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | 0 | $self->_seek($ipos); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | 0 | $self->_seek($p); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | 0 | my $p = $self->_tell(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | 0 | ▶ | while (<$fh>) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | 0 | my $pnext = $self->_tell(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | 0 | ▶ | if ( !/^(\d+)(.)(.*)\s*$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | 0 | carp("Error parsing trace file: $_"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | 0 | my $str = $1 + 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | 0 | my $cc = $2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | 0 | my $rest = eval($3); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | $hdr->{STREAM}->{$str} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | COMMENT => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | GPIB => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | NUMBER => $str, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | 0 | ▶ | } unless exists $hdr->{STREAM}->{$str}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 0 | ▶ | if ( $cc eq '*' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | 0 | ▶ | if ( $rest =~ /^start\s+run\s*(\d+)\s*\\?\@\s*([\d\.]+)/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | 0 | my $run = $1 + 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | 0 | ▶ | last if $self->{RUN} != $run; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | 0 | $hdr->{RUN} = $run; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | 0 | $hdr->{POSITION} = $p; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | 0 | $hdr->{STARTTIME} = $2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | elsif ( $rest =~ /^(event|stop|Lab::)/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | 0 | carp("ignoring unknown control sequence : $rest"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | elsif ( $cc eq '|' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | 0 | push( @{ $hdr->{STREAM}->{$str}->{COMMENT} }, $rest ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | ▶ | elsif ( $cc eq '>' || $cc eq '<' ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$cc eq ">" or $cc eq "<"
MC/DC0%0/2
$cc eq ">" or $cc eq "<"
$cc eq ">"
$cc eq "<"
Truth table0%0/3
A or B
A= $cc eq ">"B= $cc eq "<"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | 0 | push( @{ $hdr->{STREAM}->{$str}->{GPIB} }, $cc . $rest ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | 0 | carp("unknown trace control char '$cc'\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | 0 | $p = $pnext; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | 0 | $self->_seek($p); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | 0 | $self->{RUNHEADER} = $hdr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | 0 | return $hdr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | sub FindEvent { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
FindEvent: called CC=38 SCAR=68.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | 1 | my ( $run, $event, $tail ) = _check_args( \@_, 'run', 'event' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | 1 | ▶ | if ( !defined($run) || $run <= 0 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $run or $run <= 0
MC/DC0%0/2
not defined $run or $run <= 0
not defined $run
$run <= 0
Truth table33%1/3
not(A) or B
A= not defined $runB= $run <= 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | 0 | $run = $self->{RUN}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | 1 | ▶ | if ( !defined($run) || $run <= 0 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $run or $run <= 0
MC/DC0%0/2
not defined $run or $run <= 0
not defined $run
$run <= 0
Truth table33%1/3
not(A) or B
A= not defined $runB= $run <= 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | 0 | carp("invalid run (undef? <=0?)"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | 1 | ▶ | if ( exists( $self->{INDEX} ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | 1 | ▶ | return undef unless exists $self->{INDEX}->{RUN}->{$run}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | my (@ev) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | 1 | = ( sort( keys( %{ $self->{INDEX}->{RUN}->{$run}->{EVENT} } ) ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | 1 | ▶ | if ( !defined($event) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | 0 | ▶ | if ( defined( $self->{EVENT} ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | 0 | $event = $self->{EVENT} + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | 0 | $event = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | 1 | ▶ | if ( $event == 0 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | 0 | $event = $ev[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | elsif ( $event < 0 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | 0 | $event = $ev[$event]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | return undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | 1 | ▶ | unless exists $self->{INDEX}->{RUN}->{$run}->{EVENT}->{$event}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | 1 | my $p = $self->{INDEX}->{RUN}->{$run}->{EVENT}->{$event}->{POSITION}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | 1 | $self->_seek($p); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | 1 | return $p; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | 0 | my $fh = $self->{FH}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | 0 | ▶ | croak("no file opened") unless defined $fh; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | 0 | my $p = $self->_tell(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | 0 | my $pstart = $p; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | 0 | my $foundrun = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | 0 | my $foundevent = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | 0 | my $wrapped = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | 0 | ▶ | if ( !defined($event) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | 0 | ▶ | if ( defined( $self->{EVENT} ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | 0 | $event = $self->{EVENT} + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | 0 | $event = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | 0 | ▶ | $event = 0 if $event < 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | 0 | ▶ | while ( !$wrapped ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | 0 | ▶ | while (<$fh>) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | 0 | my $pnext = $self->_tell(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | 0 | ▶ | last if $pnext == $pstart; # wrapped the file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | 0 | ▶ | if ( !/^(\d+)(.)(.*)\s*$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | 0 | carp("Error parsing trace file: $_"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | 0 | my $str = $1 + 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | 0 | my $cc = $2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | 0 | my $rest = eval($3); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | 0 | ▶ | if ( $cc eq '*' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | 0 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | $rest =~ /^start\s+run\s*(\d+)\s*\\?\@\s*([\d\.]+)/i ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | 0 | my $gotrun = $1 + 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | 0 | ▶ | if ( $foundrun && ( $gotrun != $run ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$foundrun and $gotrun != $run
MC/DC0%0/2
$foundrun and $gotrun != $run
$foundrun
$gotrun != $run
Truth table0%0/3
A and B
A= $foundrunB= $gotrun != $run
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | { # ran off the end of desired run, wrap | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | 0 | $foundrun = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | 0 | $foundrun = ( $gotrun == $run ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | elsif ( $rest =~ /^event\s*(\d+)\s*run\s*(\d+)/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | 0 | my $gotev = $1 + 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | 0 | my $gotrun = $2 + 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | 0 | ▶ | if ( $foundrun && ( $gotrun != $run ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$foundrun and $gotrun != $run
MC/DC0%0/2
$foundrun and $gotrun != $run
$foundrun
$gotrun != $run
Truth table0%0/3
A and B
A= $foundrunB= $gotrun != $run
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | { # ran off the end of desired run, wrap | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | 0 | $foundrun = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | 0 | $foundrun = ( $gotrun == $run ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | 0 | ▶ | if ($foundrun) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | 0 | ▶ | $foundevent = 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$event == 0 or $event == $gotev
MC/DC0%0/2
$event == 0 or $event == $gotev
$event == 0
$event == $gotev
Truth table0%0/3
A or B
A= $event == 0B= $event == $gotev
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | if $event == 0 || $event == $gotev; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | 0 | ▶ | last if $foundevent; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | elsif ( $rest =~ /^stop\s+run\s*(\d+)/i ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | 0 | my $gotrun = $1 + 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | 0 | ▶ | if ($foundrun) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | { # ran off the end of desired run, wrap | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | 0 | $foundrun = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | 0 | last; # wrap the file | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | 0 | $p = $pnext; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | 0 | ▶ | last if $wrapped; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | 0 | ▶ | last if $foundrun && $foundevent; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$foundrun and $foundevent
MC/DC0%0/2
$foundrun and $foundevent
$foundrun
$foundevent
Truth table0%0/3
A and B
A= $foundrunB= $foundevent
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | 0 | $wrapped = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | 0 | $p = $self->{FILE_BEGIN}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | 0 | $self->_seek($p); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | 0 | ▶ | if ( !$foundrun || !$foundevent ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$foundrun and $foundevent
MC/DC0%0/2
$foundrun and $foundevent
$foundrun
$foundevent
Truth table0%0/3
A and B
A= $foundrunB= $foundevent
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | 0 | $self->_seek($pstart); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | 0 | $self->{RUN} = $run; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | 0 | $self->{EVENT} = $event; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | 0 | $self->_seek($p); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | 0 | return $p; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | sub PrintDefaultAnalyzer { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
PrintDefaultAnalyzer: not called CC=14 SCAR=53.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | 0 | my ( $in, $tail ) = _check_args( \@_, 'stream' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | 0 | my $stream; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | 0 | ▶ | if ( defined($in) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | 0 | $stream = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | 0 | ▶ | if ( ref($in) eq 'ARRAY' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | 0 | $stream->{$in} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | elsif ( ref($in) eq '' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | 0 | $stream->{$in} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | 0 | foreach my $k ( keys( %{$tail} ) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | 0 | ▶ | next unless $k =~ /^_tail\d+$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | 0 | $stream->{ $tail->{$k} } = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | 0 | croak("parameter type mismatch"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | 0 | ▶ | $self->ReadFileHeader() unless defined $self->{FILEHEADER}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | 0 | my $dirty = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | 0 | foreach my $s ( sort( keys( %{ $self->{FILEHEADER}->{STREAM} } ) ) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | 0 | ▶ | next if $s == 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | 0 | ▶ | next if defined($stream) && !exists( $stream->{$s} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $stream and not exists $stream->{$s}
MC/DC0%0/2
defined $stream and not exists $stream->{$s}
defined $stream
not exists $stream->{$s}
Truth table0%0/3
A and not(B)
A= defined $streamB= not exists $stream->{$s}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | 0 | my $aType = $self->_findDefAnalyzer($s); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | 0 | ▶ | next unless defined $aType; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | 0 | ▶ | print "Stream\tAnalyzer\n" unless $dirty; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | 0 | $dirty = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | 0 | print " $s \t$aType\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | 0 | ▶ | print "\n" if $dirty; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | sub ConnectAnalyzer { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ConnectAnalyzer: called CC=16 SCAR=35.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | 1 | my ( $instr, $inmod, $tail ) = _check_args( \@_, qw(stream module) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | 1 | ▶ | $self->ReadFileHeader() unless defined $self->{FILEHEADER}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | 1 | foreach my $str ( keys( %{ $self->{FILEHEADER}->{STREAM} } ) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | 2 | ▶ | next if $str == 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | 1 | ▶ | if ( !defined($instr) || $instr == $str ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $instr or $instr == $str
MC/DC0%0/2
not defined $instr or $instr == $str
not defined $instr
$instr == $str
Truth table33%1/3
not(A) or B
A= not defined $instrB= $instr == $str
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | 1 | my $defmod = $self->_findDefAnalyzer($str); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | 1 | ▶ | if ( defined($inmod) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | 0 | ▶ | if ( $inmod !~ /::/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
not $inmod =~ /::/u || -e "$inmod.pm" and defined $defmod and $defmod =~ /::$inmod$/u
not $inmod =~ /::/u || -e "$inmod.pm" and defined $defmod
$inmod =~ /::/u || -e "$inmod.pm"
MC/DC0%0/4
not $inmod =~ /::/u || -e "$inmod.pm" and defined $defmod and $defmod =~ /::$inmod$/u
$inmod =~ /::/u
-e "$inmod.pm"
defined $defmod
$defmod =~ /::$inmod$/u
Truth table0%0/5
not(A || B) and C and D
A= $inmod =~ /::/uB= -e "$inmod.pm"C= defined $defmodD= $defmod =~ /::$inmod$/u
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | && !-e "$inmod.pm" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | && defined($defmod) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | && $defmod =~ /::${inmod}$/ ) { # default short name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | 0 | $inmod = $defmod; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | 1 | $inmod = $self->_findDefAnalyzer($str); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | 1 | ▶ | if ( !defined($inmod) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | 0 | carp("No analysis module defined for stream $str"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | 1 | ▶ | if ( !exists( $_LOADED->{$inmod} ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | 1 | ▶ | eval("use $inmod;"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | 1 | ▶ | croak($@) if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | 1 | $_LOADED->{$inmod} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | 1 | my $strhdr = $self->{FILEHEADER}->{STREAM}->{$str}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | $self->{FILEHEADER}->{STREAM}->{$str}->{ANALYSIS} = [] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | unless | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | 1 | ▶ | exists $self->{FILEHEADER}->{STREAM}->{$str}->{ANALYSIS}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | 1 | my $a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | 1 | eval( '$a = ' . $inmod . '->new(stream=>$strhdr);' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | 1 | ▶ | croak("error connecting analyzer $inmod") unless defined $a; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | push( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | 1 | @{ $self->{FILEHEADER}->{STREAM}->{$str}->{ANALYSIS} }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | $a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | sub _findDefAnalyzer { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_findDefAnalyzer: called CC=6 SCAR=18.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | 2 | my $str = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | 2 | ▶ | return undef if $str == 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | 2 | ▶ | $self->ReadFileHeader() unless defined $self->{FILEHEADER}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | 2 | ▶ | return undef unless exists $self->{FILEHEADER}->{STREAM}->{$str}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | 2 | my $con = $self->{FILEHEADER}->{STREAM}->{$str}->{CONNECT}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | 2 | foreach my $aNum ( sort( keys( %{$_DefaultAnalyzer} ) ) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | 2 | my $aMatch = $_DefaultAnalyzer->{$aNum}->{MATCH}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | 2 | ▶ | next unless $con =~ /$aMatch/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | 2 | my $aType = $_DefaultAnalyzer->{$aNum}->{TYPE}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | 2 | return $aType; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | sub Analyze { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Analyze: called CC=19 SCAR=44.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | 1 | my ( $event, $opts, $str, $tail ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | = _check_args( \@_, 'event', 'options', 'stream' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | 1 | ▶ | if ( !defined($event) || ref($event) ne 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $event or ref $event ne "HASH"
MC/DC0%0/2
not defined $event or ref $event ne "HASH"
not defined $event
ref $event ne "HASH"
Truth table33%1/3
not(A) or B
A= not defined $eventB= ref $event ne "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | 0 | carp("bad/missing event"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | 1 | ▶ | return undef unless exists $self->{FILEHEADER}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | 1 | ▶ | return undef unless exists $self->{FILEHEADER}->{STREAM}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | 1 | ▶ | $opts = {} unless defined $opts; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | 1 | my $stream; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | 1 | ▶ | if ( defined($str) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | 0 | ▶ | if ( ref($str) eq 'ARRAY' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | 0 | $stream = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | 0 | foreach my $s ( @{$str} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | 0 | $stream->{$s} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | elsif ( ref($str) eq '' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1063 | 0 | $stream = { $str => 1 }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | 0 | foreach my $k ( sort( keys( %{$tail} ) ) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | 0 | ▶ | next unless $k =~ /^_tail\d+/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | 0 | ▶ | next unless $tail->{$k} =~ /^\d+$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | 0 | $stream->{ $tail->{$k} } = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | 0 | delete( $tail->{$k} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1069 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1070 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1071 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | 0 | carp("bad stream parameter"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1076 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | # scan through the streams, skipping ones we don't analyze | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1079 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | 1 | foreach my $s ( sort( keys( %{ $self->{FILEHEADER}->{STREAM} } ) ) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | 2 | ▶ | if ( !defined($stream) || exists( $stream->{$s} ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $stream or exists $stream->{$s}
MC/DC0%0/2
not defined $stream or exists $stream->{$s}
not defined $stream
exists $stream->{$s}
Truth table33%1/3
not(A) or B
A= not defined $streamB= exists $stream->{$s}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1082 | next | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1083 | 2 | ▶ | unless exists $self->{FILEHEADER}->{STREAM}->{$s}->{ANALYSIS}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1084 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | # if multiple analyses are connected, do them in sequence | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1087 | 1 | foreach | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1088 | 1 | my $a ( @{ $self->{FILEHEADER}->{STREAM}->{$s}->{ANALYSIS} } ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1089 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1090 | 1 | $event = $a->Analyze( $event, $opts ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1091 | 1 | ▶ | if ( !defined($event) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1092 | 0 | carp( "Stream $s analysis " . ref($a) . " failed" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1093 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1094 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1095 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1096 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1097 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1098 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1099 | 1 | return $event; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1100 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1102 | 2 | 1; # End of Lab::Data::Analysis | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1104 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1106 | =pod | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1108 | =encoding UTF-8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1110 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1112 | Lab::Data::Analysis - Analyze data from 'Trace' files | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1113 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1114 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1116 | version 3.881 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1118 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1120 | use Lab::Data::Analysis; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1122 | my $t = Lab::Data::Analysis->new(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1124 | $t->open($tracefile); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1126 | RANDOM ACCESS: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1128 | $t->MakeIndex(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1129 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1130 | $t->PrintIndex(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1131 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1132 | my $fhdr = $t->ReadFileHeader(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1134 | my $rhdr = $t->ReadRunHeader(run=>3); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1136 | my $ev = $t->ReadEvent(run=>3, event=>77); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1137 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1139 | ... do analysis... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1140 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1142 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1143 | SEQUENTIAL: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1145 | my $fhdr = $t->ReadFileHeader(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1146 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1147 | while (defined($rhdr = $t->ReadRunHeader()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1148 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1149 | print "Run: ",$rhdr->{RUN},"\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1151 | while (defined($ev = $t->ReadEvent()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1153 | print "Event: ", $ev->{EVENT}, "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1155 | do analysis... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1156 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1157 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1159 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1160 | Note that "random access" and "sequential" can be mixed, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1161 | if you keep track of the file position. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1163 | =head1 SUBROUTINES/METHODS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1165 | =head2 new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1166 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1167 | my $t = Lab::Data::Analysis->new(); # do 'open' later | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1168 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1169 | my $t = Lab::Data::Analysis->new($tracefile); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1170 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1171 | my $t = Lab::Data::Analysis->new( file => $tracefile, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1172 | ...options ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1173 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1174 | =head2 open | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1176 | $t->open($file); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1178 | $t->open(file=>$file, ...); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1179 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1180 | Open a trace file for reading. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1182 | =head2 rewind | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1183 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1184 | $t->rewind(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1186 | Position to beginning of file for sequential access. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1187 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1188 | Not sure that this is really needed: ReadFileHeader() automatically | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1189 | goes to the beginning of the file; ReadRunHeader(run=>firstrun) should | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1190 | read the header of the first run in the file, and leave the file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1191 | positioned to start reading events. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1193 | =head2 MakeIndex | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1194 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1195 | $t->MakeIndex(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1197 | Compile an index of Runs/Events in a tracefile, for later use. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1199 | Be warned: this may take some time for large files. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1201 | =head2 PrintIndex | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1202 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1203 | $t->PrintIndex(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1204 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1205 | Print an index of the tracefile, showing locations of runs/events, etc. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1207 | =head2 ReadEvent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1208 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1209 | my $event = $t->ReadEvent(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1210 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1211 | my $event = $t->ReadEvent($stream); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1212 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1213 | my $event = $t->ReadEvent([$stream1[, $stream2...]]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1214 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1215 | my $event = $t->ReadEvent(stream=>$stream); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1216 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1217 | my $event = $t->ReadEvent(stream=>[$stream1[,$stream2...]]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1218 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1219 | Also can use a no_global=>1 option to exclude the 'global' (stream=0) stream, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1220 | which just has comments. Adding run=>$run, event=>$event parameters causes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1221 | FindEvent(run=>..., event=>...) to be called before reading the event. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1223 | Read an event, starting at the current file position. This may | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1224 | involve skipping over (and ignoring) lines until reaching the next EVENT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1225 | line. The event is returned in a hash structure, containing the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1226 | raw data in all data streams for the event, up to the following EVENT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1227 | marker, the "STOP RUN" marker, or the end of the file. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1228 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1229 | Returns 'undef' if no more events remain in the file. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1230 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1231 | Data streams can be selected by passing $stream parameter, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1232 | and multiple streams by passing reference to an array. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1234 | =head2 ReadFileHeader | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1235 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1236 | my $hdr = $t->ReadFileHeader([$shift]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1238 | my $hdr = $t->ReadFileHeader(shift=>$shift); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1240 | Read the header of the data file (before the start of the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1241 | first run), and store in a hashref. If '$shift' is true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1242 | (=1,'yes', 'true') then leave the file positioned after | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1243 | the file header. The 'shift' parameter is usually not | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1244 | needed, because ReadRunHeader will just read from the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1245 | start of the file to the first run. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1246 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1247 | If 'shift' is not specified, then the file position is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1248 | restored to where it was prior to the ReadFileHeader | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1249 | call, which can be useful if the file header is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1250 | read later in the analysis. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1252 | =head2 ReadRunHeader | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1253 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1254 | my $rhdr = $t->ReadRunHeader(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1255 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1256 | my $rhdr = $t->ReadRunHeader($run); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1258 | my $rhdr = $t->ReadRunHeader(run=>$run); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1259 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1260 | Reads the header information between the start of run and the first | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1261 | event. If the run number is not given, reads from the current file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1262 | position until the run is found. Returns undef if the file is not | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1263 | found. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1265 | Returns a hashref with the information, and leaves the file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1266 | positioned at the first event of the run. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1267 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1268 | =head2 FindEvent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1269 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1270 | $t->FindEvent($run,$event); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1271 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1272 | $t->FindEvent(run=>$run, event=>$event); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1273 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1274 | Find the specified event in the specified run (if run=undef or <=0, then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1275 | use current run). Returns undef if the event is not found, otherwise | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1276 | returns the file position and leaves the file positioned so that ReadEvent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1277 | will read the specified event. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1278 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1279 | If event is undefined, defaults to the 'next event'; for files that | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1280 | have been indexed event=-1 returns the LAST event (-2 next to last, etc). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1281 | Without an index event < 0 is treated as event=0. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1282 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1283 | Note that this routine is MUCH more efficient if an index is created. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1284 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1285 | =head2 PrintDefaultAnalyzer | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1286 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1287 | $t->PrintDefaultAnalyzer([$stream, $stream,...]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1288 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1289 | $t->PrintDefaultAnalyzer(stream=>[$stream1,$stream2,...]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1290 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1291 | Print the 'default' analyzer modules for the selected streams | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1292 | (default = 'all streams'). If the file header has not yet been | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1293 | read, this routine reads the file header to get the setup information | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1294 | about the data streams. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1295 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1296 | =head2 ConnectAnalyzer | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1298 | $t->ConnectAnalyzer([[$stream],$module]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1299 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1300 | $t->ConnectAnalyzer(stream=>$stream, module=>$module); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1301 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1302 | Connect an analysis module to a data stream. If the stream | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1303 | is unspecified, try to connect to all data streams. If | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1304 | the module is unspecified, try to use a 'default' module | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1305 | for the stream. Note that connecting multiple analysis | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1306 | modules to a stream results in the module being called | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1307 | in sequence, using the result from the previous | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1308 | analysis module. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1309 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1310 | Default modules are in Lab::Data::Analysis:: ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1311 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1312 | =head2 Analyze | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1313 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1314 | my $ev = $t->Analyze($ev[,$options,[,$stream1,$stream2,...]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1316 | my $ev = $t->Analyze(event=>$ev[, stream=>$stream1][,analyzeroptions=>..]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1317 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1318 | my $ev = $t->Analyze(event=>$ev[, stream=>[$stream1,$stream2,...] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1319 | [, analyzeroptions=>]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1320 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1321 | runs the analysis chain on the given event, for the given streams | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1322 | (default: all streams). The event is returned with analysis | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1323 | data added to the hashref. Options for the analyzer (in the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1324 | key=>value form) can be passed if the hash calling form is used. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1325 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1326 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1327 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1328 | This software is copyright (c) 2023 by the Lab::Measurement team; in detail: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1329 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1330 | Copyright 2016 Charles Lane | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1331 | 2017 Andreas K. Huettel | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1332 | 2020 Andreas K. Huettel | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1333 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1334 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1335 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1336 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1337 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1338 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||