Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MindSpore
mindinsight
提交
48c79ba5
M
mindinsight
项目概览
MindSpore
/
mindinsight
通知
7
Star
3
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindinsight
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
48c79ba5
编写于
6月 24, 2020
作者:
W
WeiFeng-mindinsight
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix bug of step trace, the text of small data will show outside of the rect which own it
上级
dc62cd0f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
135 addition
and
47 deletion
+135
-47
mindinsight/ui/src/views/train-manage/profiling-dashboard.vue
...insight/ui/src/views/train-manage/profiling-dashboard.vue
+56
-12
mindinsight/ui/src/views/train-manage/step-trace.vue
mindinsight/ui/src/views/train-manage/step-trace.vue
+79
-35
未找到文件。
mindinsight/ui/src/views/train-manage/profiling-dashboard.vue
浏览文件 @
48c79ba5
...
...
@@ -186,7 +186,7 @@ limitations under the License.
<div
class=
"cell-container device_queue_op"
clickKey=
"device_queue_op"
>
<div
class=
"title"
>
{{
$t
(
'
profiling.deviceQueueOp
Tip
'
)
}}
{{
$t
(
'
profiling.deviceQueueOp
'
)
}}
</div>
</div>
...
...
@@ -351,6 +351,7 @@ export default {
totalTime
:
0
,
rowHeight
:
60
,
markerPadding
:
4
,
minRate
:
0.05
,
namespaceURI
:
'
http://www.w3.org/2000/svg
'
,
resizeTimer
:
null
,
colorList
:
[
...
...
@@ -650,20 +651,28 @@ export default {
const
traceDom
=
document
.
querySelector
(
'
#trace
'
);
if
(
traceDom
)
{
this
.
svg
.
totalWidth
=
traceDom
.
offsetWidth
-
this
.
svg
.
svgPadding
*
2
;
if
(
this
.
svg
.
data
[
0
]
&&
this
.
svg
.
data
[
0
].
length
)
{
const
svg
=
document
.
querySelector
(
'
#trace
svg
'
);
const
svg
=
traceDom
.
querySelector
(
'
svg
'
);
this
.
svg
.
totalTime
=
this
.
svg
.
data
[
0
][
0
].
duration
;
if
(
this
.
svg
.
totalTime
)
{
this
.
svg
.
colorIndex
=
0
;
const
minTime
=
this
.
svg
.
minRate
*
this
.
svg
.
totalTime
;
this
.
svg
.
data
.
forEach
((
row
,
index
)
=>
{
if
(
row
&&
row
.
length
)
{
const
dashedLine
=
this
.
addDashedLine
(
index
);
svg
.
insertBefore
(
dashedLine
,
svg
.
querySelector
(
'
g
'
));
row
.
forEach
((
i
)
=>
{
if
(
i
.
duration
)
{
if
(
i
.
name
)
{
const
tempDom
=
this
.
createRect
(
i
,
index
);
svg
.
insertBefore
(
tempDom
,
svg
.
querySelector
(
'
g
'
));
const
tempStr
=
`g
${
i
.
duration
>
minTime
?
''
:
'
.arrow
'
}
`
;
svg
.
insertBefore
(
tempDom
,
svg
.
querySelector
(
tempStr
));
}
else
{
const
tempDom
=
this
.
createArrow
(
i
,
index
);
svg
.
appendChild
(
tempDom
);
...
...
@@ -690,19 +699,27 @@ export default {
line
.
setAttribute
(
'
style
'
,
'
stroke:#E2E2E2;stroke-width:1
'
);
line
.
setAttribute
(
'
stroke-dasharray
'
,
'
5 5
'
);
const
g
=
document
.
createElementNS
(
this
.
svg
.
namespaceURI
,
'
g
'
);
g
.
setAttribute
(
'
class
'
,
'
dashedLine
'
);
g
.
appendChild
(
line
);
return
g
;
},
createRect
(
data
,
rowIndex
)
{
const
color
=
this
.
svg
.
colorList
[
this
.
svg
.
colorIndex
++
%
4
];
const
color
=
this
.
svg
.
colorList
[
rowIndex
>
1
?
3
:
this
.
svg
.
colorIndex
++
%
4
];
const
height
=
40
;
const
width
=
(
data
.
duration
/
this
.
svg
.
totalTime
)
*
this
.
svg
.
totalWidth
;
const
fontSize
=
12
;
const
normalRect
=
data
.
duration
>
this
.
svg
.
minRate
*
this
.
svg
.
totalTime
;
const
x1
=
(
data
.
start
/
this
.
svg
.
totalTime
)
*
this
.
svg
.
totalWidth
+
this
.
svg
.
svgPadding
;
const
y1
=
rowIndex
*
this
.
svg
.
rowHeight
+
(
this
.
svg
.
rowHeight
-
height
)
/
2
;
const
g
=
document
.
createElementNS
(
this
.
svg
.
namespaceURI
,
'
g
'
);
g
.
setAttribute
(
'
class
'
,
'
rect
'
);
const
gChild
=
document
.
createElementNS
(
this
.
svg
.
namespaceURI
,
'
g
'
);
let
name
=
''
;
switch
(
data
.
name
)
{
...
...
@@ -710,7 +727,7 @@ export default {
name
=
this
.
$t
(
'
profiling.lterationGap
'
);
break
;
case
'
fp_and_bp
'
:
name
=
this
.
$t
(
'
profiling.deviceQueueOp
Tip
'
);
name
=
this
.
$t
(
'
profiling.deviceQueueOp
'
);
break
;
case
'
tail
'
:
name
=
this
.
$t
(
'
profiling.lterationTail
'
);
...
...
@@ -731,16 +748,30 @@ export default {
this
.
svg
.
namespaceURI
,
'
foreignObject
'
,
);
foreignObject
.
setAttribute
(
'
x
'
,
x1
);
foreignObject
.
setAttribute
(
'
y
'
,
y1
);
foreignObject
.
setAttribute
(
'
height
'
,
height
);
foreignObject
.
textContent
=
`
${
name
}
:
${
data
.
duration
.
toFixed
(
4
)}
ms`
;
const
textWidth
=
this
.
getTextWidth
(
foreignObject
.
textContent
);
foreignObject
.
setAttribute
(
'
x
'
,
normalRect
?
x1
:
Math
.
min
(
this
.
svg
.
svgPadding
*
2
+
this
.
svg
.
totalWidth
-
textWidth
,
Math
.
max
(
0
,
x1
+
width
/
2
-
textWidth
/
2
),
),
);
foreignObject
.
setAttribute
(
'
y
'
,
y1
+
(
height
-
fontSize
)
/
2
+
(
normalRect
?
0
:
fontSize
),
);
foreignObject
.
setAttribute
(
'
height
'
,
fontSize
);
foreignObject
.
setAttribute
(
'
width
'
,
width
);
foreignObject
.
setAttribute
(
'
style
'
,
`color:
${
color
[
0
]}
`
);
foreignObject
.
setAttribute
(
'
style
'
,
`overflow:hidden;text-align:center;text-overflow:ellipsis;`
+
`white-space:nowrap;font-size:12px;line-height:
${
height
}
px;color:
${
color
[
0
]}
`
,
'
class
'
,
`content
${
normalRect
?
''
:
'
content-mini
'
}
`
,
);
foreignObject
.
textContent
=
`
${
name
}
:
${
data
.
duration
.
toFixed
(
4
)}
ms`
;
const
title
=
document
.
createElementNS
(
this
.
svg
.
namespaceURI
,
'
title
'
);
title
.
textContent
=
`
${
name
}
:
${
data
.
duration
.
toFixed
(
4
)}
ms`
;
...
...
@@ -761,6 +792,7 @@ export default {
const
x2
=
x1
+
width
-
this
.
svg
.
markerPadding
*
2
;
const
y
=
rowIndex
*
this
.
svg
.
rowHeight
+
this
.
svg
.
rowHeight
/
2
;
const
g
=
document
.
createElementNS
(
this
.
svg
.
namespaceURI
,
'
g
'
);
g
.
setAttribute
(
'
class
'
,
'
arrow
'
);
const
line
=
document
.
createElementNS
(
this
.
svg
.
namespaceURI
,
'
line
'
);
line
.
setAttribute
(
'
x1
'
,
x1
);
...
...
@@ -1036,6 +1068,17 @@ export default {
.training-trace
{
position
:
relative
;
height
:
0
;
.content
{
overflow
:
hidden
;
text-align
:
center
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
font-size
:
12px
;
line-height
:
12px
;
}
.content-mini
{
overflow
:
visible
;
}
}
}
}
...
...
@@ -1213,6 +1256,7 @@ export default {
.pie-chart
{
width
:
100%
;
height
:
260px
;
overflow
:
hidden
;
}
.image-noData
{
width
:
100%
;
...
...
mindinsight/ui/src/views/train-manage/step-trace.vue
浏览文件 @
48c79ba5
...
...
@@ -162,6 +162,7 @@ export default {
totalTime
:
0
,
rowHeight
:
60
,
markerPadding
:
4
,
minRate
:
0.05
,
namespaceURI
:
'
http://www.w3.org/2000/svg
'
,
resizeTimer
:
null
,
colorList
:
[
...
...
@@ -328,7 +329,6 @@ export default {
type
:
'
category
'
,
data
:
xAxisData
,
name
:
'
step
'
,
max
:
this
.
steps
.
max
,
},
yAxis
:
{
type
:
'
value
'
,
...
...
@@ -456,33 +456,43 @@ export default {
},
dealTraceData
()
{
this
.
svg
.
totalWidth
=
document
.
querySelector
(
'
#trace
'
).
offsetWidth
-
this
.
svg
.
svgPadding
*
2
;
if
(
this
.
svg
.
data
[
0
]
&&
this
.
svg
.
data
[
0
].
length
)
{
const
svg
=
document
.
querySelector
(
'
#trace svg
'
);
this
.
svg
.
totalTime
=
this
.
svg
.
data
[
0
][
0
].
duration
;
if
(
this
.
svg
.
totalTime
)
{
this
.
svg
.
colorIndex
=
0
;
this
.
svg
.
data
.
forEach
((
row
,
index
)
=>
{
if
(
row
&&
row
.
length
)
{
const
dashedLine
=
this
.
addDashedLine
(
index
);
svg
.
insertBefore
(
dashedLine
,
svg
.
querySelector
(
'
g
'
));
row
.
forEach
((
i
)
=>
{
if
(
i
.
duration
)
{
if
(
i
.
name
)
{
const
tempDom
=
this
.
createRect
(
i
,
index
);
svg
.
insertBefore
(
tempDom
,
svg
.
querySelector
(
'
g
'
));
}
else
{
const
tempDom
=
this
.
createArrow
(
i
,
index
);
svg
.
appendChild
(
tempDom
);
const
traceDom
=
document
.
querySelector
(
'
#trace
'
);
if
(
traceDom
)
{
this
.
svg
.
totalWidth
=
traceDom
.
offsetWidth
-
this
.
svg
.
svgPadding
*
2
;
if
(
this
.
svg
.
data
[
0
]
&&
this
.
svg
.
data
[
0
].
length
)
{
const
svg
=
traceDom
.
querySelector
(
'
svg
'
);
this
.
svg
.
totalTime
=
this
.
svg
.
data
[
0
][
0
].
duration
;
if
(
this
.
svg
.
totalTime
)
{
this
.
svg
.
colorIndex
=
0
;
const
minTime
=
this
.
svg
.
minRate
*
this
.
svg
.
totalTime
;
this
.
svg
.
data
.
forEach
((
row
,
index
)
=>
{
if
(
row
&&
row
.
length
)
{
const
dashedLine
=
this
.
addDashedLine
(
index
);
svg
.
insertBefore
(
dashedLine
,
svg
.
querySelector
(
'
g
'
));
row
.
forEach
((
i
)
=>
{
if
(
i
.
duration
)
{
if
(
i
.
name
)
{
const
tempDom
=
this
.
createRect
(
i
,
index
);
const
tempStr
=
`g
${
i
.
duration
>
minTime
?
''
:
'
.arrow
'
}
`
;
svg
.
insertBefore
(
tempDom
,
svg
.
querySelector
(
tempStr
));
}
else
{
const
tempDom
=
this
.
createArrow
(
i
,
index
);
svg
.
appendChild
(
tempDom
);
}
}
}
});
}
});
});
}
});
}
}
else
{
this
.
removeTrace
();
}
}
else
{
this
.
removeTrace
();
}
},
addDashedLine
(
index
)
{
...
...
@@ -497,19 +507,27 @@ export default {
line
.
setAttribute
(
'
style
'
,
'
stroke:#E2E2E2;stroke-width:1
'
);
line
.
setAttribute
(
'
stroke-dasharray
'
,
'
5 5
'
);
const
g
=
document
.
createElementNS
(
this
.
svg
.
namespaceURI
,
'
g
'
);
g
.
setAttribute
(
'
class
'
,
'
dashedLine
'
);
g
.
appendChild
(
line
);
return
g
;
},
createRect
(
data
,
rowIndex
)
{
const
color
=
this
.
svg
.
colorList
[
this
.
svg
.
colorIndex
++
%
4
];
const
color
=
this
.
svg
.
colorList
[
rowIndex
>
1
?
3
:
this
.
svg
.
colorIndex
++
%
4
];
const
height
=
40
;
const
width
=
(
data
.
duration
/
this
.
svg
.
totalTime
)
*
this
.
svg
.
totalWidth
;
const
fontSize
=
12
;
const
normalRect
=
data
.
duration
>
this
.
svg
.
minRate
*
this
.
svg
.
totalTime
;
const
x1
=
(
data
.
start
/
this
.
svg
.
totalTime
)
*
this
.
svg
.
totalWidth
+
this
.
svg
.
svgPadding
;
const
y1
=
rowIndex
*
this
.
svg
.
rowHeight
+
(
this
.
svg
.
rowHeight
-
height
)
/
2
;
const
g
=
document
.
createElementNS
(
this
.
svg
.
namespaceURI
,
'
g
'
);
g
.
setAttribute
(
'
class
'
,
'
rect
'
);
const
gChild
=
document
.
createElementNS
(
this
.
svg
.
namespaceURI
,
'
g
'
);
let
name
=
''
;
switch
(
data
.
name
)
{
...
...
@@ -517,7 +535,7 @@ export default {
name
=
this
.
$t
(
'
profiling.lterationGap
'
);
break
;
case
'
fp_and_bp
'
:
name
=
this
.
$t
(
'
profiling.deviceQueueOp
Tip
'
);
name
=
this
.
$t
(
'
profiling.deviceQueueOp
'
);
break
;
case
'
tail
'
:
name
=
this
.
$t
(
'
profiling.lterationTail
'
);
...
...
@@ -538,16 +556,30 @@ export default {
this
.
svg
.
namespaceURI
,
'
foreignObject
'
,
);
foreignObject
.
setAttribute
(
'
x
'
,
x1
);
foreignObject
.
setAttribute
(
'
y
'
,
y1
);
foreignObject
.
setAttribute
(
'
height
'
,
height
);
foreignObject
.
textContent
=
`
${
name
}
:
${
data
.
duration
.
toFixed
(
4
)}
ms`
;
const
textWidth
=
this
.
getTextWidth
(
foreignObject
.
textContent
);
foreignObject
.
setAttribute
(
'
x
'
,
normalRect
?
x1
:
Math
.
min
(
this
.
svg
.
svgPadding
*
2
+
this
.
svg
.
totalWidth
-
textWidth
,
Math
.
max
(
0
,
x1
+
width
/
2
-
textWidth
/
2
),
),
);
foreignObject
.
setAttribute
(
'
y
'
,
y1
+
(
height
-
fontSize
)
/
2
+
(
normalRect
?
0
:
fontSize
),
);
foreignObject
.
setAttribute
(
'
height
'
,
fontSize
);
foreignObject
.
setAttribute
(
'
width
'
,
width
);
foreignObject
.
setAttribute
(
'
style
'
,
`color:
${
color
[
0
]}
`
);
foreignObject
.
setAttribute
(
'
style
'
,
`overflow:hidden;text-align:center;text-overflow:ellipsis;`
+
`white-space:nowrap;font-size:12px;line-height:
${
height
}
px;color:
${
color
[
0
]}
`
,
'
class
'
,
`content
${
normalRect
?
''
:
'
content-mini
'
}
`
,
);
foreignObject
.
textContent
=
`
${
name
}
:
${
data
.
duration
.
toFixed
(
4
)}
ms`
;
const
title
=
document
.
createElementNS
(
this
.
svg
.
namespaceURI
,
'
title
'
);
title
.
textContent
=
`
${
name
}
:
${
data
.
duration
.
toFixed
(
4
)}
ms`
;
...
...
@@ -568,6 +600,7 @@ export default {
const
x2
=
x1
+
width
-
this
.
svg
.
markerPadding
*
2
;
const
y
=
rowIndex
*
this
.
svg
.
rowHeight
+
this
.
svg
.
rowHeight
/
2
;
const
g
=
document
.
createElementNS
(
this
.
svg
.
namespaceURI
,
'
g
'
);
g
.
setAttribute
(
'
class
'
,
'
arrow
'
);
const
line
=
document
.
createElementNS
(
this
.
svg
.
namespaceURI
,
'
line
'
);
line
.
setAttribute
(
'
x1
'
,
x1
);
...
...
@@ -742,6 +775,17 @@ export default {
cursor
:
pointer
;
background-image
:
url('../../assets/images/download.png')
;
}
.content
{
overflow
:
hidden
;
text-align
:
center
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
font-size
:
12px
;
line-height
:
12px
;
}
.content-mini
{
overflow
:
visible
;
}
}
}
.chart-wrap
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录