4 # Parse the sfsres log file generated by SPECsfs to generate more detailed
5 # latency statistics than in the sfssum summary file.
9 def extract_re(lines, regexp):
10 if isinstance(regexp, str):
11 regexp = re.compile(regexp)
16 def parse_run(lines, timestamp, outfp=sys.stdout):
18 requested_load = extract_re(lines, r"\s*Requested Load.*= (\d+)")
19 load = int(requested_load.group(1))
20 results = extract_re(lines, r"SFS NFS THROUGHPUT:\s*([\d.]+).*RESPONSE TIME:\s*([\d.]+) Msec/Op")
22 # Extract the stable of per-operation counts, response times, etc.
23 regexp = re.compile(r"^(\w+)" + r"\s*([\d.]+)%?" * 9)
28 table[m.group(1)] = [float(m.group(i)) for i in range(2, 11)]
30 outfp.write("%d\t%s\t%s" % (load, results.group(1), results.group(2)))
31 for o in ('read', 'write', 'getattr'):
32 outfp.write("\t%s\t%s" % (table[o][5], table[o][6]))
39 m = re.match(r"^([^*]+) \*{32,}$", line)
42 parse_run(run_data, timestamp)
44 timestamp = m.group(1)
48 parse_run(run_data, timestamp)
50 if __name__ == '__main__':
51 parse_sfsres(sys.stdin)