# Parse the sfsres log file generated by SPECsfs to generate more detailed
# latency statistics than in the sfssum summary file.
-import re, sys
+import re, subprocess, sys
def extract_re(lines, regexp):
if isinstance(regexp, str):
OPERATIONS = ('read', 'write', 'create', 'setattr', 'lookup', 'getattr')
+def parse_date(datestr):
+ p = subprocess.Popen(['/bin/date', '-d', datestr, '+%s'],
+ stdout=subprocess.PIPE)
+ d = p.stdout.read()
+ p.wait()
+ return int(d.strip())
+
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")
+ timestamp = extract_re(lines, r"SFS Aggregate Results.*, (.*)")
+ if timestamp is not None:
+ try:
+ timestamp = parse_date(timestamp.group(1))
+ except:
+ timestamp = None
# Extract the stable of per-operation counts, response times, etc.
regexp = re.compile(r"^(\w+)" + r"\s*([\d.]+)%?" * 9)
#sys.stderr.write("Error parsing line: " + l.strip() + "\n")
pass
+ outfp.write("# finish_timestamp: " + str(timestamp) + "\n")
outfp.write("%d\t%s\t%s" % (load, results.group(1), results.group(2)))
for o in OPERATIONS:
val = '-'