| @@ -71,6 +71,7 @@ def get_profile_op_info(): | |||
| validate_condition(search_condition) | |||
| device_id = search_condition.get("device_id", "0") | |||
| to_int(device_id, 'device_id') | |||
| profiler_dir_abs = os.path.join(settings.SUMMARY_BASE_DIR, train_id, profiler_dir) | |||
| try: | |||
| profiler_dir_abs = validate_and_normalize_path(profiler_dir_abs, "profiler") | |||
| @@ -193,6 +194,7 @@ def get_queue_info(): | |||
| profile_dir = get_profiler_abs_dir(request) | |||
| device_id = unquote_args(request, "device_id") | |||
| to_int(device_id, 'device_id') | |||
| queue_type = unquote_args(request, "type") | |||
| queue_info = {} | |||
| @@ -219,6 +221,7 @@ def get_time_info(): | |||
| """ | |||
| profile_dir = get_profiler_abs_dir(request) | |||
| device_id = unquote_args(request, "device_id") | |||
| to_int(device_id, 'device_id') | |||
| op_type = unquote_args(request, "type") | |||
| time_info = { | |||
| @@ -250,6 +253,7 @@ def get_process_summary(): | |||
| """ | |||
| profile_dir = get_profiler_abs_dir(request) | |||
| device_id = unquote_args(request, "device_id") | |||
| to_int(device_id, 'device_id') | |||
| minddata_analyser = AnalyserFactory.instance().get_analyser( | |||
| 'minddata', profile_dir, device_id) | |||
| @@ -304,6 +308,7 @@ def get_profile_summary_proposal(): | |||
| device_id = get_device_id(request) | |||
| if not profiler_dir or not train_id: | |||
| raise ParamValueError("No profiler_dir or train_id.") | |||
| to_int(device_id, 'device_id') | |||
| profiler_dir_abs = os.path.join(settings.SUMMARY_BASE_DIR, train_id, profiler_dir) | |||
| try: | |||
| @@ -360,6 +365,7 @@ def get_minddata_pipeline_op_queue_info(): | |||
| validate_minddata_pipeline_condition(condition) | |||
| device_id = condition.get("device_id", "0") | |||
| to_int(device_id, 'device_id') | |||
| analyser = AnalyserFactory.instance().get_analyser( | |||
| 'minddata_pipeline', profiler_dir_abs, device_id | |||
| ) | |||
| @@ -397,6 +403,7 @@ def get_minddata_pipeline_queue_info(): | |||
| raise ParamValueError("Invalid profiler dir.") | |||
| device_id = request.args.get('device_id', default='0') | |||
| to_int(device_id, 'device_id') | |||
| op_id = request.args.get('op_id', type=int) | |||
| if op_id is None: | |||
| raise ParamValueError("Invalid operator id or operator id does not exist.") | |||
| @@ -99,7 +99,7 @@ class AicoreDetailAnalyser(BaseAnalyser): | |||
| Raises: | |||
| ProfilerPathErrorException: If the profiling dir is invalid. | |||
| """ | |||
| _col_names = ['op_name', 'op_type', 'execution_time', 'subgraph', | |||
| _col_names = ['op_name', 'op_type', 'avg_execution_time', 'subgraph', | |||
| 'full_op_name', 'op_info'] | |||
| _file_name_aicore_detail_time = 'aicore_intermediate_{}_detail.csv' | |||
| _file_name_framework_info = 'framework_raw_{}.csv' | |||
| @@ -24,7 +24,7 @@ from mindinsight.profiler.common.exceptions.exceptions import ProfilerParamTypeE | |||
| from mindinsight.profiler.common.log import logger as log | |||
| AICORE_TYPE_COL = ["op_type", "execution_time", "execution_frequency", "precent"] | |||
| AICORE_DETAIL_COL = ["op_name", "op_type", "execution_time", "subgraph", "full_op_name"] | |||
| AICORE_DETAIL_COL = ["op_name", "op_type", "avg_execution_time", "subgraph", "full_op_name"] | |||
| AICPU_COL = ["serial_number", "op_type", "total_time", "dispatch_time", "run_start", | |||
| "run_end"] | |||
| MINDDATA_PIPELINE_COL = [ | |||
| @@ -32,7 +32,7 @@ from tests.ut.profiler import RAW_DATA_BASE | |||
| OP_GATHER_V2_INFO = { | |||
| 'col_name': [ | |||
| 'op_name', 'op_type', 'execution_time', 'subgraph', 'full_op_name', 'op_info' | |||
| 'op_name', 'op_type', 'avg_execution_time', 'subgraph', 'full_op_name', 'op_info' | |||
| ], | |||
| 'object': [ | |||
| [ | |||
| @@ -213,7 +213,7 @@ class TestOpAnalyser: | |||
| } | |||
| }, | |||
| 'sort_condition': { | |||
| 'name': 'execution_time', | |||
| 'name': 'avg_execution_time', | |||
| 'type': 'descending' | |||
| }, | |||
| 'group_condition': { | |||
| @@ -21,8 +21,8 @@ from unittest import TestCase | |||
| from mindinsight.profiler.analyser.analyser_factory import AnalyserFactory | |||
| from tests.ut.profiler import PROFILER_DIR | |||
| COL_NAMES = ['op_name', 'op_type', 'execution_time', 'subgraph', 'full_op_name', | |||
| 'op_info'] | |||
| COL_NAMES = ['op_name', 'op_type', 'avg_execution_time', 'subgraph', | |||
| 'full_op_name', 'op_info'] | |||
| def get_detail_infos(indexes=None, sort_name=None, sort_type=True): | |||
| @@ -126,12 +126,12 @@ class TestAicoreDetailAnalyser(TestCase): | |||
| """Test the success of the querying function.""" | |||
| expect_result = { | |||
| 'col_name': COL_NAMES, | |||
| 'object': get_detail_infos(sort_name='execution_time', sort_type=True), | |||
| 'object': get_detail_infos(sort_name='avg_execution_time', sort_type=True), | |||
| 'size': 10 | |||
| } | |||
| condition = { | |||
| 'sort_condition': { | |||
| 'name': 'execution_time', | |||
| 'name': 'avg_execution_time', | |||
| 'type': 'descending' | |||
| } | |||
| } | |||
| @@ -187,7 +187,7 @@ class TestAicoreDetailAnalyser(TestCase): | |||
| expect_result = { | |||
| 'col_name': COL_NAMES, | |||
| 'object': get_detail_infos( | |||
| indexes=[1, 2], sort_name='execution_time', sort_type=True | |||
| indexes=[1, 2], sort_name='avg_execution_time', sort_type=True | |||
| ), | |||
| 'size': 4 | |||
| } | |||
| @@ -198,7 +198,7 @@ class TestAicoreDetailAnalyser(TestCase): | |||
| } | |||
| }, | |||
| 'sort_condition': { | |||
| 'name': 'execution_time' | |||
| 'name': 'avg_execution_time' | |||
| }, | |||
| 'group_condition': { | |||
| 'limit': 2, | |||
| @@ -211,7 +211,7 @@ class TestAicoreDetailAnalyser(TestCase): | |||
| expect_result = { | |||
| 'col_name': COL_NAMES, | |||
| 'object': get_detail_infos( | |||
| indexes=[0, 1, 2, 8], sort_name='execution_time', sort_type=True | |||
| indexes=[0, 1, 2, 8], sort_name='avg_execution_time', sort_type=True | |||
| ), | |||
| 'size': 4 | |||
| } | |||
| @@ -225,7 +225,7 @@ class TestAicoreDetailAnalyser(TestCase): | |||
| } | |||
| }, | |||
| 'sort_condition': { | |||
| 'name': 'execution_time' | |||
| 'name': 'avg_execution_time' | |||
| } | |||
| } | |||
| result = self._analyser.query(condition) | |||