#! /usr/bin/env python
#
# $Id: cp_test_counts.py 316 2015-05-31 20:29:44Z fabien $
#
# show the % of skipped and over-the-limit transactions from pgbench output.
#

import re
import fileinput
d = {}

for line in fileinput.input():
	if line.find("number of transactions ") == 0:
		for kw in ['processed', 'skipped', 'limit']:
			if line.find(kw + ": ") != -1:
				d[kw] = int(re.search(kw + ": (\d+)", line).group(1))
		if len(d) == 3:
			print("%f" % (100.0 * (d['skipped']+d['limit']) / (d['processed'] + d['skipped'])))
			d = {}
