Author: Armin Rigo <ar...@tunes.org> Branch: extradoc Changeset: r4717:b63d6d57fa04 Date: 2012-08-21 18:23 +0200 http://bitbucket.org/pypy/extradoc/changeset/b63d6d57fa04/
Log: merge heads diff --git a/talk/vmil2012/tool/guard_info.py b/talk/vmil2012/tool/guard_info.py new file mode 100644 --- /dev/null +++ b/talk/vmil2012/tool/guard_info.py @@ -0,0 +1,63 @@ +from pypy.tool import logparser +from backenddata import collect_logfiles +import json +import os +import optparse +import sys + + +def extract_guards(dirname, logs): + for exe, bench, log in logs: + path = os.path.join(dirname, log) + logfile = logparser.parse_log_file(path) + guarddata = [line + for sec in logparser.extract_category(logfile, 'jit-log-opt') + for line in sec.splitlines() + if line.find('<Guard') >= 0] + yield bench, guarddata + + +def extract_guard_name(logline): + return logline[logline.index('guard'):logline.index('(')].strip() + + +def get_failure_info(results, guards): + guards_by_failure = sorted(results.iteritems(), + key=lambda x: x[1], + reverse=True) + + for guard, failures in guards_by_failure: + g = [x for x in guards if x.find('Guard%s>' % guard) >= 0] + if len(g) != 1: + print "Uhhh", g + + g = g[0] + yield failures, guard, extract_guard_name(g) + + +def main(path): + logs = collect_logfiles(path) + if os.path.isdir(path): + dirname = path + else: + dirname = os.path.dirname(path) + results = extract_guards(dirname, logs) + with file("logs/guard_summary.json") as f: + failure_info = json.load(f) + with file("logs/guard_failure_data.txt", "w") as f: + for bench, guards in results: + print >>f, "Benchmark", bench + for failures, guard, data in \ + get_failure_info(failure_info[bench]['results'], guards): + print >>f, failures, guard, data + + +if __name__ == '__main__': + parser = optparse.OptionParser(usage="%prog logdir_or_file") + + options, args = parser.parse_args() + if len(args) != 1: + parser.print_help() + sys.exit(2) + else: + main(args[0]) _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit