From: mquinson Date: Mon, 27 Jun 2005 22:06:59 +0000 (+0000) Subject: Work better in RL (by not assuming that pid begin at 1 and are then incremented)... X-Git-Tag: v3.3~3929 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/618709054477a826cf2d5aa94da7a6a65696171c?hp=79c537eef79af75afc396907c355fa29a77bf9ae Work better in RL (by not assuming that pid begin at 1 and are then incremented); take care of valgrind output in RL git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@1426 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/tools/MSG_visualization/colorize.pl b/tools/MSG_visualization/colorize.pl index 39da01fd6a..f7d066fda9 100755 --- a/tools/MSG_visualization/colorize.pl +++ b/tools/MSG_visualization/colorize.pl @@ -30,10 +30,22 @@ my (@coltab) = ( $col_background . $col_blue, $col_background . $col_magenta, ); +my %pid; + +sub pidcolor { + my $pid = shift; + + unless (defined($pid{$pid})) { + # first time we see this pid. Affect it a color + $pid{$pid}=(scalar keys %pid) % (scalar @coltab); + } + return $coltab[$pid{$pid}]; +} + while (<>) { $orgline = $thisline = $_; - if ( $thisline =~ /^\[(\w+):(\w+):\((\d+\)) ([0-9\.]*)\] ([^\[]*) \[([^\[]*)\] (.*)$/ ) { + if ( $thisline =~ /^\[(\w+):(\w+):\((\d+)\) ([0-9\.]*)\] ([^\[]*) \[([^\[]*)\] (.*)$/ ) { $host=$1; $procname=$2; $pid=$3; @@ -44,13 +56,18 @@ while (<>) { print $col_norm; printf "[% 10.3f]",$date; - print $coltab[($pid-1) % scalar(@coltab)]; + + print pidcolor($pid); printf "[%10s:%-10s]",$host,$procname; print " $message"; print $col_norm."\n"; - next; + } elsif ( $thisline =~ /^==(\d+)== (.*)$/) { + # take care of valgrind outputs + print pidcolor($1)."$2\n"; + + } else { + print $col_default. $orgline; } - print $col_default. $orgline; } print $col_norm;