Commit e3b65800 authored by Sadrul Chowdhury's avatar Sadrul Chowdhury Committed by Commit Bot

[cc/metrics] Fix trace-event for reporters that don't produce a frame.

If a reporter is replaced by a new reporter, but the frame had not
produced a frame, then use the timestamp of the 'did not produce'
notification as the termination-time to end the trace-event, rather than
the time of the replacement.

BUG=none

Change-Id: I91ad6b9a1b0c31afe5309f89e7f8aaf43121e8eb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2146517
Commit-Queue: Behdad Bakhshinategh <behdadb@chromium.org>
Reviewed-by: default avatarBehdad Bakhshinategh <behdadb@chromium.org>
Auto-Submit: Sadrul Chowdhury <sadrul@chromium.org>
Cr-Commit-Position: refs/heads/master@{#758867}
parent 1acb35c3
...@@ -290,7 +290,7 @@ void CompositorFrameReporter::OnAbortBeginMainFrame(base::TimeTicks timestamp) { ...@@ -290,7 +290,7 @@ void CompositorFrameReporter::OnAbortBeginMainFrame(base::TimeTicks timestamp) {
} }
void CompositorFrameReporter::OnDidNotProduceFrame() { void CompositorFrameReporter::OnDidNotProduceFrame() {
did_not_produce_frame_ = true; did_not_produce_frame_time_ = base::TimeTicks::Now();
} }
void CompositorFrameReporter::SetBlinkBreakdown( void CompositorFrameReporter::SetBlinkBreakdown(
......
...@@ -152,11 +152,17 @@ class CC_EXPORT CompositorFrameReporter { ...@@ -152,11 +152,17 @@ class CC_EXPORT CompositorFrameReporter {
void OnAbortBeginMainFrame(base::TimeTicks timestamp); void OnAbortBeginMainFrame(base::TimeTicks timestamp);
void OnDidNotProduceFrame(); void OnDidNotProduceFrame();
bool did_finish_impl_frame() const { return did_finish_impl_frame_; } bool did_finish_impl_frame() const { return did_finish_impl_frame_; }
bool did_not_produce_frame() const { return did_not_produce_frame_; }
base::TimeTicks impl_frame_finish_time() const { base::TimeTicks impl_frame_finish_time() const {
return impl_frame_finish_time_; return impl_frame_finish_time_;
} }
bool did_not_produce_frame() const {
return did_not_produce_frame_time_.has_value();
}
base::TimeTicks did_not_produce_frame_time() const {
return *did_not_produce_frame_time_;
}
bool did_abort_main_frame() const { bool did_abort_main_frame() const {
return main_frame_abort_time_.has_value(); return main_frame_abort_time_.has_value();
} }
...@@ -236,13 +242,14 @@ class CC_EXPORT CompositorFrameReporter { ...@@ -236,13 +242,14 @@ class CC_EXPORT CompositorFrameReporter {
// Indicates if work on Impl frame is finished. // Indicates if work on Impl frame is finished.
bool did_finish_impl_frame_ = false; bool did_finish_impl_frame_ = false;
// Flag indicating if DidNotProduceFrame is called for this reporter
bool did_not_produce_frame_ = false;
// The time that work on Impl frame is finished. It's only valid if the // The time that work on Impl frame is finished. It's only valid if the
// reporter is in a stage other than begin impl frame. // reporter is in a stage other than begin impl frame.
base::TimeTicks impl_frame_finish_time_; base::TimeTicks impl_frame_finish_time_;
base::TimeTicks frame_deadline_; base::TimeTicks frame_deadline_;
// The timestamp of when the frame was marked as not having produced a frame
// (through a call to DidNotProduceFrame()).
base::Optional<base::TimeTicks> did_not_produce_frame_time_;
base::Optional<base::TimeTicks> main_frame_abort_time_; base::Optional<base::TimeTicks> main_frame_abort_time_;
}; };
} // namespace cc } // namespace cc
......
...@@ -319,16 +319,18 @@ void CompositorFrameReportingController::AdvanceReporterStage( ...@@ -319,16 +319,18 @@ void CompositorFrameReportingController::AdvanceReporterStage(
PipelineStage target) { PipelineStage target) {
auto& reporter = reporters_[target]; auto& reporter = reporters_[target];
if (reporter) { if (reporter) {
auto termination_time = (target == PipelineStage::kBeginMainFrame && auto termination_status = FrameTerminationStatus::kReplacedByNewReporter;
reporter->did_abort_main_frame()) base::TimeTicks termination_time;
? reporter->main_frame_abort_time() if (reporter->did_not_produce_frame()) {
: Now(); termination_time = reporter->did_not_produce_frame_time();
if (reporters_[target]->did_not_produce_frame()) termination_status = FrameTerminationStatus::kDidNotProduceFrame;
reporters_[target]->TerminateFrame( } else if (target == PipelineStage::kBeginMainFrame &&
FrameTerminationStatus::kDidNotProduceFrame, termination_time); reporter->did_abort_main_frame()) {
else termination_time = reporter->main_frame_abort_time();
reporters_[target]->TerminateFrame( } else {
FrameTerminationStatus::kReplacedByNewReporter, termination_time); termination_time = Now();
}
reporter->TerminateFrame(termination_status, termination_time);
} }
reporters_[target] = std::move(reporters_[start]); reporters_[target] = std::move(reporters_[start]);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment