9ac68ee259
This breaks a bunch of circular dependencies between tools and gm and bench. BUG=skia: Committed: https://skia.googlesource.com/skia/+/4ed75287aed6371c6e4a41ffcc78c8a49c9810ed CQ_EXTRA_TRYBOTS=tryserver.skia:Build-Mac10.7-Clang-Arm7-Debug-iOS-Trybot,Test-Ubuntu12-ShuttleA-GTX660-x86-Debug-Trybot R=tfarina@chromium.org, mtklein@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/344213003
76 lines
2.0 KiB
C++
76 lines
2.0 KiB
C++
/*
|
|
* Copyright 2012 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#ifndef PictureBenchmark_DEFINED
|
|
#define PictureBenchmark_DEFINED
|
|
|
|
#include "PictureRenderer.h"
|
|
#include "PictureResultsWriter.h"
|
|
#include "SkTypes.h"
|
|
#include "TimerData.h"
|
|
|
|
class SkPicture;
|
|
class Timer;
|
|
|
|
namespace sk_tools {
|
|
|
|
class PictureBenchmark {
|
|
public:
|
|
PictureBenchmark();
|
|
|
|
~PictureBenchmark();
|
|
|
|
/**
|
|
* Draw the provided SkPicture fRepeats times while collecting timing data, and log the output
|
|
* via fWriter.
|
|
*/
|
|
void run(SkPicture* pict);
|
|
|
|
void setRepeats(int repeats) {
|
|
fRepeats = repeats;
|
|
}
|
|
|
|
/**
|
|
* If true, tells run to log separate timing data for each individual tile. Each tile will be
|
|
* drawn fRepeats times. Requires the PictureRenderer set by setRenderer to be a
|
|
* TiledPictureRenderer.
|
|
*/
|
|
void setTimeIndividualTiles(bool indiv) { fTimeIndividualTiles = indiv; }
|
|
bool timeIndividualTiles() const { return fTimeIndividualTiles; }
|
|
|
|
void setPurgeDecodedTex(bool purgeDecodedTex) { fPurgeDecodedTex = purgeDecodedTex; }
|
|
bool purgeDecodedText() const { return fPurgeDecodedTex; }
|
|
|
|
void setPreprocess(bool preprocess) { fPreprocess = preprocess; }
|
|
bool preprocess() const { return fPreprocess; }
|
|
|
|
PictureRenderer* setRenderer(PictureRenderer*);
|
|
|
|
void setTimerResultType(TimerData::Result resultType) { fTimerResult = resultType; }
|
|
|
|
void setTimersToShow(bool wall, bool truncatedWall, bool cpu, bool truncatedCpu, bool gpu);
|
|
|
|
void setWriter(PictureResultsWriter* writer) { fWriter = writer; }
|
|
|
|
private:
|
|
int fRepeats;
|
|
PictureRenderer* fRenderer;
|
|
TimerData::Result fTimerResult;
|
|
uint32_t fTimerTypes; // bitfield of TimerData::TimerFlags values
|
|
bool fTimeIndividualTiles;
|
|
bool fPurgeDecodedTex;
|
|
bool fPreprocess;
|
|
|
|
PictureResultsWriter* fWriter;
|
|
|
|
Timer* setupTimer(bool useGLTimer = true);
|
|
};
|
|
|
|
}
|
|
|
|
#endif // PictureBenchmark_DEFINED
|