-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better timeline #9037
Better timeline #9037
Conversation
panyx0718
commented
Mar 14, 2018
- Supported nested event
- Better support for cpu multi-thread
- Betters support nested block and block total time.
b97dc69
to
fbe8a9a
Compare
RecordThread::~RecordThread() { | ||
if (g_state == ProfilerState::kDisabled) return; | ||
ClearCurThread(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that RecordThread
only supports one layer nesting. If RecordThread
records the PreThread
before setting CurThread
, RecordThread
can support more layers nesting.
thread0
thread1
thread2
thread1
thread0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, currently, it doesn't auto support thread nesting. See comments here:
paddle/fluid/platform/device_tracer.cc
The main reason is that we don't have nest threading yet.
Actually, user can add code to give nested thread different ids:
int nested_thread_id = CurThread() * 10 + 1
std::thread([nested_thread_id]() {
RecordThread(nested_thread_id);
...
}
namespace { | ||
// block id starts from 0. This id is used to represent the codeblock | ||
// wrapping the first block 0. | ||
int kProgramId = -1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is kProgramId
to distinguish the different program
in a model?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. The global block has block id 0. However, before the block 0 starts, there are some other preprocessing and post-processing overhead. I wrap those codes into block id -1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! We can get this merge first.