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

Unified Diff: tools/VisualBench/VisualInteractiveModule.h

Issue 1336043003: Add viewer mode to VisualBench. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix init order Created 5 years, 3 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/VisualBench.cpp ('k') | tools/VisualBench/VisualInteractiveModule.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/VisualBench/VisualInteractiveModule.h
diff --git a/tools/VisualBench/VisualLightweightBenchModule.h b/tools/VisualBench/VisualInteractiveModule.h
old mode 100644
new mode 100755
similarity index 62%
copy from tools/VisualBench/VisualLightweightBenchModule.h
copy to tools/VisualBench/VisualInteractiveModule.h
index 64b4a11c0e0c1f5fa0b944940f60d1246b21d750..4ff6a36ef905dd7494c50f56c8f719e7c44de2e6
--- a/tools/VisualBench/VisualLightweightBenchModule.h
+++ b/tools/VisualBench/VisualInteractiveModule.h
@@ -6,8 +6,8 @@
*
*/
-#ifndef VisualLightweightBenchModule_DEFINED
-#define VisualLightweightBenchModule_DEFINED
+#ifndef VisualInteractiveModule_DEFINED
+#define VisualInteractiveModule_DEFINED
#include "VisualModule.h"
@@ -20,14 +20,15 @@
class SkCanvas;
/*
- * This module is designed to be a minimal overhead timing module for VisualBench
+ * This module for VisualBench is designed to display stats data dynamically
*/
-class VisualLightweightBenchModule : public VisualModule {
+class VisualInteractiveModule : public VisualModule {
public:
// TODO get rid of backpointer
- VisualLightweightBenchModule(VisualBench* owner);
+ VisualInteractiveModule(VisualBench* owner);
void draw(SkCanvas* canvas) override;
+ bool onHandleChar(SkUnichar unichar) override;
private:
/*
@@ -39,50 +40,44 @@ private:
* work state
* kTuneLoops_State: Then we tune the loops of the benchmark to ensure we
* are doing a measurable amount of work
- * kPreWarmTimingPerCanvasPreDraw_State: Because reset the context after tuning loops to ensure
- * coherent state, we need to give the benchmark
- * another hook
- * kPreWarmTiming_State: We prewarm the gpu again to enter a steady state
- * kTiming_State: Finally we time the benchmark. When finished timing
- * if we have enough samples then we'll start the next
- * benchmark in the kPreWarmLoopsPerCanvasPreDraw_State.
- * otherwise, we enter the
- * kPreWarmTimingPerCanvasPreDraw_State for another sample
- * In either case we reset the context.
+ * kPreTiming_State: Because reset the context after tuning loops to ensure
+ * coherent state, we need to restart before timing
+ * kTiming_State: Finally we time the benchmark. In this case we
+ * continue running and displaying benchmark data
+ * until we quit or switch to another benchmark
+ * kAdvance_State: Advance to the next benchmark in the stream
*/
enum State {
kPreWarmLoopsPerCanvasPreDraw_State,
kPreWarmLoops_State,
kTuneLoops_State,
- kPreWarmTimingPerCanvasPreDraw_State,
- kPreWarmTiming_State,
+ kPreTiming_State,
kTiming_State,
+ kAdvance_State,
};
void setTitle();
bool setupBackend();
void setupRenderTarget();
- void printStats();
+ void drawStats(SkCanvas*);
bool advanceRecordIfNecessary(SkCanvas*);
inline void renderFrame(SkCanvas*);
inline void nextState(State);
void perCanvasPreDraw(SkCanvas*, State);
void preWarm(State nextState);
void scaleLoops(double elapsedMs);
- inline void tuneLoops();
+ inline void tuneLoops(SkCanvas*);
inline void timing(SkCanvas*);
inline double elapsed();
void resetTimingState();
void postDraw(SkCanvas*);
void recordMeasurement();
- struct Record {
- SkTArray<double> fMeasurements;
- };
+ static const int kMeasurementCount = 64; // should be power of 2 for fast mod
+ double fMeasurements[kMeasurementCount];
+ int fCurrentMeasurement;
- int fCurrentSample;
int fCurrentFrame;
int fLoops;
- SkTArray<Record> fRecords;
WallTimer fTimer;
State fState;
SkAutoTDelete<VisualBenchmarkStream> fBenchmarkStream;
@@ -90,7 +85,6 @@ private:
// support framework
SkAutoTUnref<VisualBench> fOwner;
- SkAutoTDelete<ResultsWriter> fResults;
typedef VisualModule INHERITED;
};
« no previous file with comments | « tools/VisualBench/VisualBench.cpp ('k') | tools/VisualBench/VisualInteractiveModule.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698