/[omni_gantt]/db2gantt.cgi
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /db2gantt.cgi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.21 by dpavlin, Mon Sep 16 15:29:00 2002 UTC revision 1.23 by dpavlin, Mon Sep 23 08:45:36 2002 UTC
# Line 28  my %cols = ( Line 28  my %cols = (
28          'Completed/Failure'     => '128,0,128',          'Completed/Failure'     => '128,0,128',
29          'Mount Request'         => '128,128,255',          'Mount Request'         => '128,128,255',
30          'Mount/Errors'          => '255,64,128',          'Mount/Errors'          => '255,64,128',
31            'Mount/Failures'        => '255,128,192',
32          );          );
33    
34  my $int_t = (12 * 60 * 60);     # interval to display on one screen  my $int_t = (12 * 60 * 60);     # interval to display on one screen
# Line 269  sub sum_bar { Line 270  sub sum_bar {
270          print "</td></tr>";          print "</td></tr>";
271  }  }
272    
273    my @line_t;     # all seconds for this specification
274    my @line_arr = ("");    # all segments on line which are not fillers
275    
276    sub html_spec {
277            print "<tr><td>$curr_spec</td><td colspan=2>";
278    
279            my $last_var = 0;
280            my $len = 0;
281            my $i;
282            for (my $t=0; $t<=$len_t; $t++) {
283                    $i = $line_t[$t] || 0;
284                    if ($i == $last_var) {
285                            $len++;
286                    } else {
287                            if ($last_var == 0) {
288                                    print bar($len);
289                            } else {
290                                    print bar($len,split(/\t/,$line_arr[$last_var],2));
291                            }
292                            $len = 0;
293                            $last_var = $i;
294                    }
295            }
296            print bar($len,split(/\t/,$line_arr[$i],2));
297    
298            print "</td></tr>\n";
299    }
300    
301  while(my $row = $sth->fetchrow_hashref) {  while(my $row = $sth->fetchrow_hashref) {
302          if (!defined $curr_spec || $row->{specification} ne $curr_spec) {          if ($row->{specification} ne $curr_spec) {
303    
304                  if ($curr_t < $to_t && $curr_spec) {                  if ($curr_t < $to_t && $curr_spec) {
305                          my $t = $to_t - $curr_t;                          my $t = $to_t - $curr_t;
306                          print STDERR "[end filler $curr_t:$t]" if ($debug);                          print STDERR "[end filler $curr_t:$t]" if ($debug);
307                          print bar($t);  #                       print bar($t);
308                  }                  }
309    
310                  print "</td></tr>\n" if ($curr_t != $from_t);  #               print "</td></tr>\n" if ($curr_t != $from_t);
311    
                 if ($dev && @dev_t && $dev ne $row->{device}) {  
                         sum_bar("summary for $dev",@dev_t);  
                         $dev = $row->{device};  
                         @dev_t = ();  
                 } elsif (! $dev) {  
                         $dev = $row->{device};  
                 }  
312    
313                  # init vars for next line                  # init vars for next line
314                  ($fix_s,$fix_d) = (0,0); # init fix vars for bar                  ($fix_s,$fix_d) = (0,0); # init fix vars for bar
315                  print "<tr><td>", $row->{specification},"</td><td colspan=2>";  
316                    html_spec if ($curr_spec ne "");
317    
318                  $curr_t = $from_t;      # init timeline                  $curr_t = $from_t;      # init timeline
319                  $curr_spec = $row->{specification};                  $curr_spec = $row->{specification};
320    
321                    @line_t = ();
322                    @line_arr = ( "" );
323    
324                    if ($dev && @dev_t && $dev ne $row->{device}) {
325                            sum_bar("summary for $dev",@dev_t);
326                            $dev = $row->{device};
327                            @dev_t = ();
328                    } elsif (! $dev) {
329                            $dev = $row->{device};
330                    }
331          }          }
332    
333          my $start_t = str2time($row->{start});          my $start_t = str2time($row->{start});
# Line 304  while(my $row = $sth->fetchrow_hashref) Line 337  while(my $row = $sth->fetchrow_hashref)
337          if ($start_t > $curr_t + ($len_t / $width)) {          if ($start_t > $curr_t + ($len_t / $width)) {
338                  my $t = $start_t - $curr_t;                  my $t = $start_t - $curr_t;
339                  print STDERR "[middle filler $curr_t:$t]" if ($debug);                  print STDERR "[middle filler $curr_t:$t]" if ($debug);
340                  print bar($t);  #               print bar($t);
341                  $curr_t = $start_t;                  $curr_t = $start_t;
342          } else {          } else {
343                  # prepend too few seconds to next event                  # prepend too few seconds to next event
# Line 337  while(my $row = $sth->fetchrow_hashref) Line 370  while(my $row = $sth->fetchrow_hashref)
370                  $row->{type}." <b>".$row->{status}."</b><br>".                  $row->{type}." <b>".$row->{status}."</b><br>".
371                  $row->{user_group_host}." <i>".$row->{sessionid}."</i><br>".                  $row->{user_group_host}." <i>".$row->{sessionid}."</i><br>".
372                  $row->{device}."&nbsp;on&nbsp;".$row->{host};                  $row->{device}."&nbsp;on&nbsp;".$row->{host};
373          print bar($len,$row->{status},$alt);  #       print bar($len,$row->{status},$alt);
374    
375            push @line_arr,$row->{status}."\t".$alt;
376          # store use of devices for each minute          # store use of devices for each minute
377          for (my $s=0; $s<$len; $s++) {          for (my $s=0; $s<$len; $s++) {
378                    $line_t[$curr_t-$from_t+$s] = $#line_arr;
379                  $dev_t[$curr_t-$from_t+$s]++;                  $dev_t[$curr_t-$from_t+$s]++;
380                  $dev_sum_t[$curr_t-$from_t+$s]++;                  $dev_sum_t[$curr_t-$from_t+$s]++;
381          }          }
# Line 352  while(my $row = $sth->fetchrow_hashref) Line 387  while(my $row = $sth->fetchrow_hashref)
387  }  }
388    
389  if ($curr_t == $from_t) {       # no entries in database!  if ($curr_t == $from_t) {       # no entries in database!
390          print "<tr><td></td><td colspan=2>";  #       print "<tr><td></td><td colspan=2>";
391  }  }
392    
393  if ($curr_t < $to_t ) {  if ($curr_t < $to_t ) {
394          my $t = $to_t - $curr_t;          my $t = $to_t - $curr_t;
395          print STDERR "[last_line filler $curr_t:$t]" if ($debug);          print STDERR "[last_line filler $curr_t:$t]" if ($debug);
         print bar($t);  
396  }  }
397    
398  undef $sth;  undef $sth;
399  $dbh->disconnect;  $dbh->disconnect;
400    
401  print "</td></tr>\n";  html_spec();
402  sum_bar("summary for $dev",@dev_t);  sum_bar("summary for $dev",@dev_t);
403  hour_grid();  hour_grid();
404  sum_bar("summary for all devices",@dev_sum_t);  sum_bar("summary for all devices",@dev_sum_t);

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.23

  ViewVC Help
Powered by ViewVC 1.1.26