Commit ac85f75d authored by kjd564's avatar kjd564 Committed by Commit Bot

RasterizeAndRecord microbenchmark fix.

Recent changes to the scheduler have revealed a race condition with this
benchmark. This benchmark is triggered when we do a frame and
DidUpdateLayers is called. After the benchmark completes, the impl will
schedule a NotifyDone task on the main thread and the results will be recorded
when that task is run.

The change made in the scheduler will prioritize BeginMainFrame at set intervals.
What was happening in the regression was a race condition between NotifyDone and the
next frame. If a frame was run before NotifyDone, it would trigger DidUpdateLayers
and the benchmark would run a second time, adding its results to the previous runs
results, effectively doubling them and causing the benchmark results to oscillate between
two ranges of timing. This change fixes this by checking a boolean that
tells us whether the benchmark has already been run before running it.

Bug: 1030954
Change-Id: Iade1bc20c0cc43e643293f23a631c11c3ff9653e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1986970Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Commit-Queue: Katie Dillon <kdillon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#728695}
parent ba38c72a
......@@ -84,6 +84,12 @@ RasterizeAndRecordBenchmark::~RasterizeAndRecordBenchmark() {
void RasterizeAndRecordBenchmark::DidUpdateLayers(
LayerTreeHost* layer_tree_host) {
// It is possible that this will be called before NotifyDone is called, in the
// event that a BeginMainFrame was scheduled before NotifyDone for example.
// This check prevents the benchmark from being run a second time redundantly.
if (main_thread_benchmark_done_)
return;
layer_tree_host_ = layer_tree_host;
for (auto* layer : *layer_tree_host)
layer->RunMicroBenchmark(this);
......
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