#!/usr/bin/perl

$count= 20;
$exp= 1.3;
$first= 1.0;

print <<END or die $!;
#define SPEEDYCOUNT $count

typedef struct {
  Retransmit__Time interval; /* interval after this retransmission */
  DLIST2_HEAD(RetransmitUrgentNode) queue; /* msgs transmitted ix times */
} PerSpeedyTrans;

END

for ($ix=0, $accum=0; $ix<$count; $ix++) {
    $val= int($first * $exp**$ix + 0.49);
    $accum += $val;
    push @s, sprintf("  { %3d } /* %3s cum=%3d cumforother=%3d".
		     " use=%3d%% cumuse=%3d%% */",
		     $val, "#$ix", $accum, $accum-($ix+1),
		     (100.0/$val), (100.0*($ix+1))/$accum);
}

print("#define SPEEDIESINIT { \\\n",
      join(", \\\n", @s),
      "  \\\n }\n")
    or die $!;
