From: Michael Vrable Date: Wed, 16 Mar 2011 00:14:38 +0000 (-0700) Subject: Extract wall clock timestamp of each run when parsing sfsres files X-Git-Url: http://git.vrable.net/?p=bluesky.git;a=commitdiff_plain;h=490c895cffe84e393268d62ac27962c5812225f7 Extract wall clock timestamp of each run when parsing sfsres files --- diff --git a/results/parse-sfsres.py b/results/parse-sfsres.py index 7890715..14105f8 100755 --- a/results/parse-sfsres.py +++ b/results/parse-sfsres.py @@ -4,7 +4,7 @@ # 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): @@ -15,11 +15,24 @@ def extract_re(lines, regexp): 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) @@ -33,6 +46,7 @@ def parse_run(lines, timestamp, outfp=sys.stdout): #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 = '-'