From 9b83049f6c8e5b7780125865b65b191a61d69701 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 29 Jun 2023 16:50:27 +0200 Subject: analyze-log: add --export-model suport --- bin/analyze-log.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'bin') diff --git a/bin/analyze-log.py b/bin/analyze-log.py index 444ecd2..2846d7c 100755 --- a/bin/analyze-log.py +++ b/bin/analyze-log.py @@ -12,6 +12,7 @@ import dfatool.utils from dfatool.model import AnalyticModel from dfatool.validation import CrossValidator from functools import reduce +import json import re @@ -105,6 +106,9 @@ def main(): action="store_true", help="Build decision tree without checking for analytic functions first", ) + parser.add_argument( + "--export-model", metavar="FILE", type=str, help="Export JSON model to FILE" + ) parser.add_argument( "logfiles", nargs="+", type=str, help="Path to benchmark output" ) @@ -209,6 +213,14 @@ def main(): [None, param_info, None], ) + if args.export_model: + print(f"Exportding model to {args.export_model}") + json_model = model.to_json() + with open(args.export_model, "w") as f: + json.dump( + json_model, f, indent=2, sort_keys=True, cls=dfatool.utils.NpEncoder + ) + if args.plot_param: for kv in args.plot_param.split(";"): try: -- cgit v1.2.3