From 0276130703207f1584c37ede7f618df8a2763e3c Mon Sep 17 00:00:00 2001 From: fanglanyue Date: Wed, 5 Feb 2025 14:46:13 +0800 Subject: [PATCH] profiler/msprof_analyze/test cleancode part2 --- profiler/msprof_analyze/test/run_ut.py | 4 +- ...t_advisor_cmd_cluster_ascend_pt_compare.py | 127 +++++++++--------- .../test_kernel_cluster_advice.py | 3 +- .../timeline_advice/test_opsche_advice.py | 3 +- .../timeline_advice/test_optimizer_advice.py | 6 +- .../advisor/common/test_enum_params_parser.py | 3 +- .../test_synchronize_stream.py | 3 +- .../common_func/test_file_manager.py | 3 +- .../test_communication_comparator.py | 14 ++ .../comparator/test_operator_comparator.py | 14 ++ .../test_operator_statistic_comparator.py | 17 ++- .../origin_data_bean/test_compare_event.py | 14 ++ .../test_kernel_details_bean.py | 14 ++ .../test_memory_record_bean.py | 14 ++ .../test_operator_memory_bean.py | 14 ++ .../origin_data_bean/test_trace_event_bean.py | 14 ++ .../compare_bean/test_communication_bean.py | 14 ++ .../compare_bean/test_memory_compare_bean.py | 14 ++ .../test_memory_statistic_bean.py | 14 ++ .../test_operator_compare_bean.py | 14 ++ .../test_operator_statistic_bean.py | 14 ++ .../compare_bean/test_profiling_info.py | 15 ++- .../test_base_profiling_parser.py | 14 ++ .../test_gpu_profiling_parser.py | 14 ++ .../test_npu_profiling_parser.py | 18 ++- .../compare_tools/utils/test_name_function.py | 14 ++ .../compare_tools/utils/test_tree_builder.py | 14 ++ .../ut/compare_tools/view/test_excel_view.py | 14 ++ .../ut/compare_tools/view/test_screen_view.py | 14 ++ .../view/test_worker_sheet_creator.py | 14 ++ 30 files changed, 392 insertions(+), 76 deletions(-) diff --git a/profiler/msprof_analyze/test/run_ut.py b/profiler/msprof_analyze/test/run_ut.py index 891bf82de3..24378edb2c 100644 --- a/profiler/msprof_analyze/test/run_ut.py +++ b/profiler/msprof_analyze/test/run_ut.py @@ -17,6 +17,7 @@ import shutil import subprocess import sys + def set_python_path(): cluster_analyse_root = os.path.join( os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "cluster_analyse") @@ -71,7 +72,8 @@ def run_ut(): return ut_status -if __name__=="__main__": + +if __name__ == "__main__": set_python_path() ut_success = run_ut() if ut_success: diff --git a/profiler/msprof_analyze/test/st/dev/test_advisor_cmd_cluster_ascend_pt_compare.py b/profiler/msprof_analyze/test/st/dev/test_advisor_cmd_cluster_ascend_pt_compare.py index 0a5eb062b1..99698cdeea 100644 --- a/profiler/msprof_analyze/test/st/dev/test_advisor_cmd_cluster_ascend_pt_compare.py +++ b/profiler/msprof_analyze/test/st/dev/test_advisor_cmd_cluster_ascend_pt_compare.py @@ -30,18 +30,18 @@ class TestAdvisorCmdClusterAscendPtCompare(TestCase): BASE_PROFILING_PATH = os.path.join(ST_DATA_PATH, "cluster_data_2") COMPARISON_PROFILING_PATH = os.path.join(ST_DATA_PATH, "cluster_data_1") OUTPUT_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)), "TestAdvisorCmdClusterAscendPtCompare") - ALL_OUTPUT_PATH = os.path.join(OUTPUT_PATH,"all") + ALL_OUTPUT_PATH = os.path.join(OUTPUT_PATH, "all") RESULT_EXCEL = {} RESULT_HTML = {} COMMAND_SUCCESS = 0 def setup_class(self): PathManager.make_dir_safety(self.ALL_OUTPUT_PATH) - cmd_all = ["msprof-analyze", "advisor", "all" ,"-d", self.BASE_PROFILING_PATH, "-bp", + cmd_all = ["msprof-analyze", "advisor", "all", "-d", self.BASE_PROFILING_PATH, "-bp", self.COMPARISON_PROFILING_PATH, "-o", self.ALL_OUTPUT_PATH, "-l", "en", "--force"] if execute_cmd(cmd_all) != self.COMMAND_SUCCESS or not os.path.exists(self.ALL_OUTPUT_PATH): self.assertTrue(False, msg="advisor [all] [bp] task failed.") - self.RESULT_HTML,self.RESULT_EXCEL = get_files(self.OUTPUT_PATH) + self.RESULT_HTML, self.RESULT_EXCEL = get_files(self.OUTPUT_PATH) def teardown_class(self): PathManager.remove_path_safety(self.OUTPUT_PATH) @@ -56,7 +56,6 @@ class TestAdvisorCmdClusterAscendPtCompare(TestCase): "Operator dispatch" ] - # True presents the attr is nan description_len = [1, 11, 1, 1, 2, 1] suggestion_len = [True, True, 1, 5, 2, 1] @@ -66,15 +65,15 @@ class TestAdvisorCmdClusterAscendPtCompare(TestCase): income = [True, True, True, True, True, True] income_ratio = [True, True, True, True, True, True] try: - df = pd.read_excel(self.RESULT_EXCEL.get("all",None), sheet_name='problems', header=0) + df = pd.read_excel(self.RESULT_EXCEL.get("all", None), sheet_name='problems', header=0) except FileNotFoundError: - logging.error("File %s not found.", self.RESULT_EXCEL.get("all",None)) + logging.error("File %s not found.", self.RESULT_EXCEL.get("all", None)) return for index, row in df.iterrows(): self.assertEqual(category[index], row["category"]) self.assertEqual(description_len[index], len(row["description"].split("\n"))) - self.assertEqual(suggestion_len[index], (isinstance(row["suggestion"],float) or + self.assertEqual(suggestion_len[index], (isinstance(row["suggestion"], float) or len(row["suggestion"].split("\n")))) self.assertEqual(problem_count[index], (math.isnan(row["problem count"]) or row["problem count"])) self.assertEqual(total_time[index], (math.isnan(row["total_time(us)"]) or @@ -85,47 +84,47 @@ class TestAdvisorCmdClusterAscendPtCompare(TestCase): round(row["income ratio"], 2))) def test_slow_rank(self): - step = [-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1] - rank_id = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] + step = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1] + rank_id = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] compute_us = [ - 14302466.71,14308948.28,14311412.46, - 14242056.74,14972627.53,14974042.28, - 14964095.87,14945901.57,13878006.78, - 13826069.33,13853184.69,13910409.81, - 13612993.03,13669912.48,13779569.04, + 14302466.71, 14308948.28, 14311412.46, + 14242056.74, 14972627.53, 14974042.28, + 14964095.87, 14945901.57, 13878006.78, + 13826069.33, 13853184.69, 13910409.81, + 13612993.03, 13669912.48, 13779569.04, 13826274.64 ] communication_us = [ - 50636595.62,50670520.26,50698886.74, - 50741670.92,50257498.54,50286645.51, - 50294747.07,50289541.49,51211928.02, - 51161276.14,51187346.34,51169195.18, - 51544052.84,51556067.16,51374012.81, + 50636595.62, 50670520.26, 50698886.74, + 50741670.92, 50257498.54, 50286645.51, + 50294747.07, 50289541.49, 51211928.02, + 51161276.14, 51187346.34, 51169195.18, + 51544052.84, 51556067.16, 51374012.81, 51425588.65 ] free_us = [ - 682939.022,634478.74,609248.76, - 645123.76,396550.744,377863.438, - 363100.664,377397.078,537692.3, - 568293.626,525516.858,549405.358, - 458639.564,400809.38,396422.698, + 682939.022, 634478.74, 609248.76, + 645123.76, 396550.744, 377863.438, + 363100.664, 377397.078, 537692.3, + 568293.626, 525516.858, 549405.358, + 458639.564, 400809.38, 396422.698, 367782.33 ] try: - df = pd.read_excel(self.RESULT_EXCEL.get("all",None), sheet_name='slow rank', header=0) + df = pd.read_excel(self.RESULT_EXCEL.get("all", None), sheet_name='slow rank', header=0) except FileNotFoundError: - logging.error("File %s not found.", self.RESULT_EXCEL.get("all",None)) + logging.error("File %s not found.", self.RESULT_EXCEL.get("all", None)) return for index, row in df.iterrows(): self.assertEqual(step[index], row["step"]) self.assertEqual(rank_id[index], row["rank_id"]) - self.assertEqual(compute_us[index], round(row["compute(us)"],2)) + self.assertEqual(compute_us[index], round(row["compute(us)"], 2)) self.assertEqual(communication_us[index], round(row["communication(us)"], 2)) - self.assertEqual(free_us[index], round(row["free(us)"],3)) + self.assertEqual(free_us[index], round(row["free(us)"], 3)) - soup = BeautifulSoup(open(self.RESULT_HTML.get("all",None)), 'html.parser') + soup = BeautifulSoup(open(self.RESULT_HTML.get("all", None)), 'html.parser') for h2 in soup.find_all('h2'): if h2.contents[0] == "slow rank": div_content = h2.next.next.next @@ -137,11 +136,11 @@ class TestAdvisorCmdClusterAscendPtCompare(TestCase): self.assertEqual(str(rank_id[row_index - 1]), row.find_all('td')[1].text) self.assertEqual(str(compute_us[row_index - 1]), row.find_all('td')[2].text) self.assertEqual(str(communication_us[row_index - 1]), row.find_all('td')[3].text) - self.assertEqual(str(round(free_us[row_index - 1],2)), row.find_all('td')[4].text) + self.assertEqual(str(round(free_us[row_index - 1], 2)), row.find_all('td')[4].text) def test_slow_link(self): - step = [-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1] - rank_id = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] + step = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1] + rank_id = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] rdma_bandwidth = [ 4.7729, 4.8102, 4.7966, 4.8765, 4.7619, 4.7982, @@ -151,11 +150,11 @@ class TestAdvisorCmdClusterAscendPtCompare(TestCase): 4.7541 ] rdma_size = [ - 892743.4811,892743.4811,892743.4811, - 892743.4811,892743.4811,892743.4811, - 892743.4811,892743.4811,892743.4811, - 892743.4811,892743.4811,892743.4811, - 892743.4811,892743.4811,892743.4811, + 892743.4811, 892743.4811, 892743.4811, + 892743.4811, 892743.4811, 892743.4811, + 892743.4811, 892743.4811, 892743.4811, + 892743.4811, 892743.4811, 892743.4811, + 892743.4811, 892743.4811, 892743.4811, 892743.4811 ] rdma_time = [ @@ -192,9 +191,9 @@ class TestAdvisorCmdClusterAscendPtCompare(TestCase): ] try: - df = pd.read_excel(self.RESULT_EXCEL.get("all",None), sheet_name='slow link', header=0) + df = pd.read_excel(self.RESULT_EXCEL.get("all", None), sheet_name='slow link', header=0) except FileNotFoundError: - logging.error("File %s not found.", self.RESULT_EXCEL.get("all",None)) + logging.error("File %s not found.", self.RESULT_EXCEL.get("all", None)) return for index, row in df.iterrows(): @@ -207,7 +206,7 @@ class TestAdvisorCmdClusterAscendPtCompare(TestCase): self.assertEqual(sdma_size[index], round(row["SDMA size(mb)"], 3)) self.assertEqual(sdma_time[index], round(row["SDMA time(ms)"], 4)) - soup = BeautifulSoup(open(self.RESULT_HTML.get("all",None)), 'html.parser') + soup = BeautifulSoup(open(self.RESULT_HTML.get("all", None)), 'html.parser') for h2 in soup.find_all('h2'): if h2.contents[0] == "slow link": div_content = h2.next.next.next @@ -217,12 +216,12 @@ class TestAdvisorCmdClusterAscendPtCompare(TestCase): continue self.assertEqual(str(step[row_index - 1]), row.find_all('td')[0].text) self.assertEqual(str(rank_id[row_index - 1]), row.find_all('td')[1].text) - self.assertEqual(str(round(rdma_bandwidth[row_index - 1],2)), row.find_all('td')[2].text) - self.assertEqual(str(round(rdma_size[row_index - 1],2)), row.find_all('td')[3].text) - self.assertEqual(str(round(rdma_time[row_index - 1],2)), row.find_all('td')[4].text) - self.assertEqual(str(round(sdma_bandwidth[row_index - 1],2)), row.find_all('td')[5].text) - self.assertEqual(str(round(sdma_size[row_index - 1],2)), row.find_all('td')[6].text) - self.assertEqual(str(round(sdma_time[row_index - 1],2)), row.find_all('td')[7].text) + self.assertEqual(str(round(rdma_bandwidth[row_index - 1], 2)), row.find_all('td')[2].text) + self.assertEqual(str(round(rdma_size[row_index - 1], 2)), row.find_all('td')[3].text) + self.assertEqual(str(round(rdma_time[row_index - 1], 2)), row.find_all('td')[4].text) + self.assertEqual(str(round(sdma_bandwidth[row_index - 1], 2)), row.find_all('td')[5].text) + self.assertEqual(str(round(sdma_size[row_index - 1], 2)), row.find_all('td')[6].text) + self.assertEqual(str(round(sdma_time[row_index - 1], 2)), row.find_all('td')[7].text) def test_Byte_Alignment_Analysis(self): op_name = [ @@ -258,9 +257,9 @@ class TestAdvisorCmdClusterAscendPtCompare(TestCase): test_pattern = ["all"] for pattern in test_pattern: try: - df = pd.read_excel(self.RESULT_EXCEL.get(pattern,None), sheet_name='Byte Alignment Analysis', header=0) + df = pd.read_excel(self.RESULT_EXCEL.get(pattern, None), sheet_name='Byte Alignment Analysis', header=0) except FileNotFoundError: - logging.error("File %s not found.", self.RESULT_EXCEL.get(pattern,None)) + logging.error("File %s not found.", self.RESULT_EXCEL.get(pattern, None)) return for index, row in df.iterrows(): @@ -270,7 +269,7 @@ class TestAdvisorCmdClusterAscendPtCompare(TestCase): self.assertEqual(abnormal_duration[index], row["abnormal duration(us)"]) self.assertEqual(bandwidth[index], row["bandwidth(GB/s)"]) - soup = BeautifulSoup(open(self.RESULT_HTML.get(pattern,None)), 'html.parser') + soup = BeautifulSoup(open(self.RESULT_HTML.get(pattern, None)), 'html.parser') for h2 in soup.find_all('h2'): if h2.contents[0] == "Byte Alignment Analysis": div_content = h2.next.next.next @@ -289,14 +288,14 @@ class TestAdvisorCmdClusterAscendPtCompare(TestCase): "aclnnEqScalar_EqualAiCpu_Equal", "aclnnPowTensorScalar_SquareAiCpu_Square" ] - op_type = ["Equal","Square"] - task_duration = [85.502,74.862] - input_shapes = ["\"17;\"","\"17\""] - input_data_types = ["DOUBLE;DOUBLE","INT64"] - input_formats = ["FORMAT_ND;FORMAT_ND","FORMAT_ND"] - output_shapes = ["\"17\"","\"17\""] - output_data_types = ["BOOL","INT64"] - output_formats = ["FORMAT_ND","FORMAT_ND"] + op_type = ["Equal", "Square"] + task_duration = [85.502, 74.862] + input_shapes = ["\"17;\"", "\"17\""] + input_data_types = ["DOUBLE;DOUBLE", "INT64"] + input_formats = ["FORMAT_ND;FORMAT_ND", "FORMAT_ND"] + output_shapes = ["\"17\"", "\"17\""] + output_data_types = ["BOOL", "INT64"] + output_formats = ["FORMAT_ND", "FORMAT_ND"] stack_info = [True, True] t0_description = ["Square, Equal"] @@ -311,9 +310,9 @@ class TestAdvisorCmdClusterAscendPtCompare(TestCase): t2_elapsed_time = ["74.86"] try: - df = pd.read_excel(self.RESULT_EXCEL.get("all",None), sheet_name='Rank 5 AICPU operator', header=0) + df = pd.read_excel(self.RESULT_EXCEL.get("all", None), sheet_name='Rank 5 AICPU operator', header=0) except FileNotFoundError: - logging.error("File %s not found.", self.RESULT_EXCEL.get("all",None)) + logging.error("File %s not found.", self.RESULT_EXCEL.get("all", None)) return for index, row in df.iterrows(): @@ -328,7 +327,7 @@ class TestAdvisorCmdClusterAscendPtCompare(TestCase): self.assertEqual(output_formats[index], row["output_formats"]) self.assertEqual(stack_info[index], math.isnan(row["stack_info"])) - soup = BeautifulSoup(open(self.RESULT_HTML.get("all",None)), 'html.parser') + soup = BeautifulSoup(open(self.RESULT_HTML.get("all", None)), 'html.parser') for h2 in soup.find_all('h2'): if h2.contents[0] == "AICPU Issues": div_content = h2.next.next.next @@ -367,9 +366,9 @@ class TestAdvisorCmdClusterAscendPtCompare(TestCase): t1_elapsed_time = ['64611.05109720859'] try: - df = pd.read_excel(self.RESULT_EXCEL.get("all",None), sheet_name='operator dispatch', header=0) + df = pd.read_excel(self.RESULT_EXCEL.get("all", None), sheet_name='operator dispatch', header=0) except FileNotFoundError: - logging.error("File %s not found.", self.RESULT_EXCEL.get("all",None)) + logging.error("File %s not found.", self.RESULT_EXCEL.get("all", None)) return for index, row in df.iterrows(): @@ -378,7 +377,7 @@ class TestAdvisorCmdClusterAscendPtCompare(TestCase): self.assertEqual(counts[index], row["counts"]) self.assertEqual(total_time[index], round(row["total time"], 4)) - soup = BeautifulSoup(open(self.RESULT_HTML.get("all",None)), 'html.parser') + soup = BeautifulSoup(open(self.RESULT_HTML.get("all", )), 'html.parser') for h2 in soup.find_all('h2'): if h2.contents[0] == "Operator Dispatch Issues": div_content = h2.next.next.next @@ -394,4 +393,4 @@ class TestAdvisorCmdClusterAscendPtCompare(TestCase): continue self.assertEqual(t1_issue[row_index - 1], row.find_all('td')[0].text) self.assertEqual(t1_counts[row_index - 1], row.find_all('td')[1].text) - self.assertEqual(t1_elapsed_time[row_index - 1], row.find_all('td')[2].text) \ No newline at end of file + self.assertEqual(t1_elapsed_time[row_index - 1], row.find_all('td')[2].text) diff --git a/profiler/msprof_analyze/test/ut/advisor/advisor_backend/cluster_advice/test_kernel_cluster_advice.py b/profiler/msprof_analyze/test/ut/advisor/advisor_backend/cluster_advice/test_kernel_cluster_advice.py index 724c51fb3e..6f11d030de 100644 --- a/profiler/msprof_analyze/test/ut/advisor/advisor_backend/cluster_advice/test_kernel_cluster_advice.py +++ b/profiler/msprof_analyze/test/ut/advisor/advisor_backend/cluster_advice/test_kernel_cluster_advice.py @@ -58,7 +58,8 @@ class TestClusterAdviceBase(unittest.TestCase): cls.all_kernel_data = { 'rank id': {0: 0, 1: 0, 2: 1, 3: 1}, 'Name': {0: 'ZerosLike46', 1: 'ZerosLike46', 2: 'Mul85', 3: 'Mul85'}, - 'Input Shapes': {0: '"544404480"', 1: '"544404480"', 2: '"4,1024,12288;4,1024,1"', 3: '"4,1024,12288;4,1024,1"'}, + 'Input Shapes': {0: '"544404480"', 1: '"544404480"', 2: '"4,1024,12288;4,1024,1"', + 3: '"4,1024,12288;4,1024,1"'}, 'Input Data Types': {0: 'FLOAT16', 1: 'FLOAT16', 2: 'FLOAT16', 3: 'FLOAT16'}, 'Output Shapes': {0: '"544404480"', 1: '"544404480"', 2: '"4,1024,12288"', 3: '"4,1024,12288"'}, 'Duration(us)': {0: 10.0, 1: 20.0, 2: 30.0, 3: 40.0} diff --git a/profiler/msprof_analyze/test/ut/advisor/advisor_backend/timeline_advice/test_opsche_advice.py b/profiler/msprof_analyze/test/ut/advisor/advisor_backend/timeline_advice/test_opsche_advice.py index eb2cabcb28..1c4e5197e1 100644 --- a/profiler/msprof_analyze/test/ut/advisor/advisor_backend/timeline_advice/test_opsche_advice.py +++ b/profiler/msprof_analyze/test/ut/advisor/advisor_backend/timeline_advice/test_opsche_advice.py @@ -32,7 +32,8 @@ class TestOpScheAdvice(unittest.TestCase): @classmethod def setUpClass(cls) -> None: super().setUpClass() - TestOpScheAdvice.interface = Interface(os.path.join(os.path.dirname(os.path.abspath(__file__)), "trace_view.json")) + TestOpScheAdvice.interface = Interface(os.path.join(os.path.dirname(os.path.abspath(__file__)), + "trace_view.json")) def test_run(self): dataset = TestOpScheAdvice.interface.get_data('timeline', 'op_schedule') diff --git a/profiler/msprof_analyze/test/ut/advisor/advisor_backend/timeline_advice/test_optimizer_advice.py b/profiler/msprof_analyze/test/ut/advisor/advisor_backend/timeline_advice/test_optimizer_advice.py index 8b4725af43..699f03806f 100644 --- a/profiler/msprof_analyze/test/ut/advisor/advisor_backend/timeline_advice/test_optimizer_advice.py +++ b/profiler/msprof_analyze/test/ut/advisor/advisor_backend/timeline_advice/test_optimizer_advice.py @@ -57,7 +57,8 @@ class TestOptimizerAdvice(unittest.TestCase): os.O_WRONLY | os.O_CREAT, stat.S_IWUSR | stat.S_IRUSR), 'w') as fp: fp.write(json_str) TestOptimizerAdvice.err_interface = Interface(os.path.join(TestOptimizerAdvice.TMP_DIR, "err_file.json")) - TestOptimizerAdvice.interface = Interface(os.path.join(os.path.dirname(os.path.abspath(__file__)), "trace_view.json")) + TestOptimizerAdvice.interface = Interface(os.path.join(os.path.dirname(os.path.abspath(__file__)), + "trace_view.json")) def test_run(self): @@ -70,7 +71,8 @@ class TestOptimizerAdvice(unittest.TestCase): self.assertEqual(0, len(case_data)) dataset = TestOptimizerAdvice.interface.get_data('timeline', 'optimizer') - real_advice = real_bottleneck = "You can choose torch_npu.optim.NpuFusedAdam to replace the current Optimizer: Optimizer.step#Adam.step." + real_advice = real_bottleneck = ("You can choose torch_npu.optim.NpuFusedAdam to replace the current " + "Optimizer: Optimizer.step#Adam.step.") real_data = ['Optimizer.step#Adam.step'] case_advice = dataset.get('advice') case_bottleneck = dataset.get('bottleneck') diff --git a/profiler/msprof_analyze/test/ut/advisor/common/test_enum_params_parser.py b/profiler/msprof_analyze/test/ut/advisor/common/test_enum_params_parser.py index 88edc9424c..9ba86ae878 100644 --- a/profiler/msprof_analyze/test/ut/advisor/common/test_enum_params_parser.py +++ b/profiler/msprof_analyze/test/ut/advisor/common/test_enum_params_parser.py @@ -31,7 +31,8 @@ class TestEnumParamsParser(unittest.TestCase): def setUp(self) -> None: self.enum_params_parser = EnumParamsParser() - self.argument_keys = sorted(["cann_version", "torch_version", "analysis_dimensions", "profiling_type", "mindspore_version"]) + self.argument_keys = sorted(["cann_version", "torch_version", "analysis_dimensions", + "profiling_type", "mindspore_version"]) self.env_keys = ["ADVISOR_ANALYZE_PROCESSES", "DISABLE_PROFILING_COMPARISON", "DISABLE_AFFINITY_API"] def test_get_keys(self): diff --git a/profiler/msprof_analyze/test/ut/advisor/timeline_advice/test_synchronize_stream.py b/profiler/msprof_analyze/test/ut/advisor/timeline_advice/test_synchronize_stream.py index cc110e4d15..af24526cf4 100644 --- a/profiler/msprof_analyze/test/ut/advisor/timeline_advice/test_synchronize_stream.py +++ b/profiler/msprof_analyze/test/ut/advisor/timeline_advice/test_synchronize_stream.py @@ -17,7 +17,8 @@ import os import sys import yaml -from msprof_analyze.advisor.analyzer.schedule.synchronize_stream.synchronize_stream_checker import SynchronizeStreamChecker +from msprof_analyze.advisor.analyzer.schedule.synchronize_stream.synchronize_stream_checker import ( + SynchronizeStreamChecker) from msprof_analyze.advisor.common.timeline.event import TimelineEvent from msprof_analyze.prof_common.constant import Constant from msprof_analyze.advisor.utils.utils import safe_division diff --git a/profiler/msprof_analyze/test/ut/cluster_analyse/common_func/test_file_manager.py b/profiler/msprof_analyze/test/ut/cluster_analyse/common_func/test_file_manager.py index 9828638d38..c1fcb9d2ad 100644 --- a/profiler/msprof_analyze/test/ut/cluster_analyse/common_func/test_file_manager.py +++ b/profiler/msprof_analyze/test/ut/cluster_analyse/common_func/test_file_manager.py @@ -77,7 +77,8 @@ class TestFileManager(unittest.TestCase): with pytest.raises(exception) as error: FileManager().read_csv_file(os.path.join(TestFileManager.TMP_DIR, file_name), StepTraceTimeBean) else: - ret_list = FileManager().read_csv_file(os.path.join(TestFileManager.TMP_DIR, file_name), StepTraceTimeBean) + ret_list = FileManager().read_csv_file(os.path.join(TestFileManager.TMP_DIR, file_name), + StepTraceTimeBean) self.assertEqual(length, len(ret_list)) def test_read_json_file(self): diff --git a/profiler/msprof_analyze/test/ut/compare_tools/comparator/test_communication_comparator.py b/profiler/msprof_analyze/test/ut/compare_tools/comparator/test_communication_comparator.py index 3cd1884c22..3732d0a1f2 100644 --- a/profiler/msprof_analyze/test/ut/compare_tools/comparator/test_communication_comparator.py +++ b/profiler/msprof_analyze/test/ut/compare_tools/comparator/test_communication_comparator.py @@ -1,3 +1,17 @@ +# Copyright (c) 2025, Huawei Technologies Co., Ltd. +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import unittest from compare_backend.comparator.communication_comparator import CommunicationComparator diff --git a/profiler/msprof_analyze/test/ut/compare_tools/comparator/test_operator_comparator.py b/profiler/msprof_analyze/test/ut/compare_tools/comparator/test_operator_comparator.py index cb51b5756c..1e7b2124f4 100644 --- a/profiler/msprof_analyze/test/ut/compare_tools/comparator/test_operator_comparator.py +++ b/profiler/msprof_analyze/test/ut/compare_tools/comparator/test_operator_comparator.py @@ -1,3 +1,17 @@ +# Copyright (c) 2025, Huawei Technologies Co., Ltd. +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import unittest from compare_backend.comparator.operator_comparator import OperatorComparator diff --git a/profiler/msprof_analyze/test/ut/compare_tools/comparator/test_operator_statistic_comparator.py b/profiler/msprof_analyze/test/ut/compare_tools/comparator/test_operator_statistic_comparator.py index 133fa197f1..f4536e1142 100644 --- a/profiler/msprof_analyze/test/ut/compare_tools/comparator/test_operator_statistic_comparator.py +++ b/profiler/msprof_analyze/test/ut/compare_tools/comparator/test_operator_statistic_comparator.py @@ -1,3 +1,17 @@ +# Copyright (c) 2025, Huawei Technologies Co., Ltd. +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import unittest from unittest.mock import patch @@ -24,7 +38,8 @@ class TestOperatorStatisticComparator(unittest.TestCase): base_dict = {"add": [1], "matmul": [1]} comparison_dict = {"add": [1], "reduce": [1]} with patch( - "compare_backend.comparator.operator_statistic_comparator.OperatorStatisticComparator._group_by_op_name", + "compare_backend.comparator.operator_statistic_comparator.OperatorStatisticComparator.\ + _group_by_op_name", return_value=(base_dict, comparison_dict)): comparator = OperatorStatisticComparator({1: 2}, MockBean) comparator._compare() diff --git a/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/origin_data_bean/test_compare_event.py b/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/origin_data_bean/test_compare_event.py index 771e199339..946012cda0 100644 --- a/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/origin_data_bean/test_compare_event.py +++ b/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/origin_data_bean/test_compare_event.py @@ -1,3 +1,17 @@ +# Copyright (c) 2025, Huawei Technologies Co., Ltd. +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import unittest from compare_backend.compare_bean.origin_data_bean.compare_event import KernelEvent, MemoryEvent diff --git a/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/origin_data_bean/test_kernel_details_bean.py b/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/origin_data_bean/test_kernel_details_bean.py index 869ee85570..c26ea24c18 100644 --- a/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/origin_data_bean/test_kernel_details_bean.py +++ b/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/origin_data_bean/test_kernel_details_bean.py @@ -1,3 +1,17 @@ +# Copyright (c) 2025, Huawei Technologies Co., Ltd. +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import unittest from compare_backend.compare_bean.origin_data_bean.kernel_details_bean import KernelDetailsBean diff --git a/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/origin_data_bean/test_memory_record_bean.py b/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/origin_data_bean/test_memory_record_bean.py index 3ec34ffbaa..1797d4017e 100644 --- a/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/origin_data_bean/test_memory_record_bean.py +++ b/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/origin_data_bean/test_memory_record_bean.py @@ -1,3 +1,17 @@ +# Copyright (c) 2025, Huawei Technologies Co., Ltd. +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import unittest from compare_backend.compare_bean.origin_data_bean.memory_record_bean import MemoryRecordBean diff --git a/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/origin_data_bean/test_operator_memory_bean.py b/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/origin_data_bean/test_operator_memory_bean.py index 027b620e81..b3299b8fce 100644 --- a/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/origin_data_bean/test_operator_memory_bean.py +++ b/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/origin_data_bean/test_operator_memory_bean.py @@ -1,3 +1,17 @@ +# Copyright (c) 2025, Huawei Technologies Co., Ltd. +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import unittest from compare_backend.compare_bean.origin_data_bean.operator_memory_bean import OperatorMemoryBean diff --git a/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/origin_data_bean/test_trace_event_bean.py b/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/origin_data_bean/test_trace_event_bean.py index 2bd56e611d..6a5b6df814 100644 --- a/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/origin_data_bean/test_trace_event_bean.py +++ b/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/origin_data_bean/test_trace_event_bean.py @@ -1,3 +1,17 @@ +# Copyright (c) 2025, Huawei Technologies Co., Ltd. +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import unittest from compare_backend.compare_bean.origin_data_bean.trace_event_bean import TraceEventBean diff --git a/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/test_communication_bean.py b/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/test_communication_bean.py index 2b5ee56828..7f25c1fd15 100644 --- a/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/test_communication_bean.py +++ b/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/test_communication_bean.py @@ -1,3 +1,17 @@ +# Copyright (c) 2025, Huawei Technologies Co., Ltd. +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import unittest from compare_backend.compare_bean.communication_bean import CommunicationBean diff --git a/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/test_memory_compare_bean.py b/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/test_memory_compare_bean.py index f275c2261a..8a0726db4d 100644 --- a/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/test_memory_compare_bean.py +++ b/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/test_memory_compare_bean.py @@ -1,3 +1,17 @@ +# Copyright (c) 2025, Huawei Technologies Co., Ltd. +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import unittest from unittest.mock import patch diff --git a/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/test_memory_statistic_bean.py b/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/test_memory_statistic_bean.py index 40bed2160b..df7c1db477 100644 --- a/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/test_memory_statistic_bean.py +++ b/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/test_memory_statistic_bean.py @@ -1,3 +1,17 @@ +# Copyright (c) 2025, Huawei Technologies Co., Ltd. +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import unittest from unittest.mock import patch diff --git a/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/test_operator_compare_bean.py b/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/test_operator_compare_bean.py index ab8dec156f..44699b87ff 100644 --- a/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/test_operator_compare_bean.py +++ b/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/test_operator_compare_bean.py @@ -1,3 +1,17 @@ +# Copyright (c) 2025, Huawei Technologies Co., Ltd. +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import unittest from unittest.mock import patch diff --git a/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/test_operator_statistic_bean.py b/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/test_operator_statistic_bean.py index 4c4e338ce5..197c8d83cb 100644 --- a/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/test_operator_statistic_bean.py +++ b/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/test_operator_statistic_bean.py @@ -1,3 +1,17 @@ +# Copyright (c) 2025, Huawei Technologies Co., Ltd. +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import unittest from unittest.mock import patch diff --git a/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/test_profiling_info.py b/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/test_profiling_info.py index 59525f18f9..b236a32f26 100644 --- a/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/test_profiling_info.py +++ b/profiler/msprof_analyze/test/ut/compare_tools/compare_bean/test_profiling_info.py @@ -1,7 +1,20 @@ import unittest from compare_backend.compare_bean.profiling_info import ProfilingInfo - +# Copyright (c) 2025, Huawei Technologies Co., Ltd. +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. class TestProfilingInfo(unittest.TestCase): def test_calculate_schedule_time(self): diff --git a/profiler/msprof_analyze/test/ut/compare_tools/profiling_parser/test_base_profiling_parser.py b/profiler/msprof_analyze/test/ut/compare_tools/profiling_parser/test_base_profiling_parser.py index c4c26bd6dd..2c7c3de0ab 100644 --- a/profiler/msprof_analyze/test/ut/compare_tools/profiling_parser/test_base_profiling_parser.py +++ b/profiler/msprof_analyze/test/ut/compare_tools/profiling_parser/test_base_profiling_parser.py @@ -1,3 +1,17 @@ +# Copyright (c) 2025, Huawei Technologies Co., Ltd. +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import unittest from unittest.mock import patch diff --git a/profiler/msprof_analyze/test/ut/compare_tools/profiling_parser/test_gpu_profiling_parser.py b/profiler/msprof_analyze/test/ut/compare_tools/profiling_parser/test_gpu_profiling_parser.py index 59ca545e2d..c087d3fab1 100644 --- a/profiler/msprof_analyze/test/ut/compare_tools/profiling_parser/test_gpu_profiling_parser.py +++ b/profiler/msprof_analyze/test/ut/compare_tools/profiling_parser/test_gpu_profiling_parser.py @@ -1,3 +1,17 @@ +# Copyright (c) 2025, Huawei Technologies Co., Ltd. +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import unittest from collections import defaultdict from unittest.mock import patch diff --git a/profiler/msprof_analyze/test/ut/compare_tools/profiling_parser/test_npu_profiling_parser.py b/profiler/msprof_analyze/test/ut/compare_tools/profiling_parser/test_npu_profiling_parser.py index a835dd9c12..3ee568aa3e 100644 --- a/profiler/msprof_analyze/test/ut/compare_tools/profiling_parser/test_npu_profiling_parser.py +++ b/profiler/msprof_analyze/test/ut/compare_tools/profiling_parser/test_npu_profiling_parser.py @@ -1,3 +1,17 @@ +# Copyright (c) 2025, Huawei Technologies Co., Ltd. +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import unittest from unittest.mock import patch @@ -26,7 +40,7 @@ class TestNPUProfilingParser(unittest.TestCase): return_value=None): res = NPUProfilingParser({}, {}) res._operator_memory_path = "" - res._path_level='' + res._path_level = '' res._update_memory_list() def test_update_memory_list_when_valid_data(self): @@ -41,7 +55,7 @@ class TestNPUProfilingParser(unittest.TestCase): return_value=None), \ patch("msprof_analyze.prof_common.file_manager.FileManager.read_csv_file", return_value=memory_data): res = NPUProfilingParser({}, {}) - res._path_level='' + res._path_level = '' res._operator_memory_path = "" res._enqueue_dict = {} res._dequeue_data = [TraceEventBean(event) for event in self.dequeue_events] diff --git a/profiler/msprof_analyze/test/ut/compare_tools/utils/test_name_function.py b/profiler/msprof_analyze/test/ut/compare_tools/utils/test_name_function.py index 2903f9838b..86825ae9e6 100644 --- a/profiler/msprof_analyze/test/ut/compare_tools/utils/test_name_function.py +++ b/profiler/msprof_analyze/test/ut/compare_tools/utils/test_name_function.py @@ -1,3 +1,17 @@ +# Copyright (c) 2025, Huawei Technologies Co., Ltd. +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import unittest from compare_backend.compare_bean.origin_data_bean.trace_event_bean import TraceEventBean diff --git a/profiler/msprof_analyze/test/ut/compare_tools/utils/test_tree_builder.py b/profiler/msprof_analyze/test/ut/compare_tools/utils/test_tree_builder.py index 326a424d3d..e96e6416a6 100644 --- a/profiler/msprof_analyze/test/ut/compare_tools/utils/test_tree_builder.py +++ b/profiler/msprof_analyze/test/ut/compare_tools/utils/test_tree_builder.py @@ -1,3 +1,17 @@ +# Copyright (c) 2025, Huawei Technologies Co., Ltd. +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import unittest from compare_backend.compare_bean.origin_data_bean.compare_event import MemoryEvent diff --git a/profiler/msprof_analyze/test/ut/compare_tools/view/test_excel_view.py b/profiler/msprof_analyze/test/ut/compare_tools/view/test_excel_view.py index aa500c4242..a8255eae02 100644 --- a/profiler/msprof_analyze/test/ut/compare_tools/view/test_excel_view.py +++ b/profiler/msprof_analyze/test/ut/compare_tools/view/test_excel_view.py @@ -1,3 +1,17 @@ +# Copyright (c) 2025, Huawei Technologies Co., Ltd. +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import os import unittest from unittest.mock import patch diff --git a/profiler/msprof_analyze/test/ut/compare_tools/view/test_screen_view.py b/profiler/msprof_analyze/test/ut/compare_tools/view/test_screen_view.py index caa25e396e..23cebb9e70 100644 --- a/profiler/msprof_analyze/test/ut/compare_tools/view/test_screen_view.py +++ b/profiler/msprof_analyze/test/ut/compare_tools/view/test_screen_view.py @@ -1,3 +1,17 @@ +# Copyright (c) 2025, Huawei Technologies Co., Ltd. +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import unittest from compare_backend.view.screen_view import ScreenView diff --git a/profiler/msprof_analyze/test/ut/compare_tools/view/test_worker_sheet_creator.py b/profiler/msprof_analyze/test/ut/compare_tools/view/test_worker_sheet_creator.py index 1e80931ff5..b260f9144f 100644 --- a/profiler/msprof_analyze/test/ut/compare_tools/view/test_worker_sheet_creator.py +++ b/profiler/msprof_analyze/test/ut/compare_tools/view/test_worker_sheet_creator.py @@ -1,3 +1,17 @@ +# Copyright (c) 2025, Huawei Technologies Co., Ltd. +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import os import unittest -- Gitee