<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/afs/athena/contrib/perl/perl5

sub sample {
    local($what,$x,$count) = @_;

    if (!$count) { $count = 1; }

    push(@{$samples{$what}}, ($x)x$count);
    $sum{$what} += $x*$count;
    $sumsquare{$what} += $x*$x*$count;
    $count{$what} += $count;
}

sub mean { $sum{$_[0]}/$count{$_[0]}; }

sub stddev { sqrt(($sumsquare{$_[0]}/$count{$_[0]})-
		  ($sum{$_[0]}/$count{$_[0]})*($sum{$_[0]}/$count{$_[0]})); }

sub stats {
    local($what) = @_;

    if (!$count{$what}) {
	print "no stats for $what\n\n";
    } else {
	print " count $what = ",$count{$what},"\n";
	print "  mean $what = ",&amp;mean($what),"\n";
	@tmp = (sort {$a&lt;=&gt;$b} @{$samples{$what}});
	print "median $what = ",$tmp[$#tmp/2],"\n";
	print "stddev $what = ",&amp;stddev($what),"\n";
	print "\n";
    }
}

while(&lt;&gt;) {
    chop;

    /^.........\s+(\d+)\s+(\d+):(\d+):(\d+)........../ || next;;

    ### offset in seconds from midnight, 1 october 1995
    $time = ($1-1)*86400+$2*3600+$3*60+$4;
    $msg = $';

    $firsttime = $time if !$firsttime;
    $lasttime = $time;

    if ($msg =~ /process-batch begins/i) {
	$batchstart = $time;
    } elsif ($msg =~ /posting incremental/i) {
	$incrstart = $time;
	$nchanges = 0;
    } elsif ($msg =~ /changed this run/i) {
	$nchanges++;
    } elsif ($msg =~ /incremental posted/i) {
	&amp;sample("time:incr",$time-$incrstart);
	&amp;sample("time:add",$time-$incrstart);
	&amp;sample("size:incr",$nchanges);
	&amp;sample("time:incrchange",($time-$incrstart)/$nchanges,$nchanges)
	    if $nchanges;
    } elsif ($msg =~ /adding key from/i) {
	$humanstart = $time;
	$nchanges = 0;
    } elsif ($msg =~ /mailing.*index to/i) {
	$indexstart = $time;
    } elsif ($msg =~ /mailing key for/i) {
	$getstart = $time;
    } elsif ($msg =~ /mailing keys updated/i) {
	$laststart = $time;
    } elsif ($msg =~ /process-batch ends/i) {
	&amp;sample("time:batch",$time-$batchstart);
	if ($humanstart) {
	    &amp;sample("time:human",$time-$humanstart);
	    &amp;sample("time:add",$time-$humanstart);
	    &amp;sample("size:human",$nchanges);
	    &amp;sample("time:humanchange",($time-$humanstart)/$nchanges,$nchanges)
		if $nchanges;
	    $humanstart = 0;
	}
	if ($getstart) {
	    &amp;sample("time:get",$time-$getstart);
	    $getstart = 0;
	}
	if ($indexstart) {
	    &amp;sample("time:index",$time-$indexstart);
	    $indexstart = 0;
	}
	if ($laststart) {
	    &amp;sample("time:last",$time-$laststart);
	    $laststart = 0;
	}
    } elsif ($msg =~ /processing incoming/i) {
	if ($humanstart) {
	    &amp;sample("time:human",$time-$humanstart);
	    &amp;sample("time:add",$time-$humanstart);
	    &amp;sample("size:human",$nchanges);
	    &amp;sample("time:humanchange",($time-$humanstart)/$nchanges,$nchanges)
		if $nchanges;
	    $humanstart = 0;
	}
	if ($getstart) {
	    &amp;sample("time:get",$time-$getstart);
	    $getstart = 0;
	}
	if ($indexstart) {
	    &amp;sample("time:index",$time-$indexstart);
	    $indexstart = 0;
	}
	if ($laststart) {
	    &amp;sample("time:last",$time-$laststart);
	    $laststart = 0;
	}
    }
}

&amp;stats("time:batch");
&amp;stats("time:add");
&amp;stats("time:incr");
&amp;stats("time:get");
&amp;stats("time:index");
&amp;stats("time:last");
&amp;stats("time:human");
&amp;stats("time:incrchange");
&amp;stats("time:humanchange");
&amp;stats("size:incr");
&amp;stats("size:human");

print "total time is ",$lasttime-$firsttime," seconds (",
    ($lasttime-$firsttime)/86400," days).\n";

##   1 File contains public keys
##   2 Posting incremental...
##   3 Adding key from xxxx
##   4 KeyID 0xaaaa changed this run
##   5 Already seen by pgp-public-keys@xxxx
##   6 Extracting keyid 0xaaaa...
##   7 Incremental to xxxx...
##   8 Incremental posted.
##   
##   1 2 4+ 5* 6+ 7+ 8	incremental from another server with changes
##   1 2 8			incremental from another server without changes
##   1 3 4+ 6+ 7+		key from human with changes
##   1 3			key from human without changes
</pre></body></html>