#! /usr/bin/perl -w
#
# $Id: cp_test_counts.pl 316 2015-05-31 20:29:44Z fabien $
#
# show the % of skipped and over-the-limit transactions from pgbench output.
#
use strict;
my ($processed, $skipped, $limit);
while (<>) {
  if (/^number of transactions /) {
    $processed = $1 if /processed: (\d+)/;
    $skipped = $1 if /skipped: (\d+)/;
    $limit = $1 if /limit: (\d+)/;
    if (defined $processed and defined $skipped and defined $limit) {
      print 100.0 * ($skipped + $limit) / ($processed + $skipped), "\n";
      ($processed, $skipped, $limit) = (undef, undef, undef);
    }
  }
}
