未验证 提交 c5d15655 编写于 作者: L liutiexing 提交者: GitHub

Update profiler (#39779)

* add align for WorkQueue

* add spinlock

* merge develop

* merge

* Add EventsWaiter

* Revert "Add EventsWaiter"

This reverts commit e206173aa9be7401b83a53581627bfaf557c8fb2.

* add log for Executor

* update the profiler
Co-authored-by: Nliutiexing <liutiexing@google.com>
上级 62ae5f62
......@@ -14,6 +14,7 @@
#include "paddle/fluid/platform/profiler/cupti_data_process.h"
#include <cstdio>
#include "paddle/fluid/platform/enforce.h"
#include "paddle/fluid/platform/os_info.h"
namespace paddle {
......@@ -26,7 +27,7 @@ void AddKernelRecord(const CUpti_ActivityKernel4* kernel, uint64_t start_ns,
return;
}
DeviceTraceEvent event;
event.name = kernel->name;
event.name = demangle(kernel->name);
event.type = TracerEventType::Kernel;
event.start_ns = kernel->start;
event.end_ns = kernel->end;
......
文件模式从 100755 更改为 100644
......@@ -21,26 +21,55 @@ limitations under the License. */
namespace paddle {
namespace platform {
// Default tracing level.
// It is Recommended to set the level explicitly.
static constexpr uint32_t kDefaultTraceLevel = 4;
// CPU event tracing. A trace marks something that happens but has no duration
// Host event tracing. A trace marks something that happens but has no duration
// associated with it. For example, thread starts working.
// Chrome Trace Viewer Format: Instant Event
struct RecordInstantEvent {
/**
* @param name: It is the caller's reponsibility to manage the underlying
* storage. RecordInstantEvent stores the pointer.
* @param type: Classification which is used to instruct the profiling
* data statistics.
* @param level: Used to filter events, works like glog VLOG(level).
* RecordEvent will works if HostTraceLevel >= level.
*/
explicit RecordInstantEvent(const char* name, TracerEventType type,
uint32_t level = kDefaultTraceLevel);
};
// CPU event tracing. A trace starts when an object of this clas is created and
// Host event tracing. A trace starts when an object of this clas is created and
// stops when the object is destroyed.
// Chrome Trace Viewer Format: Duration Event/Complte Event
class RecordEvent {
public:
/**
* @param name: If your string argument has a longer lifetime (e.g.: string
* literal, static variables, etc) than the event, use 'const char* name'.
* Do your best to avoid using 'std::string' as the argument type. It will
* cause deep-copy to harm performance.
* @param type: Classification which is used to instruct the profiling
* data statistics.
* @param level: Used to filter events, works like glog VLOG(level).
* RecordEvent will works if HostTraceLevel >= level.
*/
explicit RecordEvent(
const std::string& name,
const TracerEventType type = TracerEventType::UserDefined,
uint32_t level = kDefaultTraceLevel,
const EventRole role = EventRole::kOrdinary);
/**
* @param name: It is the caller's reponsibility to manage the underlying
* storage. RecordEvent stores the pointer.
* @param type: Classification which is used to instruct the profiling
* data statistics.
* @param level: Used to filter events, works like glog VLOG(level).
* RecordEvent will works if HostTraceLevel >= level.
*/
explicit RecordEvent(const char* name, const TracerEventType type =
TracerEventType::UserDefined,
uint32_t level = kDefaultTraceLevel,
......
......@@ -202,7 +202,7 @@ class ThreadEventRecorder {
ThreadEventSection GatherEvents() {
ThreadEventSection thr_sec;
thr_sec.thread_name = thread_name_;
thr_sec.thread_name = GetCurrentThreadName();
thr_sec.thread_id = thread_id_;
thr_sec.events = std::move(base_evt_cntr_.Reduce());
return thr_sec;
......@@ -210,7 +210,6 @@ class ThreadEventRecorder {
private:
uint64_t thread_id_;
std::string thread_name_;
EventContainer<CommonEvent> base_evt_cntr_;
};
......
文件模式从 100755 更改为 100644
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册