From 980e6f5142ac13edc19f5f69fe889817c37eb1fa Mon Sep 17 00:00:00 2001 From: flying Date: Sun, 24 Dec 2023 03:36:18 +0000 Subject: [PATCH 1/3] update tools/rom_ram_analyzer/lite_small/src/config.py. Signed-off-by: flying --- tools/rom_ram_analyzer/lite_small/src/config.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/rom_ram_analyzer/lite_small/src/config.py b/tools/rom_ram_analyzer/lite_small/src/config.py index 9049816..be78195 100644 --- a/tools/rom_ram_analyzer/lite_small/src/config.py +++ b/tools/rom_ram_analyzer/lite_small/src/config.py @@ -50,6 +50,8 @@ def parse_args(): help="add baseline of component to the result(-b) or not.") parser.add_argument("-u", "--unit_adaptive", action="store_true", help="unit adaptive") + parser.add_argument("-f", "--output_file", type=str, default="rom_analysis_result", + help="basename of output file, default: rom_analysis_result. eg: rom_analysis_result") args = parser.parse_args() return args @@ -68,6 +70,7 @@ project_path = BasicTool.abspath(_args.oh_path) recollect_gn = _args.recollect_gn baseline = _args.baseline unit_adapt = _args.unit_adaptive +output_file = _args.output_file _recollect_sc = _args.recollect_sc _sc_json: Dict[Text, Text] = configs.get("subsystem_component") _sc_save = _sc_json.get("save") -- Gitee From 32ed3da92581d8938291dd90527a83cdff129387 Mon Sep 17 00:00:00 2001 From: flying Date: Sun, 24 Dec 2023 03:38:44 +0000 Subject: [PATCH 2/3] update tools/rom_ram_analyzer/lite_small/src/rom_analysis.py. Signed-off-by: flying --- tools/rom_ram_analyzer/lite_small/src/rom_analysis.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/rom_ram_analyzer/lite_small/src/rom_analysis.py b/tools/rom_ram_analyzer/lite_small/src/rom_analysis.py index 54e3986..2cf3fb0 100644 --- a/tools/rom_ram_analyzer/lite_small/src/rom_analysis.py +++ b/tools/rom_ram_analyzer/lite_small/src/rom_analysis.py @@ -29,7 +29,7 @@ from threading import RLock import collections from config import result_dict, collector_config, configs, \ - project_path, sub_com_dict, product_name, recollect_gn, baseline, unit_adapt + project_path, sub_com_dict, product_name, recollect_gn, baseline, unit_adapt, output_file from pkgs.basic_tool import BasicTool, unit_adaptive from pkgs.gn_common_tool import GnCommonTool from pkgs.simple_excel_writer import SimpleExcelWriter @@ -393,7 +393,7 @@ class RomAnalysisTool: type_list, gn_info, gn_info_file, base_name, rom_ram_baseline, rom_size_dict, f, size) @classmethod - def analysis(cls, product_name: str, product_dict: Dict[str, List[str]]): + def analysis(cls, product_name: str, product_dict: Dict[str, List[str]], output_file_name: str): """analysis the rom of lite/small product Args: @@ -423,7 +423,7 @@ class RomAnalysisTool: product_dict, query_order, gn_info, gn_info_file, rom_ram_baseline, rom_size_dict) if unit_adapt: cls._result_unit_adaptive(rom_size_dict) - with open(configs[product_name]["output_name"], 'w', encoding='utf-8') as f: + with open(output_file_name + ".json", 'w', encoding='utf-8') as f: json.dump(rom_size_dict, f, indent=4) cls._save_as_xls(rom_size_dict, product_name, baseline) logging.info("success") @@ -434,7 +434,7 @@ def main(): RomAnalysisTool.collect_gn_info() product_dict: Dict[str, List[str] ] = RomAnalysisTool.collect_product_info(product_name) - RomAnalysisTool.analysis(product_name, product_dict) + RomAnalysisTool.analysis(product_name, product_dict, output_file) if __name__ == "__main__": -- Gitee From e31ddc0ac9d540e3af6f9ce884cbd869e2ec132c Mon Sep 17 00:00:00 2001 From: flying Date: Sun, 24 Dec 2023 07:29:17 +0000 Subject: [PATCH 3/3] update tools/rom_ram_analyzer/lite_small/src/rom_analysis.py. Signed-off-by: flying --- tools/rom_ram_analyzer/lite_small/src/rom_analysis.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/rom_ram_analyzer/lite_small/src/rom_analysis.py b/tools/rom_ram_analyzer/lite_small/src/rom_analysis.py index 2cf3fb0..bd2e91f 100644 --- a/tools/rom_ram_analyzer/lite_small/src/rom_analysis.py +++ b/tools/rom_ram_analyzer/lite_small/src/rom_analysis.py @@ -251,7 +251,8 @@ class RomAnalysisTool: component_end_row = 0 component_col = 1 baseline_col = 2 - del tmp_dict["size"] + if "size" in tmp_dict.keys(): + del tmp_dict["size"] for subsystem_name in tmp_dict.keys(): subsystem_dict = tmp_dict.get(subsystem_name) subsystem_size = subsystem_dict.get("size") -- Gitee