[prev in list] [next in list] [prev in thread] [next in thread] 

List:       amanda-hackers
Subject:    Re: span/split 5.1 - amreport
From:       Orion Poplawski <orion () cora ! nwra ! com>
Date:       2004-03-16 18:42:54
Message-ID: 40574AAE.9000404 () cora ! nwra ! com
[Download RAW message or body]

John Stange wrote:
>>- looks like amreport does funny things:
>>
>>USAGE BY TAPE:
>>  Label             Time      Size      %    Nb
>>  TestRAIT-01       0:00       0.0    0.0     0
>>  TestRAIT-02       2:27   38554.6  102.5     1
>>
>>I'll try to take a look at that.
> 
> 
> That doesn't surprise me. :>
>

I've attached my current patch for amreport.  It generates the included 
output instead of the above.  It adds reporting for the number of chunks.

The dumps were flushed to tapes TestRAIT-01, TestRAIT-02.
The next 2 tapes Amanda expects to used are: a new tape, a new tape.


STATISTICS:
                           Total       Full      Daily
                         --------   --------   --------
Estimate Time (hrs:min)    0:00
Run Time (hrs:min)         2:50
Dump Time (hrs:min)        0:00       0:00       0:00
Output Size (meg)           0.0        0.0        0.0
Original Size (meg)         0.0        0.0        0.0
Avg Compressed Size (%)     --         --         --
Filesystems Dumped            0          0          0
Avg Dump Rate (k/s)         --         --         --

Tape Time (hrs:min)        2:27       2:27       0:00
Tape Size (meg)         38553.4    38553.4        0.0
Tape Used (%)             102.5      102.5        0.0
Filesystems Taped             1          1          0

Chunks Taped                 38         38          0
Avg Tp Write Rate (k/s)  4486.5     4486.5        --

USAGE BY TAPE:
   Label             Time      Size      %    Nb    Nc
   TestRAIT-01       2:20   36864.0   98.1     0    36
   TestRAIT-02       0:06    1689.4    4.5     1     2

^L
NOTES:
   taper: tape TestRAIT-01 kb 37935200 fm 37 writing file: No space left 
on device
   taper: retrying saga:/export/ocean07.0 on new tape: [writing file: No 
space left on devi
ce]
   taper: tape TestRAIT-02 kb 1730016 fm 2 [OK]

^L
DUMP SUMMARY:
                                           DUMPER STATS 
TAPER STATS
HOSTNAME DISK               L   ORIG-KB    OUT-KB COMP% MMM:SS  KB/s 
MMM:SS  KB/s
----------------------------- -------------------------------------- 
------------
saga     /export/ocean07    0  55061608  39479872  71.7   N/A   N/A 
146:394486.6

(brought to you by Amanda version 2.4.5b1-20040213)


-- 
Orion Poplawski
System Administrator                   303-415-9701 x222
Colorado Research Associates/NWRA      FAX: 303-415-9702
3380 Mitchell Lane, Boulder CO 80301   http://www.co-ra.com

["amanda-2.4.5b1-span-amreport.patch" (text/plain)]

--- amanda-2.4.5b1/server-src/reporter.c.span	2004-03-16 11:08:03.000000000 -0700
+++ amanda-2.4.5b1/server-src/reporter.c	2004-03-16 11:36:33.000000000 -0700
@@ -77,19 +77,19 @@
 #define data(dp) ((repdata_t *)(dp)->up)
 
 struct cumulative_stats {
-    int dumpdisks, tapedisks;
+    int dumpdisks, tapedisks, tapechunks;
     double taper_time, dumper_time;
     double outsize, origsize, tapesize;
     double coutsize, corigsize;			/* compressed dump only */
 } stats[3];
 
-int dumpdisks[10], tapedisks[10];	/* by-level breakdown of disk count */
+int dumpdisks[10], tapedisks[10], tapechunks[10];  /* by-level breakdown of disk count */
 
 typedef struct taper_s {
     char *label;
     double taper_time;
     double coutsize, corigsize;
-    int tapedisks;
+    int tapedisks, tapechunks;
     struct taper_s *next;
 } taper_t;
 
@@ -145,8 +145,8 @@
 void handle_stats P((void));
 void handle_error P((void));
 void handle_disk P((void));
-repdata_t *handle_success P((void));
-void handle_chunk P((void));
+repdata_t *handle_success P((logtype_t logtype));
+repdata_t *handle_chunk P((void));
 void handle_strange P((void));
 void handle_failed P((void));
 void generate_missing P((void));
@@ -471,10 +471,8 @@
 
 	case L_DISK:    handle_disk(); break;
 
-	case L_SUCCESS: handle_success(); break;
-	/* XXX CHUNK and CHUNKSUCCESS are really SUCCESS split into pieces,
-	   so something evil probably needs to happen here */
-	case L_CHUNKSUCCESS: handle_success(); break;
+	case L_SUCCESS: handle_success(curlog); break;
+	case L_CHUNKSUCCESS: handle_success(curlog); break;
 	case L_CHUNK: handle_chunk(); break;
 
 	case L_STRANGE: handle_strange(); break;
@@ -697,6 +695,7 @@
 
     stats[2].dumpdisks   = stats[0].dumpdisks   + stats[1].dumpdisks;
     stats[2].tapedisks   = stats[0].tapedisks   + stats[1].tapedisks;
+    stats[2].tapechunks  = stats[0].tapechunks  + stats[1].tapechunks;
     stats[2].outsize     = stats[0].outsize     + stats[1].outsize;
     stats[2].origsize    = stats[0].origsize    + stats[1].origsize;
     stats[2].tapesize    = stats[0].tapesize    + stats[1].tapesize;
@@ -782,11 +781,11 @@
 	    mb(stats[1].tapesize));
 
     fprintf(mailf, "Tape Used (%%)             ");
-    divzero(mailf, pct(stats[2].tapesize+marksize*stats[2].tapedisks),tapesize);
+    divzero(mailf, pct(stats[2].tapesize+marksize*(stats[2].tapedisks+stats[2].tapechunks)),tapesize);
     fputs("      ", mailf);
-    divzero(mailf, pct(stats[0].tapesize+marksize*stats[0].tapedisks),tapesize);
+    divzero(mailf, pct(stats[0].tapesize+marksize*(stats[0].tapedisks+stats[0].tapechunks)),tapesize);
     fputs("      ", mailf);
-    divzero(mailf, pct(stats[1].tapesize+marksize*stats[1].tapedisks),tapesize);
+    divzero(mailf, pct(stats[1].tapesize+marksize*(stats[1].tapedisks+stats[1].tapechunks)),tapesize);
 
     if(stats[1].tapedisks > 0) fputs("   (level:#disks ...)", mailf);
     putc('\n', mailf);
@@ -806,6 +805,24 @@
     }
     putc('\n', mailf);
 
+    if(stats[1].tapechunks > 0) fputs("   (level:#chunks ...)", mailf);
+    putc('\n', mailf);
+
+    fprintf(mailf,
+	    "Chunks Taped               %4d       %4d       %4d",
+	    stats[2].tapechunks, stats[0].tapechunks, stats[1].tapechunks);
+
+    if(stats[1].tapechunks > 0) {
+	first = 1;
+	for(lv = 1; lv < 10; lv++) if(tapechunks[lv]) {
+	    fputs(first?"   (":" ", mailf);
+	    first = 0;
+	    fprintf(mailf, "%d:%d", lv, tapechunks[lv]);
+	}
+	putc(')', mailf);
+    }
+    putc('\n', mailf);
+
     fprintf(mailf, "Avg Tp Write Rate (k/s) ");
     divzero_wide(mailf, stats[2].tapesize,stats[2].taper_time);
     fputs("    ", mailf);
@@ -817,7 +834,7 @@
     if(stats_by_tape) {
 	int label_length = strlen(stats_by_tape->label) + 5;
 	fprintf(mailf,"\nUSAGE BY TAPE:\n");
-	fprintf(mailf,"  %-*s  Time      Size      %%    Nb\n",
+	fprintf(mailf,"  %-*s  Time      Size      %%    Nb    Nc\n",
 		label_length, "Label");
 	for(current_tape = stats_by_tape; current_tape != NULL;
 	    current_tape = current_tape->next) {
@@ -825,9 +842,10 @@
 	    fprintf(mailf, " %2d:%02d", hrmn(current_tape->taper_time));
 	    fprintf(mailf, " %9.1f  ", mb(current_tape->coutsize));
 	    divzero(mailf, pct(current_tape->coutsize + 
-			       marksize * current_tape->tapedisks),
+			       marksize * (current_tape->tapedisks+current_tape->tapechunks)),
 			   tapesize);
-	    fprintf(mailf, "  %4d\n", current_tape->tapedisks);
+	    fprintf(mailf, "  %4d", current_tape->tapedisks);
+	    fprintf(mailf, "  %4d\n", current_tape->tapechunks);
 	}
     }
 
@@ -1391,6 +1409,7 @@
 	current_tape->coutsize = 0.0;
 	current_tape->corigsize = 0.0;
 	current_tape->tapedisks = 0;
+	current_tape->tapechunks = 0;
 	current_tape->next = NULL;
 	tapefcount = 0;
 
@@ -1639,11 +1658,152 @@
  * log entries.  Right now they're just the equivalent of L_SUCCESS, but only
  * for a split chunk of the overall dumpfile.
  */
-void handle_chunk()
+repdata_t *handle_chunk()
 {
+    disk_t *dp;
+    float sec, kps, kbytes;
+    timedata_t *sp;
+    int i;
+    char *s, *fp;
+    int ch;
+    char *hostname = NULL;
+    char *diskname = NULL;
+    repdata_t *repdata;
+    int level, chunk;
+    char *datestamp;
+
+    if(curprog != P_TAPER) {
+	bogus_line();
+	return NULL;
+    }
+
+    s = curstr;
+    ch = *s++;
+
+    skip_whitespace(s, ch);
+    if(ch == '\0') {
+	bogus_line();
+	return NULL;
+    }
+    fp = s - 1;
+    skip_non_whitespace(s, ch);
+    s[-1] = '\0';
+    hostname = stralloc(fp);
+    s[-1] = ch;
+
+    skip_whitespace(s, ch);
+    if(ch == '\0') {
+	bogus_line();
+	amfree(hostname);
+	return NULL;
+    }
+    fp = s - 1;
+    skip_non_whitespace(s, ch);
+    s[-1] = '\0';
+    diskname = stralloc(fp);
+    s[-1] = ch;
+
+    skip_whitespace(s, ch);
+    if(ch == '\0') {
+	bogus_line();
+	amfree(hostname);
+	amfree(diskname);
+	return NULL;
+    }
+    fp = s - 1;
+    skip_non_whitespace(s, ch);
+    s[-1] = '\0';
+    datestamp = stralloc(fp);
+    s[-1] = ch;
+
+    level = atoi(datestamp);
+    if(level < 100)  {
+	datestamp = newstralloc(datestamp, run_datestamp);
+    }
+    else {
+	skip_whitespace(s, ch);
+	if(ch == '\0' || sscanf(s - 1, "%d", &chunk) != 1) {
+	    bogus_line();
+	    amfree(hostname);
+	    amfree(diskname);
+	    amfree(datestamp);
+	    return NULL;
+	}
+	skip_integer(s, ch);
+
+	skip_whitespace(s, ch);
+	if(ch == '\0' || sscanf(s - 1, "%d", &level) != 1) {
+	    bogus_line();
+	    amfree(hostname);
+	    amfree(diskname);
+	    amfree(datestamp);
+	    return NULL;
+	}
+	skip_integer(s, ch);
+    }
+
+    skip_whitespace(s, ch);
+
+    if(sscanf(s - 1,"[sec %f kb %f kps %f", &sec, &kbytes, &kps) != 3)  {
+	bogus_line();
+	amfree(hostname);
+	amfree(diskname);
+	amfree(datestamp);
+	return NULL;
+    }
+
+
+    dp = lookup_disk(hostname, diskname);
+    if(dp == NULL) {
+	char *str = NULL;
+
+	str = vstralloc("  ", prefix(hostname, diskname, level),
+			" ", "ERROR [not in disklist]",
+			NULL);
+	addline(&errsum, str);
+	amfree(str);
+	amfree(hostname);
+	amfree(diskname);
+	amfree(datestamp);
+	return NULL;
+    }
+
+    repdata = find_repdata(dp, datestamp, level);
+
+    if(curprog == P_TAPER)
+	sp = &(repdata->taper);
+
+    i = level > 0;
+
+    amfree(hostname);
+    amfree(diskname);
+    amfree(datestamp);
+
+    sp->result = L_SUCCESS;
+    sp->datestamp = repdata->datestamp;
+    sp->sec = sec;
+    sp->kps = kps;
+    sp->outsize = kbytes;
+
+    if(curprog == P_TAPER) {
+	if(current_tape == NULL) {
+	    error("current_tape == NULL");
+	}
+	stats[i].taper_time += sec;
+	sp->filenum = ++tapefcount;
+	sp->tapelabel = current_tape->label;
+	tapechunks[level] +=1;
+	stats[i].tapechunks +=1;
+	stats[i].tapesize += kbytes;
+	current_tape->taper_time += sec;
+	current_tape->coutsize += kbytes;
+	current_tape->tapechunks += 1;
+    }
+
+    return repdata;
 }
 
-repdata_t *handle_success()
+repdata_t *handle_success(logtype_t logtype)
 {
     disk_t *dp;
     float sec, kps, kbytes, origkb;
@@ -1803,15 +1963,17 @@
 	if(current_tape == NULL) {
 	    error("current_tape == NULL");
 	}
-	stats[i].taper_time += sec;
-	sp->filenum = ++tapefcount;
-	sp->tapelabel = current_tape->label;
+	if (logtype == L_SUCCESS) {
+	    stats[i].taper_time += sec;
+	    sp->filenum = ++tapefcount;
+	    sp->tapelabel = current_tape->label;
+	    stats[i].tapesize += kbytes;
+	    current_tape->taper_time += sec;
+	    current_tape->coutsize += kbytes;
+	    current_tape->corigsize += origkb;
+	}
 	tapedisks[level] +=1;
 	stats[i].tapedisks +=1;
-	stats[i].tapesize += kbytes;
-	current_tape->taper_time += sec;
-	current_tape->coutsize += kbytes;
-	current_tape->corigsize += origkb;
 	current_tape->tapedisks += 1;
     }
 
@@ -1838,7 +2000,7 @@
     char *str = NULL;
     repdata_t *repdata;
 
-    repdata = handle_success();
+    repdata = handle_success(L_SUCCESS);
 
     str = vstralloc("  ", prefix(repdata->disk->host->hostname, 
 				 repdata->disk->name, repdata->level),
@@ -2143,7 +2305,7 @@
 	      mb(current_tape->coutsize));
 	fprintf(postscript, "(Tape Used (%%)       ");
 	divzero(postscript, pct(current_tape->coutsize + 
-				marksize * current_tape->tapedisks),
+				marksize * (current_tape->tapedisks + current_tape->tapechunks)),
 				tapesize);
 	fprintf(postscript," %%) DrawStat\n");
 	fprintf(postscript, "(Compression Ratio:  ");


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic