changelog shortlog tags branches files raw gz bz2 help

Mercurial > hg > ventivac / changeset: add -v flag to print info for each block (previously was the default,

changeset 98: 00a4a965e43e
parent 97: 1fef0e1807d4
child 99: a1ab045f1634
author: Mechiel Lukkien <mechiel@ueber.net>
date: Mon, 06 Aug 2007 17:03:33 +0200
files: appl/cmd/testrabin.b
description: add -v flag to print info for each block (previously was the default,
but i'm now using testrabin to test throughput, and sha1 calculating
would make the numbers unreliable).
     1.1--- a/appl/cmd/testrabin.b	Mon Aug 06 16:48:03 2007 +0200
     1.2+++ b/appl/cmd/testrabin.b	Mon Aug 06 17:03:33 2007 +0200
     1.3@@ -15,7 +15,7 @@
     1.4 print, sprint, fprint, fildes: import sys;
     1.5 Rcfg, Rfile: import rabin;
     1.6 
     1.7-dflag: int;
     1.8+dflag, vflag: int;
     1.9 
    1.10 Testrabin: module {
    1.11 	init:	fn(nil: ref Draw->Context, nil: list of string);
    1.12@@ -39,10 +39,11 @@
    1.13 	max := 32*1024;
    1.14 
    1.15 	arg->init(args);
    1.16-	arg->setusage(arg->progname()+" [-p prime] [-n width] [-m mod] [-s min] [-S max] file");
    1.17+	arg->setusage(arg->progname()+" [-dv] [-p prime] [-n width] [-m mod] [-s min] [-S max] file");
    1.18 	while((c := arg->opt()) != 0)
    1.19 		case c {
    1.20 		'd' =>	dflag++;
    1.21+		'v' =>	vflag++;
    1.22 		'p' =>	p = int arg->earg();
    1.23 		'n' =>	n = int arg->earg();
    1.24 		'm' =>	m = int arg->earg();
    1.25@@ -75,10 +76,12 @@
    1.26 			fail("rfile read: "+err);
    1.27 		if(len d == 0)
    1.28 			break;
    1.29-		score := sha1(d);
    1.30 		nblocks++;
    1.31 		nbytes += len d;
    1.32-		print("offset=%bd, score=%s len=%d\n", off, score, len d);
    1.33+		if(vflag) {
    1.34+			score := sha1(d);
    1.35+			print("offset=%bd, score=%s len=%d\n", off, score, len d);
    1.36+		}
    1.37 	}
    1.38 	mean := 0;
    1.39 	if(nblocks > 0)