-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add align for WorkQueue * add spinlock * merge develop * merge * Add EventsWaiter * Revert "Add EventsWaiter" This reverts commit e206173. * profiler skeleton * update * update * update Co-authored-by: liutiexing <liutiexing@google.com>
- Loading branch information
1 parent
e30150d
commit a8afed6
Showing
12 changed files
with
154 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
cc_library(workqueue SRCS workqueue.cc workqueue_utils.cc events_waiter.cc DEPS enforce glog) | ||
cc_library(workqueue_utils SRCS workqueue_utils.cc events_waiter.cc DEPS enforce glog) | ||
cc_library(workqueue SRCS workqueue.cc DEPS workqueue_utils enforce glog) | ||
cc_test(workqueue_test SRCS workqueue_test.cc DEPS workqueue) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
cc_library(host_event_recorder SRCS host_event_recorder.cc DEPS os_info) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. | ||
licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. */ | ||
|
||
#pragma once | ||
|
||
#include <list> | ||
|
||
namespace paddle { | ||
namespace platform { | ||
|
||
struct HostRecord { | ||
std::string name; | ||
uint64_t start_ns; | ||
uint64_t end_ns; | ||
uint64_t process_id; | ||
uint64_t thread_id; | ||
}; | ||
|
||
struct RuntimeRecord { | ||
std::string name; | ||
uint64_t start_ns; | ||
uint64_t end_ns; | ||
uint64_t process_id; | ||
uint64_t thread_id; | ||
uint32_t correlation_id; | ||
}; | ||
|
||
struct DeviceRecord { | ||
std::string name; | ||
uint64_t start_ns; | ||
uint64_t end_ns; | ||
uint32_t correlation_id; | ||
}; | ||
|
||
class TraceEventCollector { | ||
public: | ||
void AddHostRecord(HostRecord&& record) { host_records_.push_back(record); } | ||
|
||
void AddRuntimeRecord(RuntimeRecord&& record) { | ||
runtime_records_.push_back(record); | ||
} | ||
|
||
void AddDeviceRecord(DeviceRecord&& record) { | ||
device_records_.push_back(record); | ||
} | ||
|
||
private: | ||
std::list<HostRecord> host_records_; | ||
std::list<RuntimeRecord> runtime_records_; | ||
std::list<DeviceRecord> device_records_; | ||
}; | ||
|
||
} // namespace platform | ||
} // namespace paddle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. | ||
licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. */ | ||
|
||
#pragma once | ||
|
||
#include "paddle/fluid/platform/profiler/trace_event_collector.h" | ||
|
||
namespace paddle { | ||
namespace platform { | ||
|
||
class TracerBase { | ||
public: | ||
// The state machine for a Tracer. | ||
enum class TracerState { UNINITED, READY, STARTED, STOPED }; | ||
|
||
virtual void PrepareTracing() { state_ = TracerState::READY; } | ||
|
||
virtual void StartTracing() = 0; | ||
|
||
virtual void StopTracing() = 0; | ||
|
||
virtual void CollectTraceData(TraceEventCollector* collector) = 0; | ||
|
||
virtual ~TracerBase() {} | ||
|
||
protected: | ||
TracerState state_ = TracerState::UNINITED; | ||
}; | ||
|
||
} // namespace platform | ||
} // namespace paddle |