293a4b367a
Reason for revert: Broke some Windows builds; see http://skbug.com/2609 ('certain Windows Build-* bots failing since r14905'). Before re-landing with a fix, please send to some of the trybots that failed the first time. Original issue's description: > Add JSON logging support to bench_pictures by adding a PictureResultsWriter class (in tools/PictureResultsWriter.h) to process logging information, using a very similar style as bench/ResultsWriter.h > > JSON format described in code, above PictureJSONResultsWriter class > > BUG=skia: > > Committed: http://code.google.com/p/skia/source/detail?r=14906 R=bensong@google.com, jcgregorio@google.com, kelvinly@google.com TBR=bensong@google.com, jcgregorio@google.com, kelvinly@google.com NOTREECHECKS=true NOTRY=true BUG=skia:2609 Author: epoger@google.com Review URL: https://codereview.chromium.org/306483010 git-svn-id: http://skia.googlecode.com/svn/trunk@14910 2bbb7eff-a529-9590-31e7-b0007b416f81
78 lines
2.1 KiB
C++
78 lines
2.1 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 "SkTypes.h"
|
|
#include "PictureRenderer.h"
|
|
#include "TimerData.h"
|
|
|
|
class BenchTimer;
|
|
class SkBenchLogger;
|
|
class SkPicture;
|
|
class SkString;
|
|
|
|
namespace sk_tools {
|
|
|
|
class PictureBenchmark {
|
|
public:
|
|
PictureBenchmark();
|
|
|
|
~PictureBenchmark();
|
|
|
|
/**
|
|
* Draw the provided SkPicture fRepeats times while collecting timing data, and log the output
|
|
* via fLogger.
|
|
*/
|
|
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 setLogger(SkBenchLogger* logger) { fLogger = logger; }
|
|
|
|
private:
|
|
int fRepeats;
|
|
SkBenchLogger* fLogger;
|
|
PictureRenderer* fRenderer;
|
|
TimerData::Result fTimerResult;
|
|
uint32_t fTimerTypes; // bitfield of TimerData::TimerFlags values
|
|
bool fTimeIndividualTiles;
|
|
bool fPurgeDecodedTex;
|
|
bool fPreprocess;
|
|
|
|
void logProgress(const char msg[]);
|
|
|
|
BenchTimer* setupTimer(bool useGLTimer = true);
|
|
};
|
|
|
|
}
|
|
|
|
#endif // PictureBenchmark_DEFINED
|