summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2021-03-24 11:39:20 +0100
committerDaniel Friesel <daniel.friesel@uos.de>2021-03-24 11:39:20 +0100
commit422fbfd6ba25b20d115adaae8180875840f7df15 (patch)
tree0a63f093af1b1d9cdde864892ce0acdab9d72e6f
parent0f2a3b9b68dae48df99b8fa5b54e3e6123c7ccca (diff)
Add nearly correct JSON export for v0 measurements without PTA definition
Transition source/destination names are not correct yet
-rwxr-xr-xbin/analyze-archive.py6
-rw-r--r--lib/model.py5
2 files changed, 7 insertions, 4 deletions
diff --git a/bin/analyze-archive.py b/bin/analyze-archive.py
index 701096d..869d32e 100755
--- a/bin/analyze-archive.py
+++ b/bin/analyze-archive.py
@@ -1157,9 +1157,8 @@ if __name__ == "__main__":
if args.export_webconf:
if not pta:
print(
- "[E] --export-energymodel requires --hwmodel to be set", file=sys.stderr
+ "Note: v0 measurements do not embed the PTA used for benchmark generation. Estimating PTA from recorded observations."
)
- sys.exit(1)
json_model = model.to_json()
mogrify(json_model)
json_model_str = json.dumps(json_model, indent=2, sort_keys=True, cls=NpEncoder)
@@ -1179,9 +1178,8 @@ if __name__ == "__main__":
if args.export_energymodel:
if not pta:
print(
- "[E] --export-energymodel requires --hwmodel to be set", file=sys.stderr
+ "Note: v0 measurements do not embed the PTA used for benchmark generation. Estimating PTA from recorded observations."
)
- sys.exit(1)
json_model = model.to_json()
with open(args.export_energymodel, "w") as f:
json.dump(json_model, f, indent=2, sort_keys=True, cls=NpEncoder)
diff --git a/lib/model.py b/lib/model.py
index 5000caa..ea89a4e 100644
--- a/lib/model.py
+++ b/lib/model.py
@@ -793,6 +793,11 @@ class PTAModel(AnalyticModel):
pta = self.pta
if pta is None:
pta = PTA(self.states, parameters=self._parameter_names)
+ logger.warning(
+ "to_json: self.pta is None. Transitions will have incorrect origin/destination states."
+ )
+ for transition in self.transitions:
+ pta.add_transition("UNINITIALIZED", "UNINITIALIZED", transition)
pta.update(
param_info, static_error=static_quality, function_error=analytic_quality
)