Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
79caed66
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
79caed66
编写于
5月 26, 2020
作者:
W
wangchaochaohu
提交者:
GitHub
5月 26, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix the print error of PE record_event and framework overhead in profiler test=develop (#24744)
上级
56a714a1
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
26 addition
and
22 deletion
+26
-22
paddle/fluid/platform/device_tracer.cc
paddle/fluid/platform/device_tracer.cc
+23
-20
paddle/fluid/platform/device_tracer.h
paddle/fluid/platform/device_tracer.h
+1
-1
paddle/fluid/platform/profiler.cc
paddle/fluid/platform/profiler.cc
+2
-1
未找到文件。
paddle/fluid/platform/device_tracer.cc
浏览文件 @
79caed66
...
@@ -641,22 +641,24 @@ DeviceTracer *GetDeviceTracer() {
...
@@ -641,22 +641,24 @@ DeviceTracer *GetDeviceTracer() {
return
tracer
;
return
tracer
;
}
}
std
::
string
SetCurAnnotation
(
Event
*
event
)
{
// In order to record PE time, we add main_thread_annotation_stack
// for all event between PE run, we treat it as PE's child Event,
// so when event is not in same thread of PE event, we need add
// father event(PE::run event) for this event
void
SetCurAnnotation
(
Event
*
event
)
{
std
::
string
ret
;
std
::
string
ret
;
if
(
!
annotation_stack
.
empty
()
&&
event
->
role
()
!=
EventRole
::
kSpecial
)
{
if
(
!
annotation_stack
.
empty
())
{
event
->
set_parent
(
annotation_stack
.
back
());
event
->
set_parent
(
annotation_stack
.
back
());
event
->
set_name
(
annotation_stack
.
back
()
->
name
()
+
"/"
+
event
->
name
());
event
->
set_name
(
annotation_stack
.
back
()
->
name
()
+
"/"
+
event
->
name
());
}
}
if
(
annotation_stack
.
empty
()
&&
!
main_thread_annotation_stack
.
empty
()
&&
main_thread_annotation_stack
.
back
()
->
thread_id
()
!=
event
->
thread_id
())
{
event
->
set_parent
(
main_thread_annotation_stack
.
back
());
event
->
set_name
(
main_thread_annotation_stack
.
back
()
->
name
()
+
"/"
+
event
->
name
());
}
annotation_stack
.
push_back
(
event
);
annotation_stack
.
push_back
(
event
);
if
(
!
main_thread_annotation_stack_name
.
empty
()
&&
!
annotation_stack
.
empty
()
&&
main_thread_annotation_stack
.
back
()
->
thread_id
()
!=
annotation_stack
.
back
()
->
thread_id
())
{
ret
=
main_thread_annotation_stack_name
.
back
()
+
"/"
+
event
->
name
();
}
else
{
ret
=
event
->
name
();
}
if
(
event
->
role
()
==
EventRole
::
kSpecial
)
{
if
(
event
->
role
()
==
EventRole
::
kSpecial
)
{
std
::
string
name
=
event
->
name
();
std
::
string
name
=
event
->
name
();
if
(
!
main_thread_annotation_stack_name
.
empty
())
{
if
(
!
main_thread_annotation_stack_name
.
empty
())
{
...
@@ -665,23 +667,24 @@ std::string SetCurAnnotation(Event *event) {
...
@@ -665,23 +667,24 @@ std::string SetCurAnnotation(Event *event) {
main_thread_annotation_stack_name
.
push_back
(
name
);
main_thread_annotation_stack_name
.
push_back
(
name
);
main_thread_annotation_stack
.
push_back
(
event
);
main_thread_annotation_stack
.
push_back
(
event
);
}
}
return
ret
;
}
}
void
ClearCurAnnotation
()
{
void
ClearCurAnnotation
()
{
if
(
!
main_thread_annotation_stack_name
.
empty
()
&&
!
annotation_stack
.
empty
()
&&
main_thread_annotation_stack
.
back
()
->
thread_id
()
!=
annotation_stack
.
back
()
->
thread_id
())
{
annotation_stack
.
back
()
->
set_name
(
main_thread_annotation_stack_name
.
back
()
+
"/"
+
annotation_stack
.
back
()
->
name
());
}
if
(
!
main_thread_annotation_stack
.
empty
()
&&
if
(
!
main_thread_annotation_stack
.
empty
()
&&
main_thread_annotation_stack
.
back
()
->
name
()
==
main_thread_annotation_stack
.
back
()
->
name
()
==
annotation_stack
.
back
()
->
name
())
{
annotation_stack
.
back
()
->
name
())
{
std
::
string
name
=
annotation_stack
.
back
()
->
name
();
std
::
string
main_name
=
main_thread_annotation_stack
.
back
()
->
name
();
int
main_name_len
=
main_name
.
length
();
int
name_len
=
name
.
length
();
int
prefix_len
=
main_name_len
-
name_len
;
if
(
prefix_len
>=
0
&&
main_name
.
at
(
prefix_len
)
==
'/'
&&
name
==
main_name
.
substr
(
prefix_len
,
name_len
))
{
main_thread_annotation_stack_name
.
pop_back
();
main_thread_annotation_stack_name
.
pop_back
();
main_thread_annotation_stack
.
pop_back
();
main_thread_annotation_stack
.
pop_back
();
}
}
}
annotation_stack
.
pop_back
();
annotation_stack
.
pop_back
();
}
}
...
...
paddle/fluid/platform/device_tracer.h
浏览文件 @
79caed66
...
@@ -137,7 +137,7 @@ class DeviceTracer {
...
@@ -137,7 +137,7 @@ class DeviceTracer {
DeviceTracer
*
GetDeviceTracer
();
DeviceTracer
*
GetDeviceTracer
();
// Set a name for the cuda kernel operation being launched by the thread.
// Set a name for the cuda kernel operation being launched by the thread.
std
::
string
SetCurAnnotation
(
Event
*
event
);
void
SetCurAnnotation
(
Event
*
event
);
// Clear the name after the operation is done.
// Clear the name after the operation is done.
void
ClearCurAnnotation
();
void
ClearCurAnnotation
();
// Current name of the operation being run in the thread.
// Current name of the operation being run in the thread.
...
...
paddle/fluid/platform/profiler.cc
浏览文件 @
79caed66
...
@@ -73,7 +73,8 @@ RecordEvent::RecordEvent(const std::string &name, const EventRole role) {
...
@@ -73,7 +73,8 @@ RecordEvent::RecordEvent(const std::string &name, const EventRole role) {
// lock is not needed, the code below is thread-safe
// lock is not needed, the code below is thread-safe
Event
*
e
=
PushEvent
(
name
,
role
);
Event
*
e
=
PushEvent
(
name
,
role
);
// Maybe need the same push/pop behavior.
// Maybe need the same push/pop behavior.
name_
=
SetCurAnnotation
(
e
);
SetCurAnnotation
(
e
);
name_
=
e
->
name
();
}
}
RecordEvent
::~
RecordEvent
()
{
RecordEvent
::~
RecordEvent
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录