Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
shorten
[simgrid.git] / tools / MSG_visualization / trace2fig.pl
index 8067874..26303f1 100755 (executable)
@@ -4,7 +4,7 @@ use strict;
 use XFig;
 
 my($grid_Y_size)=225; # xfig 
-my($grid_X_size)=225; # xfig 
+my($grid_X_size)=100550; # xfig
 
 sub read_cat {
     my(%Cat);
@@ -60,12 +60,12 @@ sub read_link {
     while (defined($line=<INPUT>)) {
        chomp $line;
        if($line =~ /^16\s/) {
-           my($event,$date,$type,$father,$channel,$src,$key) = split(/\s+/,$line);
+           my($event,$date,$type,$father,$channel,$src,$key) = split(/\t+/,$line);
            $link{$key}{src}=$src;
            $link{$key}{src_date}=$date;
        }
        if($line =~ /^17\s/) {
-           my($event,$date,$type,$father,$channel,$dst,$key) = split(/\s+/,$line);
+           my($event,$date,$type,$father,$channel,$dst,$key) = split(/\t+/,$line);
            $link{$key}{dst}=$dst;
            $link{$key}{dst_date}=$date;
        }
@@ -109,9 +109,11 @@ sub set_cat_position {
     my($i)=0;
     my($cat);
     foreach $cat (@$cat_list) {
-       $$Cat{$cat}{Y_min} = $i;
-       $$Cat{$cat}{Y_max} = $i+1;
-       $i++;
+       if(defined($$Cat{$cat}{state})) {
+           $$Cat{$cat}{Y_min} = $i;
+           $$Cat{$cat}{Y_max} = $i+1;
+           $i++;
+       }
     }
 }
 
@@ -141,7 +143,7 @@ sub draw_cat {
        next unless (defined($$Cat{$cat}{Y_min}) && 
                     defined($$Cat{$cat}{Y_max}));
        my($text) = new XFig ('text');
-       $text->{'text'} = $$Cat{$cat}{name};
+       $text->{'text'} = "$$Cat{$$Cat{$cat}{father}}{name}"."$$Cat{$cat}{name}";
        $text->{'y'} = ($$Cat{$cat}{Y_min}+$$Cat{$cat}{Y_max})/2*$grid_Y_size+68;
        $fig->add ($text);
     }
@@ -161,6 +163,7 @@ sub draw_cat {
                
                my($line) = new XFig ('polyline');
 
+               $line->{'depth'} = 50;  # line
                $line->{'subtype'} = 1;  # line
                $line->{'points'} = [ [$old_date*$grid_X_size, $$Cat{$cat}{Y_min}*$grid_Y_size],
                                      [$new_date*$grid_X_size, $$Cat{$cat}{Y_min}*$grid_Y_size],
@@ -189,6 +192,9 @@ sub draw_cat {
        my($dst)=$$Link{$link}{dst};
        $line->{'subtype'} = 1;  # line
 
+       print STDERR "$link: $src ($src_date) -> $dst ($dst_date)\n";
+
+       print STDERR "$$Cat{$src}{name} -> $$Cat{$dst}{name}\n";
        $line->{'points'} = [ [$src_date*$grid_X_size, 
                               ($$Cat{$src}{Y_min}+$$Cat{$src}{Y_max})/2*$grid_Y_size],
                              [$dst_date*$grid_X_size,