From e44e9b904846f126f7fef1aa593f0f5a75a5d16e Mon Sep 17 00:00:00 2001 From: wuyulong11 Date: Thu, 29 Jun 2023 14:16:45 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E8=AF=B4=E6=98=8E?= =?UTF-8?q?=E3=80=91=20=E4=BF=AE=E6=94=B9Component=E9=A1=B5=E7=AD=BE?= =?UTF-8?q?=E6=8A=98=E7=BA=BF=E5=9B=BE=E6=95=B0=E6=8D=AE=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=20=E3=80=90=E4=BF=AE=E6=94=B9=E4=BA=BA?= =?UTF-8?q?=E3=80=91=20wuyulong=2030031080?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fe/src/components/charts/NewLineChart.tsx | 61 ++++++------------- .../torch_tb_profiler/profiler/data.py | 13 ++-- 2 files changed, 26 insertions(+), 48 deletions(-) diff --git a/tb_plugins/profiling/tb_plugin/fe/src/components/charts/NewLineChart.tsx b/tb_plugins/profiling/tb_plugin/fe/src/components/charts/NewLineChart.tsx index 526efe0bb08..a9579027227 100644 --- a/tb_plugins/profiling/tb_plugin/fe/src/components/charts/NewLineChart.tsx +++ b/tb_plugins/profiling/tb_plugin/fe/src/components/charts/NewLineChart.tsx @@ -128,35 +128,29 @@ export const LineChart: React.FC = (props) => { ) } } else if (graph.columns.length === 5) { - const datasetTitle1: Array = [] - const datasetTitle2: Array = [] - graph.columns.forEach((column, index) => { - if (index === 0 || index < 3) { - datasetTitle1.push(column.name) - } - if (index === 0 || index >= 3) { - datasetTitle2.push(column.name) - } + const datasetTitle = graph.columns.map(item => item.name) + const mergedGERows = graph.rows['GE'].map((item: Array) => { + return [item[0], null, null, item[1], item[2]] + }) + const finalRows = graph.rows['PTA'].concat(mergedGERows).sort((a: any, b: any) => { + return a[0] - b[0] }) option = { ...option, - dataset: [ - { - source: [ - datasetTitle1, - ...graph.rows['PTA'] - ] - }, - { - source: [ - datasetTitle2, - ...graph.rows['GE'] - ] - } - ], - series: Array(2).fill( + dataset: + { + source: [ + datasetTitle, + ...finalRows + ] + }, + tooltip: { + show: false + }, + series: Array(4).fill( { type: 'line', + connectNulls: true, select: { itemStyle: { borderWidth: 5, @@ -171,24 +165,7 @@ export const LineChart: React.FC = (props) => { }, selectedMode: 'single', datasetIndex: 0 - }).concat(Array(2).fill( - { - type: 'line', - select: { - itemStyle: { - borderWidth: 5, - shadowBlur: 5 - } - }, - emphasis: { - itemStyle: { - borderWidth: 5, - shadowBlur: 5 - } - }, - selectedMode: 'single', - datasetIndex: 1 - })) + }) } } } else { diff --git a/tb_plugins/profiling/tb_plugin/torch_tb_profiler/profiler/data.py b/tb_plugins/profiling/tb_plugin/torch_tb_profiler/profiler/data.py index 442578c16cc..f699f43b0fe 100644 --- a/tb_plugins/profiling/tb_plugin/torch_tb_profiler/profiler/data.py +++ b/tb_plugins/profiling/tb_plugin/torch_tb_profiler/profiler/data.py @@ -201,12 +201,13 @@ class RunProfileData(object): for i in reversed(range(len(event_list))): if event_list[i].get('ts') is not None: start_ts = min(start_ts, event_list[i]['ts']) - if event_list[i]['name'] == 'Record Window End': - end_index = i - elif event_list[i]['name'].startswith('Iteration Start:'): - start_index = i - if start_index is not None and end_index is not None: - break + if device_target != 'Ascend': + if event_list[i]['name'] == 'Record Window End': + end_index = i + elif event_list[i]['name'].startswith('Iteration Start:'): + start_index = i + if start_index is not None and end_index is not None: + break if start_index is not None and end_index is not None: dur = event_list[end_index]['ts'] - event_list[start_index]['ts'] -- Gitee