From 0d1796aab14bb8a8f4686d58c3f41ae5d98675a0 Mon Sep 17 00:00:00 2001 From: Tian Gao Date: Mon, 18 Nov 2024 23:33:51 -0500 Subject: [PATCH] Fix report builder --- src/viztracer/report_builder.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/viztracer/report_builder.py b/src/viztracer/report_builder.py index 4c0bc37e..bcf2731b 100644 --- a/src/viztracer/report_builder.py +++ b/src/viztracer/report_builder.py @@ -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": {}} + 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]]: """ @@ -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"]