Skip to content

Commit

Permalink
et_jsonizer: Refactor et_jsonizer
Browse files Browse the repository at this point in the history
  • Loading branch information
TaekyungHeo committed Feb 6, 2024
1 parent 120ce3d commit b687146
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions utils/et_jsonizer/et_jsonizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,33 @@

def main() -> None:
parser = argparse.ArgumentParser(
description="Execution Trace Jsonizer"
description="Converts Chakra execution trace to JSON format."
)
parser.add_argument(
"--input_filename",
type=str,
default=None,
required=True,
help="Input Chakra execution trace filename"
help="Specifies the input filename of the Chakra execution trace."
)
parser.add_argument(
"--output_filename",
type=str,
default=None,
required=True,
help="Output filename"
help="Specifies the output filename for the JSON data."
)
args = parser.parse_args()

et = open_file_rd(args.input_filename)
execution_trace = open_file_rd(args.input_filename)
node = ChakraNode()
with open(args.output_filename, 'w') as f:
gm = GlobalMetadata()
decode_message(et, gm)
f.write(MessageToJson(gm))
while decode_message(et, node):
f.write(MessageToJson(node))
et.close()
with open(args.output_filename, 'w') as file:
global_metadata = GlobalMetadata()
decode_message(execution_trace, global_metadata)
file.write(MessageToJson(global_metadata))
while decode_message(execution_trace, node):
file.write(MessageToJson(node))
execution_trace.close()


if __name__ == "__main__":
main()

0 comments on commit b687146

Please sign in to comment.