RepeatingTask: equip with DTrace probes.
This change permits dtrace wakeup profiling of Chromium production builds. Bug: webrtc:13013 Change-Id: Iff936f7ff03ba7ef349f2bc7d3826a7c8b1bb1b8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/226461 Commit-Queue: Markus Handell <handellm@webrtc.org> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34541}
This commit is contained in:
parent
0d6d9488ae
commit
c1c6bef99a
@ -70,4 +70,11 @@ bool RepeatingTaskHandle::Running() const {
|
||||
return repeating_task_ != nullptr;
|
||||
}
|
||||
|
||||
namespace webrtc_repeating_task_impl {
|
||||
// These methods are empty, but can be externally equipped with actions using
|
||||
// dtrace.
|
||||
void RepeatingTaskHandleDTraceProbeStart() {}
|
||||
void RepeatingTaskHandleDTraceProbeDelayedStart() {}
|
||||
void RepeatingTaskImplDTraceProbeRun() {}
|
||||
} // namespace webrtc_repeating_task_impl
|
||||
} // namespace webrtc
|
||||
|
||||
@ -23,7 +23,14 @@
|
||||
#include "system_wrappers/include/clock.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
namespace webrtc_repeating_task_impl {
|
||||
|
||||
// Methods simplifying external tracing of RepeatingTaskHandle operations.
|
||||
void RepeatingTaskHandleDTraceProbeStart();
|
||||
void RepeatingTaskHandleDTraceProbeDelayedStart();
|
||||
void RepeatingTaskImplDTraceProbeRun();
|
||||
|
||||
class RepeatingTaskBase : public QueuedTask {
|
||||
public:
|
||||
RepeatingTaskBase(TaskQueueBase* task_queue,
|
||||
@ -67,7 +74,10 @@ class RepeatingTaskImpl final : public RepeatingTaskBase {
|
||||
}
|
||||
|
||||
private:
|
||||
TimeDelta RunClosure() override { return closure_(); }
|
||||
TimeDelta RunClosure() override {
|
||||
RepeatingTaskImplDTraceProbeRun();
|
||||
return closure_();
|
||||
}
|
||||
|
||||
typename std::remove_const<
|
||||
typename std::remove_reference<Closure>::type>::type closure_;
|
||||
@ -98,6 +108,7 @@ class RepeatingTaskHandle {
|
||||
Closure&& closure,
|
||||
Clock* clock = Clock::GetRealTimeClock()) {
|
||||
auto alive_flag = PendingTaskSafetyFlag::CreateDetached();
|
||||
webrtc_repeating_task_impl::RepeatingTaskHandleDTraceProbeStart();
|
||||
task_queue->PostTask(
|
||||
std::make_unique<
|
||||
webrtc_repeating_task_impl::RepeatingTaskImpl<Closure>>(
|
||||
@ -115,6 +126,7 @@ class RepeatingTaskHandle {
|
||||
Closure&& closure,
|
||||
Clock* clock = Clock::GetRealTimeClock()) {
|
||||
auto alive_flag = PendingTaskSafetyFlag::CreateDetached();
|
||||
webrtc_repeating_task_impl::RepeatingTaskHandleDTraceProbeDelayedStart();
|
||||
task_queue->PostDelayedTask(
|
||||
std::make_unique<
|
||||
webrtc_repeating_task_impl::RepeatingTaskImpl<Closure>>(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user