X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/blobdiff_plain/0dd2651f302ede2afb676a68211474f2b3a9b5c1..f2a9af6fd7e7a0294d07aff678960134ba771ffa:/extract.pl?ds=sidebyside diff --git a/extract.pl b/extract.pl index fa393b9..c3414ee 100755 --- a/extract.pl +++ b/extract.pl @@ -7,91 +7,34 @@ my $bookkeeping; my $flt = '[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?'; my $pflt = "($flt)"; my $prefix = '^\[([^: ]+)(?::loba:\(\d+\))? ' . $pflt . '\] \[proc/INFO\] '; -my $initmatch = $prefix . 'Initial load: ' . $pflt . ''; -my $finalmatch; -my $plainmatch; +my $initmatch = $prefix . 'Initial load: ' . $pflt; +my $finalmatch = $prefix . 'Final load after (\d+):(\d+) iterations: ' . $pflt;; +my $plainmatch = $prefix . '\((\d+):(\d+)\) current load: ' . $pflt; my %alldata = (); while (<>) { chomp; - if (s{^(?:\[0\.0+\] )?\[main/INFO\] \| bookkeeping\.*: }{}) { - $bookkeeping = $_ eq "on"; - if ($bookkeeping) { - $finalmatch = $prefix . - 'Final load after (\d+):(\d+) iterations: ' . $pflt . - ' ; expected: ' . $pflt; - $plainmatch = $prefix . - '\((\d+):(\d+)\) current load: ' . $pflt . - ' ; expected: ' . $pflt; - } else { - $finalmatch = $prefix . - 'Final load after (\d+) iterations: ' . $pflt; - $plainmatch = $prefix . '\((\d+)\) current load: ' . $pflt; - } - if (0) { - print STDERR "BOOKKEEPING: \"$_\" ($bookkeeping)\n"; - print STDERR "INITMATCH..: \"$initmatch\"\n"; - print STDERR "PLAINMATCH.: \"$plainmatch\"\n"; - print STDERR "FINALMATCH.: \"$finalmatch\"\n"; - } - } - next if not defined $bookkeeping; - if (m{$plainmatch}) { + if (m{$plainmatch} or m{$finalmatch}) { my $host = $1; - my $data; - if ($bookkeeping) { - $data = { - time => $2, - lb => $3, - comp => $4, - load => $5, - expected => $6, - }; - } else { - $data = { - time => $2, - lb => $3, - comp => $3, - load => $4, - expected => $4, - }; - } -# print STDERR "PUSH $host $data->{time} $data->{load} (plain)\n"; + my $data = { + time => $2, + lb => $3, + comp => $4, + load => $5, + }; +# print STDERR "PUSH $host $data->{time} $data->{load} (plain/final)\n"; push @{$alldata{$host}}, $data; - } if (m{$initmatch}) { + } elsif (m{$initmatch}) { my $host = $1; my $data = { time => $2, lb => 0, comp => 0, load => $3, - expected => $3, }; # print STDERR "PUSH $host $data->{time} $data->{load} (init)\n"; push @{$alldata{$host}}, $data; - } elsif (m{$finalmatch}) { - my $host = $1; - my $data; - if ($bookkeeping) { - $data = { - time => $2, - lb => $3, - comp => $4, - load => $5, - expected => $6, - }; - } else { - $data = { - time => $2, - lb => $3, - comp => $3, - load => $4, - expected => $4, - }; - } -# print STDERR "PUSH $host $data->{time} $data->{load} (final)\n"; - push @{$alldata{$host}}, $data; } } @@ -102,5 +45,5 @@ foreach my $host (sort(keys %alldata)) { foreach my $data (@{$datalist}) { print "$data->{time} $data->{load}\n"; } - print "\n" + print "\n\n" }