Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docstrings and enhance help messages in visualizer #93

Merged
merged 1 commit into from
Jun 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions src/visualizer/visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
import graphviz
import networkx as nx

from ...schema.protobuf.et_def_pb2 import (
GlobalMetadata,
Node,
)
from ...schema.protobuf.et_def_pb2 import GlobalMetadata, Node
from ..third_party.utils.protolib import decodeMessage as decode_message
from ..third_party.utils.protolib import openFileRd as open_file_rd

Expand All @@ -31,11 +28,23 @@ def escape_label(label: str) -> str:


def main() -> None:
"""
Main function for the Execution Trace Visualizer.

This function parses command-line arguments, reads the input Chakra execution trace file,
and generates an output graph file in the specified format (PDF, DOT, or GraphML).
"""
parser = argparse.ArgumentParser(description="Execution Trace Visualizer")
parser.add_argument("--input_filename", type=str, required=True, help="Input Chakra execution trace filename")
parser.add_argument(
"--input_filename", type=str, default=None, required=True, help="Input Chakra execution trace filename"
"--output_filename",
type=str,
required=True,
help=(
"Output graph filename. Supported extensions are pdf, dot, and graphml. "
"Recommend using graphml for large graphs for rendering speed."
),
)
parser.add_argument("--output_filename", type=str, default=None, required=True, help="Output graph filename")
args = parser.parse_args()

et = open_file_rd(args.input_filename)
Expand Down
Loading