From: Arnaud Giersch Date: Tue, 18 Jan 2011 08:29:48 +0000 (+0100) Subject: Add extract.pl. X-Git-Tag: v0.1~188^2~38 X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/commitdiff_plain/0dd2651f302ede2afb676a68211474f2b3a9b5c1?hp=-c Add extract.pl. A script to ease data extraction for graph drawing. It prints data in a format usable by gnuplot, or graph from the GNU plotutils. --- 0dd2651f302ede2afb676a68211474f2b3a9b5c1 diff --git a/README b/README index f6c136d..ff8c438 100644 --- a/README +++ b/README @@ -3,6 +3,7 @@ Contenu * Compilation de SimGrid * Compilation... * Utilisation +* Tracé de courbes * Communications * Pour ajouter un nouvel algorithme d'équilibrage * Pour ajouter une nouvelle option au programme @@ -45,6 +46,16 @@ Pour changer le niveau de détail des affichages : Pour plus de détail sur les options de logging : http://simgrid.gforge.inria.fr/doc/group__XBT__log.html#log_use +Tracé de courbes +================ + +Le script extract.pl permet d'extraire les données à partir des traces +de simulation et de le présenter sous un format acceptable par gnuplot +ou par graph (plotutils). + +Exemple: + ./loba platform.xml 2>&1 | ./extract.pl | graph -CTX + Communications ============== @@ -178,6 +189,9 @@ Liste de fichiers colorized-loba script pour exécuter loba en colorant les sorties + extract.pl outil d'extraction des données à partir des + traces, pour tracer des courbes + setlocalversion calcule un numéro de version à partir du hash du dernier commit (git) diff --git a/extract.pl b/extract.pl new file mode 100755 index 0000000..fa393b9 --- /dev/null +++ b/extract.pl @@ -0,0 +1,106 @@ +#!/usr/bin/env perl + +use strict; +use warnings; + +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 %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}) { + 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"; + push @{$alldata{$host}}, $data; + } if (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; + } +} + +foreach my $host (sort(keys %alldata)) { +# print STDERR "GOT \"$host\"\n"; + my $datalist = $alldata{$host}; + print "# $host\n"; + foreach my $data (@{$datalist}) { + print "$data->{time} $data->{load}\n"; + } + print "\n" +}