From de5044cfe088449bba6d74d2f51540174880dac1 Mon Sep 17 00:00:00 2001 From: "Bobby R. Bruce" Date: Mon, 30 Jan 2023 01:09:45 +0000 Subject: [PATCH] stdlib: Change the default Looppoint JSON output to m5out Change-Id: I6ac9aa55dfd4a0250c487ae743a1f4ea0b1bc154 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/67491 Reviewed-by: Bobby Bruce Tested-by: kokoro Maintainer: Bobby Bruce --- src/python/gem5/utils/looppoint.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/python/gem5/utils/looppoint.py b/src/python/gem5/utils/looppoint.py index b681e75fee..d1851a8478 100644 --- a/src/python/gem5/utils/looppoint.py +++ b/src/python/gem5/utils/looppoint.py @@ -34,6 +34,8 @@ from m5.objects import PcCountTrackerManager import csv import re import json +import m5 +import os class LoopPoint: @@ -106,14 +108,16 @@ class LoopPoint: self._json_file[rid]["simulation"]["end"]["relative"] = int(temp) def output_json_file( - self, input_indent: int = 4, filename: str = "outdir.json" + self, + input_indent: int = 4, + filepath: str = os.path.join(m5.options.outdir, "outdir.json"), ) -> Dict[int, Dict]: """ This function is used to output the _json_file into a json file :param input_indent: the indent value of the json file - :param filename: the name of the output file + :param filepath: the path of the output file """ - with open(filename, "w") as file: + with open(filepath, "w") as file: json.dump(self._json_file, file, indent=input_indent) def get_current_region(self) -> int: