Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1143)

Unified Diff: tools/VisualBench/VisualLightweightBenchModule.cpp

Issue 1386933002: Cleanup timing state machine (Closed) Base URL: https://skia.googlesource.com/skia.git@vb2
Patch Set: rebase Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/VisualBench/VisualLightweightBenchModule.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/VisualBench/VisualLightweightBenchModule.cpp
diff --git a/tools/VisualBench/VisualLightweightBenchModule.cpp b/tools/VisualBench/VisualLightweightBenchModule.cpp
index d964ae3e58d082a22c07813dd4fd7d91ff831792..e2942d18bdc36f2647b899b1042f33a4d4ef37cd 100644
--- a/tools/VisualBench/VisualLightweightBenchModule.cpp
+++ b/tools/VisualBench/VisualLightweightBenchModule.cpp
@@ -44,6 +44,7 @@ static SkString humanize(double ms) {
VisualLightweightBenchModule::VisualLightweightBenchModule(VisualBench* owner)
: fCurrentSample(0)
+ , fHasBeenReset(false)
, fOwner(SkRef(owner))
, fResults(new ResultsWriter) {
fBenchmarkStream.reset(new VisualBenchmarkStream);
@@ -132,12 +133,14 @@ bool VisualLightweightBenchModule::advanceRecordIfNecessary(SkCanvas* canvas) {
fOwner->clear(canvas, SK_ColorWHITE, 2);
- fBenchmark->delayedSetup();
fRecords.push_back();
// Log bench name
fResults->bench(fBenchmark->getUniqueName(), fBenchmark->getSize().fX,
fBenchmark->getSize().fY);
+
+ fBenchmark->delayedSetup();
+ fBenchmark->preTimingHooks(canvas);
return true;
}
@@ -147,15 +150,24 @@ void VisualLightweightBenchModule::draw(SkCanvas* canvas) {
fOwner->closeWindow();
return;
}
+
+ if (fHasBeenReset) {
+ fHasBeenReset = false;
+ fBenchmark->preTimingHooks(canvas);
+ }
+
this->renderFrame(canvas);
- TimingStateMachine::ParentEvents event = fTSM.nextFrame(canvas, fBenchmark);
+ TimingStateMachine::ParentEvents event = fTSM.nextFrame(true);
switch (event) {
case TimingStateMachine::kReset_ParentEvents:
+ fBenchmark->postTimingHooks(canvas);
fOwner->reset();
+ fHasBeenReset = true;
break;
case TimingStateMachine::kTiming_ParentEvents:
break;
case TimingStateMachine::kTimingFinished_ParentEvents:
+ fBenchmark->postTimingHooks(canvas);
fOwner->reset();
fRecords.back().fMeasurements.push_back(fTSM.lastMeasurement());
if (++fCurrentSample > FLAGS_samples) {
@@ -164,7 +176,7 @@ void VisualLightweightBenchModule::draw(SkCanvas* canvas) {
fCurrentSample = 0;
fBenchmark.reset(nullptr);
} else {
- fTSM.nextSampleWithPrewarm();
+ fHasBeenReset = true;
}
break;
}
« no previous file with comments | « tools/VisualBench/VisualLightweightBenchModule.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698