Changeset 27559 for gs2-extensions


Ignore:
Timestamp:
2013-06-06T11:15:28+12:00 (11 years ago)
Author:
jmt12
Message:

Changed mime-type away from binary - I hope. Meanwhile, generate improvements to maths to reduce rounding errors, and also to allow multiple tasks to occur at once (a possibility under the more ambiguous Hadoop parallel processing)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gs2-extensions/parallel-building/trunk/src/bin/script/generate_gantt.pl

    • Property svn:mime-type deleted
    r27551 r27559  
    6060      my $stop = $parts[4];
    6161      my $filepath = $parts[8];
     62      $filepath =~ s/^\s+|\s+$//g;
    6263      $import_dir = &longestCommonPath($filepath, $import_dir);
    6364      $timing_data->{$worker_id}->{'F'}->{$parts[3]} = {'FN'=>$filepath, 'PS'=>($stop - $parts[5]), 'PE'=>$stop, 'E'=>$stop};
     
    8283print HTMLOUT 'div.worker {border:1px solid black;background-color:green;color:white;font-weight:bold}' . "\n";
    8384print HTMLOUT 'div.time {font-size:smaller;font-weight:normal}' . "\n";
    84 print HTMLOUT 'div.job {background-color:transparent;color:black;border:1px solid black;display:block;font-size:smaller;position:relative;text-align:center}' . "\n";
     85print HTMLOUT 'div.job {background-color:transparent;color:black;border:1px solid black;display:block;font-size:smaller;position:relative;text-align:center;overflow:hidden}' . "\n";
    8586print HTMLOUT 'span.process {z-index:-1;background-color:#C7C7C7;position:absolute}' . "\n";
     87print HTMLOUT 'span.label {z-index:1;background-color:transparent;overflow:hidden;white-space:nowrap;}' . "\n";
    8688print HTMLOUT "th {text-align:left}\n";
    8789print HTMLOUT '</style>' . "\n";
     
    132134      }
    133135      # Shorten filename
    134       $timing_data->{$worker_id}->{'F'}->{$job_start}->{'FN'} = substr($timing_data->{$worker_id}->{'F'}->{$job_start}->{'FN'}, length($import_dir) + 1);
     136      if (defined $timing_data->{$worker_id}->{'F'}->{$job_start}->{'FN'})
     137      {
     138        $timing_data->{$worker_id}->{'F'}->{$job_start}->{'FN'} = substr($timing_data->{$worker_id}->{'F'}->{$job_start}->{'FN'}, length($import_dir) + 1);
     139      }
    135140      $file_count++;
    136141    }
     
    265270  # - subtract any left offset from width
    266271  $width = $width - $left;
    267   # - right offset directly subtracted from width 
     272  # - right offset directly subtracted from width
    268273  if ($end != $tend)
    269274  {
     
    272277    $width = $width - $right;
    273278  }
     279  # Round things off (simple dutch rounding)
     280  $left = int($left + 0.5);
     281  $width = int($width + 0.5);
     282  # Output the bar for this master/worker
    274283  my $html = '<div class="thread ' . $class . '" style="left:' . $left . 'px;width:' . $width . 'px;">';
    275284  if ($class eq 'master')
     
    288297    # Scale Job co-ordinates
    289298    my $jleft_percent = $rjstart / $duration;
    290     my $jleft = floor($jleft_percent * $table_width);
     299    my $jleft = int(($jleft_percent * $table_width) + 0.5);
    291300    my $jwidth_percent = $jduration / $duration;
    292     my $jwidth = floor($jwidth_percent * $table_width);
    293     if ($jleft < $previous_jright)
    294     {
    295       $jleft = $previous_jright;
    296     }
     301    my $jwidth = int(($jwidth_percent * $table_width) + 0.5);
    297302    if ($jleft + $jwidth > $left + $width)
    298303    {
     
    301306    # Then scale process timings within that!
    302307    my $rpleft_percent = ($rpstart - $rjstart) / $duration;
    303     my $rpleft = floor($rpleft_percent * $table_width);
    304     my $rpwidth_percent = ($rpend - $rpstart) / $duration;
    305     my $rpwidth = floor($rpwidth_percent * $table_width);
    306     $html .= '<div class="job" style="left:' . $jleft . 'px;width:' . $jwidth . 'px" title="S:' . renderTime($rjstart) . ', PS:' . renderTime($rpstart) . ', PE:' . renderTime($rpend) . ', E:' . renderTime($rjend) . '"><span class="process" style="left:' . $rpleft . 'px;width:' . $rpwidth . 'px">&nbsp;</span><span style="background-color:transparent;z-index:1">' . $jobs->{$jstart}->{'FN'} . '</span></div>';
    307     $previous_jright = $jleft + $jwidth;
     308    my $rpleft = int(($rpleft_percent * $table_width) + 0.5);
     309    my $rpwidth = $jwidth - $rpleft;
     310    my $cpu_percent = int((($rpwidth / $jwidth) * 100) + 0.5);
     311    $html .= '<div class="job" style="left:' . $jleft . 'px;width:' . $jwidth . 'px" title="FN:' . $jobs->{$jstart}->{'FN'} . ', S:' . renderTime($rjstart) . ', E:' . renderTime($rjend) . ', CPU: ' . $cpu_percent . '%"><span class="process" style="left:' . $rpleft . 'px;width:' . $rpwidth . 'px">&nbsp;</span><span class="label">' . $jobs->{$jstart}->{'FN'} . '</span></div>';
    308312  }
    309313  return $html;
Note: See TracChangeset for help on using the changeset viewer.