提交 83c104c4 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!289 profiler: fixed the method of timeline file searching

Merge pull request !289 from zhangyunshu/zys_timeline_0618
...@@ -66,17 +66,15 @@ class TimelineAnalyser(BaseAnalyser): ...@@ -66,17 +66,15 @@ class TimelineAnalyser(BaseAnalyser):
json, the content of timeline data. json, the content of timeline data.
""" """
# Search timeline json file under profiling dir. # Search timeline json file under profiling dir.
file_path = None timeline_filename = self._timeline_filename.format(self._device_id)
for filename in os.listdir(self._profiling_dir): display_filename = self._display_filename.format(self._device_id)
if filename.startswith('timeline_display') and filename.endswith('.json'): file_list = [filename for filename in os.listdir(self._profiling_dir)
file_path = os.path.join(self._profiling_dir, filename) if timeline_filename in filename or display_filename in filename]
logger.debug('Display file found.')
break
elif filename.startswith('timeline_detail') and filename.endswith('.json'):
file_path = os.path.join(self._profiling_dir, filename)
logger.debug('Original file found.')
break
# Check if there is a timeline json file for display
file_path = os.path.join(self._profiling_dir, display_filename)
if display_filename not in file_list:
file_path = os.path.join(self._profiling_dir, timeline_filename)
file_path = validate_and_normalize_path( file_path = validate_and_normalize_path(
file_path, raise_key='Invalid timeline json path.' file_path, raise_key='Invalid timeline json path.'
) )
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册