def test_analyse_single_prof_data(self): log_file = get_test_file("sn0.log") with patch.object(sys, 'argv', ['ada-pa', log_file]): ada_prof_cmd.main() self.assert_result_file_exists("sn0", 1) tracing = load_tracing_file("sn0", 0) tracing_checker = TracingChecker(tracing) tracing_checker.assert_events_num(12) tracing_checker.assert_events_dur("[GatherV2]@[ConstPrepare]", [12.36]) tracing_checker.assert_events_dur("[UpdateShape]", [2.55, 1.67]) tracing_checker.assert_events_dur("[rtKernelLaunch]", [18.53, 21.19]) summary = load_summary_file("sn0", 0) summary_checker = SummaryChecker(summary) summary_checker.assert_event_dur("[ConstPrepare]", 10.475) summary_checker.assert_event_dur("[UpdateShape]", 2.11) summary_checker.assert_event_dur("[rtKernelLaunch]", 19.86) summary_checker.assert_event_count("[ConstPrepare]", 2) summary_checker.assert_event_count("[UpdateShape]", 2) summary_checker.assert_event_count("[rtKernelLaunch]", 2) summary_checker.w_percent_check("[OpExecute]") stat = load_op_statistics_file("sn0", 0) stat_checker = OpStatChecker(stat) stat_checker.assert_durs("[GatherV2]", "[ConstPrepare]", [12.36]) stat_checker.assert_durs("[GatherV2]", "[UpdateShape]", [2.55]) stat_checker.assert_durs("[GatherV2]", "[Tiling]", [20.32]) stat_checker.assert_durs("[Mul]", "[Tiling]", [20.12])
def test_analyse_single_prof_data_large(self): log_file = get_test_file("sn2.log") with patch.object(sys, 'argv', ['ada-pa', log_file]): ada_prof_cmd.main() self.assert_result_file_exists("sn2", 1) tracing = load_tracing_file("sn2", 0) self.assert_events_num(tracing, 24862) self.assert_events_dur(tracing, "[GatherV2]@[AclCompileAndExecute]", [114.09, 69.826, 43.023, 40.215]) self.assert_events_dur(tracing, "[MatMul]@[Tiling]", [35.266, 24.663, 22.501])
def test_analyse_single_prof_data_aclopcompileandexecute(self): log_file = get_test_file("sn4.log") with patch.object(sys, 'argv', ['ada-pa', log_file]): ada_prof_cmd.main() self.assert_result_file_exists("sn4", 1) summary = load_summary_file("sn4", 0) summary_checker = SummaryChecker(summary) summary_checker.w_percent_check()
def test_analyse_single_prof_for_op_stat(self): log_file = get_test_file("sn3.log") with patch.object(sys, 'argv', ['ada-pa', log_file]): ada_prof_cmd.main() self.assert_result_file_exists("sn3", 1) stat = load_op_statistics_file("sn3", 0) stat_checker = OpStatChecker(stat) stat_checker.assert_durs("[Transpose]", "[AclMatchStaticOpModel]", [1.594]) stat_checker.assert_durs("[trans_TransData_85]", "[InferShape]", [12.891]) stat_checker.assert_durs("[Identity]", "[Tiling]", [18.289])
def test_analyse_multiple_prof_data(self): log_file = get_test_file("sn1.log") with patch.object(sys, 'argv', ['ada-pa', log_file]): ada_prof_cmd.main() self.assert_result_file_exists("sn1", 2)