From 47affe16abdb32408d6cb6a0b83f4e540f1f7707 Mon Sep 17 00:00:00 2001 From: Michael Vrable Date: Sun, 6 Mar 2011 15:27:51 -0800 Subject: [PATCH] Script for parsing sfsres files to extract more detailed latency values --- results/parse-sfsres.py | 51 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100755 results/parse-sfsres.py diff --git a/results/parse-sfsres.py b/results/parse-sfsres.py new file mode 100755 index 0000000..96de28a --- /dev/null +++ b/results/parse-sfsres.py @@ -0,0 +1,51 @@ +#!/usr/bin/python +# coding=utf-8 +# +# Parse the sfsres log file generated by SPECsfs to generate more detailed +# latency statistics than in the sfssum summary file. + +import re, sys + +def extract_re(lines, regexp): + if isinstance(regexp, str): + regexp = re.compile(regexp) + for l in lines: + m = regexp.match(l) + if m: return m + +def parse_run(lines, timestamp, outfp=sys.stdout): + #print timestamp + requested_load = extract_re(lines, r"\s*Requested Load.*= (\d+)") + load = int(requested_load.group(1)) + results = extract_re(lines, r"SFS NFS THROUGHPUT:\s*([\d.]+).*RESPONSE TIME:\s*([\d.]+) Msec/Op") + + # Extract the stable of per-operation counts, response times, etc. + regexp = re.compile(r"^(\w+)" + r"\s*([\d.]+)%?" * 9) + table = {} + for l in lines: + m = regexp.match(l) + if m: + table[m.group(1)] = [float(m.group(i)) for i in range(2, 11)] + + outfp.write("%d\t%s\t%s" % (load, results.group(1), results.group(2))) + for o in ('read', 'write', 'getattr'): + outfp.write("\t%s\t%s" % (table[o][5], table[o][6])) + outfp.write("\n") + +def parse_sfsres(fp): + timestamp = None + run_data = [] + for line in fp: + m = re.match(r"^([^*]+) \*{32,}$", line) + if m: + if len(run_data) > 0: + parse_run(run_data, timestamp) + run_data = [] + timestamp = m.group(1) + else: + run_data.append(line) + if len(run_data) > 0: + parse_run(run_data, timestamp) + +if __name__ == '__main__': + parse_sfsres(sys.stdin) -- 2.20.1