Skip to content

Commit

Permalink
Fix report builder
Browse files Browse the repository at this point in the history
  • Loading branch information
gaogaotiantian committed Nov 19, 2024
1 parent f470246 commit 0d1796a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/viztracer/report_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ def combine_json(self) -> None:
if one.get("viztracer_metadata", {}).get("baseTimeNanoseconds") is not None:
self.combined_json["viztracer_metadata"]["baseTimeNanoseconds"] = \
one["viztracer_metadata"]["baseTimeNanoseconds"]
if "file_info" in one:
if "file_info" not in self.combined_json:
self.combined_json["file_info"] = {"files": {}, "functions": {}}

Check warning on line 137 in src/viztracer/report_builder.py

View check run for this annotation

Codecov / codecov/patch

src/viztracer/report_builder.py#L137

Added line #L137 was not covered by tests
self.combined_json["file_info"]["files"].update(one["file_info"]["files"])
self.combined_json["file_info"]["functions"].update(one["file_info"]["functions"])

def align_events(self, original_events: list[dict[str, Any]]) -> list[dict[str, Any]]:
"""
Expand Down Expand Up @@ -166,7 +171,8 @@ def prepare_json(self, file_info: bool = True, display_time_unit: Optional[str]
self.combined_json["viztracer_metadata"]["baseTimeNanoseconds"] = self.base_time

if file_info:
self.combined_json["file_info"] = {"files": {}, "functions": {}}
if "file_info" not in self.combined_json:
self.combined_json["file_info"] = {"files": {}, "functions": {}}
pattern = re.compile(r".*\((.*):([0-9]*)\)")
file_dict = self.combined_json["file_info"]["files"]
func_dict = self.combined_json["file_info"]["functions"]
Expand Down

0 comments on commit 0d1796a

Please sign in to comment.