lintian doesn't like orphan packages with uploaders...
[debian/amanda] / amplot / amplot.awk
index 962c080b29d237b211ac71add22d25971e089568..48429e96ee9fe186013bf3f957110295850441c6 100644 (file)
@@ -1,6 +1,7 @@
 #
 # Amanda, The Advanced Maryland Automatic Network Disk Archiver
 # Copyright (c) 1992-1998, 2000 University of Maryland at College Park
+# Copyright (c) 2007-2012 Zmanda, Inc.  All Rights Reserved.
 # All Rights Reserved.
 #
 # Permission to use, copy, modify, distribute, and sell this software and its
@@ -92,7 +93,7 @@ BEGIN{
                else if( $2=="flush" && $3=="size" ) {
                        flush_size = $4;
                }
-               else if( $2=="start")       do_start();
+               else if( $2=="start" && $3=="time")       do_start();
                else if( $2=="send-cmd") { 
                        if( $7=="FILE-DUMP"){
                          file_dump++;
@@ -102,11 +103,14 @@ BEGIN{
                          level[$6]=$14;
                        }
                        else if( $7 == "FILE-WRITE") file_write++;
-                       else if( $7 == "START-TAPER") fil = $8;
+                       else if( $7 == "START-TAPER") fil = $9;
                }
                else if( $2=="finished-cmd") cmd_fin++;
                else if( $2=="started")      forked++;
                else if( $2=="QUITTING")     do_quit();
+               else if( $2=="find_diskspace:") ; #eat this line
+               else if( $2=="assign_holdingdisk:") ; #eat this line
+               else if( $2=="adjust_diskspace:") ; #eat this line
                else if( $2=="tape" && $3=="size") ; #eat this line
                else if( $2=="dump" && $3=="failed") ; #eat this line
                else if( $2=="taper" && $3=="failed") ; #eat this line
@@ -129,7 +133,7 @@ BEGIN{
                    print fil, "INFO#", $0;
        }
        else if( $1 == "taper:") {
-               if($3 != "label" && $3 != "end" && $2 != "DONE" && $2 != "pid" && $2 != "slot" && $2 != "reader-side:" && $2 != "page" && $2 != "buffer" && $3 != "at")
+               if($3 != "label" && $3 != "end" && $2 != "DONE" && $2 != "pid" && $2 != "slot" && $2 != "reader-side:" && $2 != "page" && $2 != "buffer" && $3 != "at" && $3 != "switching" && $2 != "slot:" && $2 != "status")
                    print fil, "INFO#", $0;
        }
        else if( $1 == "FLUSH") {
@@ -151,11 +155,16 @@ function do_state(){              # state line is printed out after driver
 # $11 = "writing"/"idle"# $12 = "idle-dumpers:"
 # $13 = #idle          # $14 = "qlen"          # $15 = "tapeq:"
 # $16 = #waiting       # $17 = "runq:"         # $18 = #not started 
-# $19 = "stoppedq:"    # $20 = #stopped
+# $19 = "roomq"                # $20 = #roomq          # $21 = "wakeup:"
+# $22 = #wakeup                # $23 = "driver-idle:"  # $23 = status
 
        cnt++;                                  # number of event
        time = $4/time_scale;
-       unused = (bandw - $7)*bandw_scale+bandw_raise;
+       #Check overflow in driver ouput (big value instead of negative)
+       if($7>0 && $7 < 0x7fffffff)
+               unused = (bandw - $7)*bandw_scale+bandw_raise;
+       else
+               unused = bandw_raise;
        if( unused != unused_old) 
                printf plot_fmt, time, unused_old, time,unused >>"bandw_free";
        unused_old = unused;
@@ -355,11 +364,16 @@ function do_result(){             # process lines driver: result
                }
                else if ($7=="TAPER-OK") tape_err=0;
                else if ($7=="PORT")    tape_err=0;
+               else if ($7=="REQUEST-NEW-TAPE")    tape_err=0;
+               else if ($7=="NEW-TAPE")    tape_err=0;
+               else if ($7=="PARTDONE")    tape_err=0;
+               else if ($7=="DUMPER-STATUS")    tape_err=0;
                else print fil, "UNKNOWN STATUS# "$0 ;
        }
        else {                                  # something bad from dumper 
                if ($7=="FAILED") { failed++;}
                else if ($7=="TRY-AGAIN"){ try++;}
+               else if ($7=="PORT") ;  # ignore from chunker
                else if ($7=="RQ-MORE-DISK") ;  # FIXME: ignore for now
                else if ($7=="NO-ROOM")  
                  print fil, pr_time($4),"#"  ++no_room, $0;
@@ -430,44 +444,46 @@ function print_t(){               # printing out the labels for the graph
        printf "set yrange[0:%d]\n",maxy >"title";
        if( maxtime < tim && extend !=0) {
                printf "set xrange[0:%d]\n", tim+30 >>"title";
-               second_col = tim*0.5;
-               key_col = tim;
-               third_col = tim +13;
+               first_col = 10;
+               second_col = (tim+30) * 0.45;
+               key_col = (tim+30) * 1.042;
+               third_col = (tim+30) * 1.0125;
        }
        else {
                printf "set xrange[0:%d]\n", maxtime >>"title";
-               second_col = (maxtime-10) * 0.5;
-               key_col = (maxtime-10) ;
-               third_col = maxtime +3;
+               first_col = maxtime * 0.042
+               second_col = maxtime * 0.45
+               key_col = maxtime;
+               third_col = maxtime*1.0125;
        }
        label_shift = (7 + int(no_disks/100));
        lab = label_start = maxy+(6*label_shift) ;  # showing 6 labels
-       printf "set key %d, %d\n", key_col, lab >>"title";
-       printf "set label %d \"Amanda Dump %s\" at 10,%d\n", ++label,fil, 
-               lab >"title";
+       printf "set key at %d, %d\n", key_col, lab+4 >>"title";
+       printf "set label %d \"Amanda Dump %s\" at %d,%d\n", ++label,fil, 
+               first_col,lab >"title";
        lab -= label_shift;
-       printf "set label %d \"Bandwidth = %d\" at 10,%d\n",++label,bandw,
-               lab >>"title";
+       printf "set label %d \"Bandwidth = %d\" at %d,%d\n",++label,bandw,
+               first_col,lab >>"title";
 
        lab -= label_shift;
-       printf "set label %d \"Holding disk = %d\" at 10,%d\n",++label,size,
-               lab >>"title";
+       printf "set label %d \"Holding disk = %d\" at %d,%d\n",++label,size,
+               first_col,lab >>"title";
 
        lab -= label_shift;
-       printf "set label %d \"Tape Policy = %s\" at 10,%d\n",++label,policy,
-               lab >>"title";
+       printf "set label %d \"Tape Policy = %s\" at %d,%d\n",++label,policy,
+               first_col,lab >>"title";
 
        lab -= label_shift;
-       printf "set label %d \"Dumpers= %d\" at 10,%d\n",++label,dumpers,
-               lab >>"title";
+       printf "set label %d \"Dumpers= %d\" at %d,%d\n",++label,dumpers,
+               first_col,lab >>"title";
 
        lab -= label_shift;
        if( alg =="drain-ends") 
-               printf "set label %d \"Driver alg = %s At big end %d\" at 10,%d\n",
-                       ++label,alg, big,lab >>"title";
+               printf "set label %d \"Driver alg = %s At big end %d\" at %d,%d\n",
+                       ++label,alg, big,first_col,lab >>"title";
        else #if( alg =="InOrder")  # other special cases
-               printf "set label %d \"Driver alg = %s\" at 10,%d\n",
-                       ++label,alg, lab >>"title";
+               printf "set label %d \"Driver alg = %s\" at %d,%d\n",
+                       ++label,alg,first_col, lab >>"title";
 
        lab = label_start;
        printf "set label %d \"Elapsed Time = %s\" at %d,%d\n",
@@ -505,6 +521,8 @@ function print_t(){         # printing out the labels for the graph
                        if(paper==1) printf "set term postscript landscape color \"Times-Roman\" 10\n" >>"title";
                        else printf "set term postscript portrait color \"Times-Roman\" 10\n" >>"title";
                }
+       } else {
+               printf "set term x11\n" >> "title";
        }
        printf "set ylabel """";" >>"title";    # make sure there is no ylabel
        fmt= "set label %d \"%s\" at "third_col", %d\n";