#!/usr/bin/perl # #include # If you speak perl, and are offended by the code herein, I apologise. # Please feel free to tidy it up. # Syntax: squeeze2html.pl < in > out.html # or (more usefully): # squeeze2html.pl -q < in > out.html # (to hide the ones that passed) # Setup steps: # 1) make debug XCFLAGS="-DMEMENTO" # 2) MEMENTO_SQUEEZEAT=1 gs -sDEVICE=png16m -o /dev/null 2>&1 > log # Options my $quiet = 0; # Handle options: use Getopt::Std; my %opts; getopts('q', \%opts); if ($opts{q} == 1) { $quiet = 1; } # First we output the headers, our javascript code, and an empty table. print "\n\nMemory squeeze results\n"; print "\n"; print "\n"; print ""; print "
"; # Now we process the input. my $at = 1; my $i; my $text = ""; my $status; my $started; LINE: while (my $line = <>) { chomp $line; if (($i) = $line =~ m/SEGV after Memory squeezing @ (\d+)/) { $status |= 8; } elsif (($i) = $line =~ m/Memory squeezing @ (\d+) complete/) { $status |= 2; if ($started) { if (($quiet == 0) || (($at & 1) == 1) || (($status & 12) != 0)) { print "$text"; } if ($at & 1) { } elsif ($status & 8) { print ""; } elsif ($status & 4) { print ""; } elsif ($quiet == 0) { print ""; } } $started = 0; $text = ""; $at |= 1; next LINE; } elsif (($i) = $line =~ m/Memory squeezing @ (\d+)/) { if ($started) { if (($quiet == 0) || (($at & 1) == 1) || (($status & 12) != 0)) { print "$text"; } if ($at & 1) { } elsif ($status & 8) { print ""; } elsif ($status & 4) { print ""; } elsif ($quiet == 0) { print ""; } } $at = $i * 2; $started = 0; $status = 1; next LINE; } elsif ($line =~ m/Allocated blocks:/) { $status |= 4; } if ($started == 0) { $text = "
$line";
	$started = 1;
    } else {
        $text = $text."\n".$line;
    }
}
if ($started) {
  if (($quiet == 0) || (($at & 1) == 1) || (($status & 12) != 0)) {
    print "$text
"; } if ($at & 1) { } elsif ($status & 8) { print ""; } elsif ($status & 4) { print ""; } elsif ($quiet == 0) { print ""; } } print "";