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

Unified Diff: tools/VisualBench/VisualStreamTimingModule.cpp

Issue 1442643007: Add visualbench option to not reset between samples (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month 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
Index: tools/VisualBench/VisualStreamTimingModule.cpp
diff --git a/tools/VisualBench/VisualStreamTimingModule.cpp b/tools/VisualBench/VisualStreamTimingModule.cpp
index ad7c1d0e80c00204835d4f587517a08ec618a185..cb748ca5d825619d18119b377668e0d6a3d3a132 100644
--- a/tools/VisualBench/VisualStreamTimingModule.cpp
+++ b/tools/VisualBench/VisualStreamTimingModule.cpp
@@ -9,9 +9,10 @@
#include "SkCanvas.h"
-VisualStreamTimingModule::VisualStreamTimingModule(VisualBench* owner, bool preWarmBeforeSample)
+DEFINE_bool(reset, true, "Reset the GL context between samples.");
+
+VisualStreamTimingModule::VisualStreamTimingModule(VisualBench* owner)
: fInitState(kReset_InitState)
- , fPreWarmBeforeSample(preWarmBeforeSample)
, fOwner(owner) {
fBenchmarkStream.reset(new VisualBenchmarkStream(owner->getSurfaceProps()));
}
@@ -36,18 +37,13 @@ inline void VisualStreamTimingModule::handleInitState(SkCanvas* canvas) {
inline void VisualStreamTimingModule::handleTimingEvent(SkCanvas* canvas,
TimingStateMachine::ParentEvents event) {
switch (event) {
- case TimingStateMachine::kReset_ParentEvents:
- fBenchmarkStream->current()->postTimingHooks(canvas);
- fOwner->reset();
- fInitState = kReset_InitState;
- break;
case TimingStateMachine::kTiming_ParentEvents:
break;
case TimingStateMachine::kTimingFinished_ParentEvents:
- fBenchmarkStream->current()->postTimingHooks(canvas);
- fOwner->reset();
if (this->timingFinished(fBenchmarkStream->current(), fTSM.loops(),
fTSM.lastMeasurement())) {
+ fBenchmarkStream->current()->postTimingHooks(canvas);
+ fOwner->reset();
fTSM.nextBenchmark();
if (!fBenchmarkStream->next()) {
SkDebugf("Exiting VisualBench successfully\n");
@@ -55,7 +51,13 @@ inline void VisualStreamTimingModule::handleTimingEvent(SkCanvas* canvas,
} else {
fInitState = kNewBenchmark_InitState;
}
- } else {
+ break;
+ }
+ // fallthrough
+ case TimingStateMachine::kReset_ParentEvents:
+ if (FLAGS_reset) {
+ fBenchmarkStream->current()->postTimingHooks(canvas);
+ fOwner->reset();
fInitState = kReset_InitState;
}
break;
@@ -72,6 +74,6 @@ void VisualStreamTimingModule::draw(SkCanvas* canvas) {
this->handleInitState(canvas);
this->renderFrame(canvas, fBenchmarkStream->current(), fTSM.loops());
fOwner->present();
- TimingStateMachine::ParentEvents event = fTSM.nextFrame(fPreWarmBeforeSample);
+ TimingStateMachine::ParentEvents event = fTSM.nextFrame(FLAGS_reset);
this->handleTimingEvent(canvas, event);
}
« tools/VisualBench/VisualInteractiveModule.cpp ('K') | « tools/VisualBench/VisualStreamTimingModule.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698