提交 54758ce8 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!394 revert "update the display column name in ui", fix the column name by UI

Merge pull request !394 from chenchao99/profiler_analyser
......@@ -34,8 +34,6 @@ class AicoreTypeAnalyser(BaseAnalyser):
ProfilerPathErrorException: If the profiling dir is invalid.
"""
_col_names = ['op_type', 'execution_time', 'execution_frequency', 'percent']
_col_names_in_result = ['op_type', 'execution_time (ms)',
'execution_frequency', 'percent']
_file_name_aicore_type_time = 'aicore_intermediate_{}_type.csv'
def _load(self):
......@@ -74,7 +72,6 @@ class AicoreTypeAnalyser(BaseAnalyser):
"""
for item in self._result:
item[1] = float(format(item[1], '.6f'))
self._display_col_names = self._col_names_in_result[:]
return super()._organize_query_result()
def _convert_field_type(self, row):
......@@ -104,8 +101,6 @@ class AicoreDetailAnalyser(BaseAnalyser):
"""
_col_names = ['op_name', 'op_type', 'avg_execution_time', 'subgraph',
'full_op_name', 'op_info']
_col_names_in_result = ['op_name', 'op_type', 'avg_execution_time (ms)',
'subgraph', 'full_op_name', 'op_info']
_file_name_aicore_detail_time = 'aicore_intermediate_{}_detail.csv'
_file_name_framework_info = 'framework_raw_{}.csv'
......@@ -231,11 +226,11 @@ class AicoreDetailAnalyser(BaseAnalyser):
is_display_full_op_name (bool): Whether to display the operator full
name.
"""
self._display_col_names = self._col_names_in_result[0:4]
self._display_col_names = self._col_names[0:4]
if is_display_full_op_name:
self._display_col_names.append(self._col_names_in_result[4])
self._display_col_names.append(self._col_names[4])
if is_display_detail:
self._display_col_names.append(self._col_names_in_result[5])
self._display_col_names.append(self._col_names[5])
def _convert_framework_field_type(self, row):
"""
......@@ -280,8 +275,6 @@ class AicpuAnalyser(BaseAnalyser):
"""
_col_names = ['serial_number', 'op_type', 'total_time', 'dispatch_time',
'run_start', 'run_end']
_col_names_in_result = ['serial_number', 'op_type', 'total_time (ms)',
'dispatch_time (ms)', 'run_start', 'run_end']
_file_name_aicpu_time = 'aicpu_intermediate_{}.csv'
def _load(self):
......@@ -312,16 +305,6 @@ class AicpuAnalyser(BaseAnalyser):
return self._default_filter(item, filter_condition)
self._result = list(filter(_inner_filter, self._data))
def _organize_query_result(self):
"""
Organize the query result.
Returns:
dict, the query result.
"""
self._display_col_names = self._col_names_in_result[:]
return super()._organize_query_result()
def _convert_field_type(self, row):
"""
Convert the field type to the specific type.
......
......@@ -32,8 +32,7 @@ from tests.ut.profiler import RAW_DATA_BASE
OP_GATHER_V2_INFO = {
'col_name': [
'op_name', 'op_type', 'avg_execution_time (ms)', 'subgraph', 'full_op_name',
'op_info'
'op_name', 'op_type', 'avg_execution_time', 'subgraph', 'full_op_name', 'op_info'
],
'object': [
[
......@@ -125,7 +124,7 @@ class TestOpAnalyser:
def test_query_aicore_type_1(self):
"""Test the function of querying AICORE operator type infomation."""
expect_result = {
'col_name': ['op_type', 'execution_time (ms)', 'execution_frequency', 'percent'],
'col_name': ['op_type', 'execution_time', 'execution_frequency', 'percent'],
'object': [
['UnsortedSegmentSum', 44.607826, 2, 35.28],
['GatherV2', 43.155441, 2, 34.13],
......@@ -177,7 +176,7 @@ class TestOpAnalyser:
def test_query_aicore_type_2(self):
"""Test the function of querying AICORE operator type infomation."""
expect_result = {
'col_name': ['op_type', 'execution_time (ms)', 'execution_frequency', 'percent'],
'col_name': ['op_type', 'execution_time', 'execution_frequency', 'percent'],
'object': [
['MatMul', 1.936681, 15, 1.53],
['Mul', 1.902949, 32, 1.51]
......
......@@ -23,8 +23,6 @@ from tests.ut.profiler import PROFILER_DIR
COL_NAMES = ['op_name', 'op_type', 'avg_execution_time', 'subgraph',
'full_op_name', 'op_info']
COL_NAMES_IN_RESULT = ['op_name', 'op_type', 'avg_execution_time (ms)',
'subgraph', 'full_op_name', 'op_info']
def get_detail_infos(indexes=None, sort_name=None, sort_type=True):
......@@ -77,7 +75,7 @@ class TestAicoreDetailAnalyser(TestCase):
def test_query_success_1(self):
"""Test the success of the querying function."""
expect_result = {
'col_name': COL_NAMES_IN_RESULT,
'col_name': COL_NAMES,
'object': get_detail_infos(),
'size': 10
}
......@@ -90,7 +88,7 @@ class TestAicoreDetailAnalyser(TestCase):
def test_query_success_2(self):
"""Test the success of the querying function."""
expect_result = {
'col_name': COL_NAMES_IN_RESULT,
'col_name': COL_NAMES,
'object': get_detail_infos(indexes=[9]),
'size': 1
}
......@@ -127,7 +125,7 @@ class TestAicoreDetailAnalyser(TestCase):
def test_query_success_3(self):
"""Test the success of the querying function."""
expect_result = {
'col_name': COL_NAMES_IN_RESULT,
'col_name': COL_NAMES,
'object': get_detail_infos(sort_name='avg_execution_time', sort_type=True),
'size': 10
}
......@@ -141,7 +139,7 @@ class TestAicoreDetailAnalyser(TestCase):
self.assertDictEqual(expect_result, result)
expect_result = {
'col_name': COL_NAMES_IN_RESULT,
'col_name': COL_NAMES,
'object': get_detail_infos(sort_name='op_name', sort_type=False),
'size': 10
}
......@@ -157,7 +155,7 @@ class TestAicoreDetailAnalyser(TestCase):
def test_query_success_4(self):
"""Test the success of the querying function."""
expect_result = {
'col_name': COL_NAMES_IN_RESULT,
'col_name': COL_NAMES,
'object': get_detail_infos(indexes=[2, 3]),
'size': 10
}
......@@ -171,7 +169,7 @@ class TestAicoreDetailAnalyser(TestCase):
self.assertDictEqual(expect_result, result)
expect_result = {
'col_name': COL_NAMES_IN_RESULT,
'col_name': COL_NAMES,
'object': [],
'size': 10
}
......@@ -187,7 +185,7 @@ class TestAicoreDetailAnalyser(TestCase):
def test_query_success_5(self):
"""Test the success of the querying function."""
expect_result = {
'col_name': COL_NAMES_IN_RESULT,
'col_name': COL_NAMES,
'object': get_detail_infos(
indexes=[1, 2], sort_name='avg_execution_time', sort_type=True
),
......@@ -211,7 +209,7 @@ class TestAicoreDetailAnalyser(TestCase):
self.assertDictEqual(expect_result, result)
expect_result = {
'col_name': COL_NAMES_IN_RESULT,
'col_name': COL_NAMES,
'object': get_detail_infos(
indexes=[0, 1, 2, 8], sort_name='avg_execution_time', sort_type=True
),
......@@ -238,7 +236,7 @@ class TestAicoreDetailAnalyser(TestCase):
detail_infos = get_detail_infos(indexes=[9])
expect_result = {
'col_name': COL_NAMES_IN_RESULT[0:5],
'col_name': COL_NAMES[0:5],
'object': [item[0:5] for item in detail_infos],
'size': 1
}
......@@ -254,7 +252,7 @@ class TestAicoreDetailAnalyser(TestCase):
self.assertDictEqual(expect_result, result)
expect_result = {
'col_name': COL_NAMES_IN_RESULT[0:4],
'col_name': COL_NAMES[0:4],
'object': [item[0:4] for item in detail_infos],
'size': 1
}
......@@ -274,7 +272,7 @@ class TestAicoreDetailAnalyser(TestCase):
"""Test the success of the querying and sorting function by operator type."""
detail_infos = get_detail_infos(indexes=[9, 0, 2, 1, 5, 3, 4])
expect_result = {
'col_name': COL_NAMES_IN_RESULT[0:4],
'col_name': COL_NAMES[0:4],
'object': [item[0:4] for item in detail_infos]
}
......@@ -296,7 +294,7 @@ class TestAicoreDetailAnalyser(TestCase):
"""Test the success of the querying and sorting function by operator type."""
detail_infos = get_detail_infos(indexes=[9, 0, 2, 1, 3, 4, 8, 6])
expect_result = {
'col_name': COL_NAMES_IN_RESULT[0:4],
'col_name': COL_NAMES[0:4],
'object': [item[0:4] for item in detail_infos]
}
......
......@@ -21,8 +21,6 @@ from mindinsight.profiler.analyser.analyser_factory import AnalyserFactory
from tests.ut.profiler import PROFILER_DIR
COL_NAMES = ['op_type', 'execution_time', 'execution_frequency', 'percent']
COL_NAMES_IN_RESULT = ['op_type', 'execution_time (ms)', 'execution_frequency',
'percent']
def get_type_infos(indexes=None, sort_name=None, sort_type=True):
......@@ -74,7 +72,7 @@ class TestAicoreTypeAnalyser(TestCase):
def test_query_success_1(self):
"""Test the success of the querying function."""
expect_result = {
'col_name': COL_NAMES_IN_RESULT,
'col_name': COL_NAMES,
'object': get_type_infos(),
'size': 5
}
......@@ -88,7 +86,7 @@ class TestAicoreTypeAnalyser(TestCase):
def test_query_success_2(self):
"""Test the success of the querying function."""
expect_result = {
'col_name': COL_NAMES_IN_RESULT,
'col_name': COL_NAMES,
'object': get_type_infos(indexes=[1]),
'size': 1
}
......@@ -103,7 +101,7 @@ class TestAicoreTypeAnalyser(TestCase):
self.assertDictEqual(expect_result, result)
expect_result = {
'col_name': COL_NAMES_IN_RESULT,
'col_name': COL_NAMES,
'object': get_type_infos(indexes=[0, 2, 3, 4]),
'size': 4
}
......@@ -118,7 +116,7 @@ class TestAicoreTypeAnalyser(TestCase):
self.assertDictEqual(expect_result, result)
expect_result = {
'col_name': COL_NAMES_IN_RESULT,
'col_name': COL_NAMES,
'object': get_type_infos(indexes=[0, 1, 3]),
'size': 3
}
......@@ -135,7 +133,7 @@ class TestAicoreTypeAnalyser(TestCase):
def test_query_success_3(self):
"""Test the success of the querying function."""
expect_result = {
'col_name': COL_NAMES_IN_RESULT,
'col_name': COL_NAMES,
'object': get_type_infos(indexes=[1, 3]),
'size': 2
}
......@@ -150,7 +148,7 @@ class TestAicoreTypeAnalyser(TestCase):
self.assertDictEqual(expect_result, result)
expect_result = {
'col_name': COL_NAMES_IN_RESULT,
'col_name': COL_NAMES,
'object': get_type_infos(indexes=[0, 2, 4]),
'size': 3
}
......@@ -165,7 +163,7 @@ class TestAicoreTypeAnalyser(TestCase):
self.assertDictEqual(expect_result, result)
expect_result = {
'col_name': COL_NAMES_IN_RESULT,
'col_name': COL_NAMES,
'object': get_type_infos(indexes=[2, 3]),
'size': 2
}
......@@ -182,7 +180,7 @@ class TestAicoreTypeAnalyser(TestCase):
def test_query_success_4(self):
"""Test the success of the querying function."""
expect_result = {
'col_name': COL_NAMES_IN_RESULT,
'col_name': COL_NAMES,
'object': get_type_infos(sort_name='op_type', sort_type=True),
'size': 5}
condition = {
......@@ -195,7 +193,7 @@ class TestAicoreTypeAnalyser(TestCase):
self.assertDictEqual(expect_result, result)
expect_result = {
'col_name': COL_NAMES_IN_RESULT,
'col_name': COL_NAMES,
'object': get_type_infos(sort_name='execution_time', sort_type=False),
'size': 5
}
......@@ -211,7 +209,7 @@ class TestAicoreTypeAnalyser(TestCase):
def test_query_success_5(self):
"""Test the success of the querying function."""
expect_result = {
'col_name': COL_NAMES_IN_RESULT,
'col_name': COL_NAMES,
'object': get_type_infos(indexes=[0, 1]),
'size': 5
}
......@@ -225,7 +223,7 @@ class TestAicoreTypeAnalyser(TestCase):
self.assertDictEqual(expect_result, result)
expect_result = {
'col_name': COL_NAMES_IN_RESULT,
'col_name': COL_NAMES,
'object': get_type_infos(indexes=[3, 4]),
'size': 5
}
......@@ -241,7 +239,7 @@ class TestAicoreTypeAnalyser(TestCase):
def test_query_success_6(self):
"""Test the success of the querying function."""
expect_result = {
'col_name': COL_NAMES_IN_RESULT,
'col_name': COL_NAMES,
'object': get_type_infos(
indexes=[1, 3], sort_name='execution_time', sort_type=True
),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册