Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add the ability to print the message location in the code.
authoralegrand <alegrand@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 3 Oct 2005 11:54:26 +0000 (11:54 +0000)
committeralegrand <alegrand@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 3 Oct 2005 11:54:26 +0000 (11:54 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@1744 48e7efb5-ca39-0410-a469-dd3cf9ba447f

tools/MSG_visualization/colorize.pl

index 586b479..a412484 100755 (executable)
@@ -32,6 +32,30 @@ my (@coltab) = (
 
 my %pid;
 
 
 my %pid;
 
+# Get options
+#
+while (($_ = $ARGV[0]) =~ /^-/) {
+    shift;
+    if (/-location/i) {
+        $opt_print_location = 1;  shift;
+    } elsif (/-h(elp)?$|-u(sage)?$/i) {
+        print<<EOH
+colorize.pl - Log colorizer for SimGrid
+Syntax:
+
+    colorize.pl [options] <file>
+
+    where <file> is a text file of values or '-' for STDIN
+
+Options: () denote short version
+
+    -location          Print the location in the code of the message.
+EOH
+;
+       exit;
+    }
+}
+
 sub pidcolor {
     my $pid = shift;
 
 sub pidcolor {
     my $pid = shift;
 
@@ -42,6 +66,7 @@ sub pidcolor {
     return $coltab[$pid{$pid}];
 }
 
     return $coltab[$pid{$pid}];
 }
 
+# Read the messages and do the job
 while (<>) {
     $orgline = $thisline = $_;
 
 while (<>) {
     $orgline = $thisline = $_;
 
@@ -54,11 +79,17 @@ while (<>) {
        $xbt_channel=$6;
        $message=$7;
 
        $xbt_channel=$6;
        $message=$7;
 
+       $location =~ s/:$//;
+
        print $col_norm;
        printf "[% 10.3f]",$date;
 
        print pidcolor($pid);
        print $col_norm;
        printf "[% 10.3f]",$date;
 
        print pidcolor($pid);
-       printf "[%10s:%-10s]",$host,$procname;
+       if($opt_print_location) {
+           printf "[%10s:%-10s %s ]",$host,$procname,$location;
+       } else {
+           printf "[%10s:%-10s]",$host,$procname;
+       }
        print " $message";
        print $col_norm."\n";
     } elsif ( $thisline =~ /^==(\d+)== (.*)$/) {
        print " $message";
        print $col_norm."\n";
     } elsif ( $thisline =~ /^==(\d+)== (.*)$/) {