diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2022-08-24 14:45:16 +0200 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2022-08-24 14:45:16 +0200 |
commit | f6953fff8e50d7897175a2b10018c5d1c6b3f03e (patch) | |
tree | 083be27ab291b4d6f255400d42d24e56624307cb | |
parent | f88cfb62b6b527fc7bff15f49e99e6920a13502e (diff) |
analyze-kconfig: add --plot-param option
-rwxr-xr-x | bin/analyze-kconfig.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/bin/analyze-kconfig.py b/bin/analyze-kconfig.py index 1ff98cf..02fc5a5 100755 --- a/bin/analyze-kconfig.py +++ b/bin/analyze-kconfig.py @@ -153,6 +153,16 @@ def main(): type=str, help="Ignore listed parameters during model generation", ) + parser.add_argument( + "--plot-param", + metavar="<name> <attribute> <parameter> [gplearn function][;<name> <attribute> <parameter> [function];...])", + type=str, + help="Plot measurements for <name> <attribute> by <parameter>. " + "X axis is parameter value. " + "Plots the model function as one solid line for each combination of non-<parameter> parameters. " + "Also plots the corresponding measurements. " + "If gplearn function is set, it is plotted using dashed lines.", + ) parser.add_argument("kconfig_path", type=str, help="Path to Kconfig file") parser.add_argument( "model", @@ -304,6 +314,30 @@ def main(): if args.export_pgf_unparam: dfatool.cli.export_pgf_unparam(model, args.export_pgf_unparam) + if args.plot_param: + from dfatool import plotter + + for kv in args.plot_param.split(";"): + try: + state_or_trans, attribute, param_name, *function = kv.split(" ") + except ValueError: + print( + "Usage: --plot-param='state_or_trans attribute param_name [additional function spec]'", + file=sys.stderr, + ) + sys.exit(1) + if len(function): + function = gplearn_to_function(" ".join(function)) + else: + function = None + plotter.plot_param( + model, + state_or_trans, + attribute, + model.param_index(param_name), + extra_function=function, + ) + if args.cross_validate: xv_method, xv_count = args.cross_validate.split(":") xv_count = int(xv_count) |