skia2/tools/PictureBenchmark.h
scroggo@google.com 5239c32d1e Add -logPerIter, -timers, and -min to bench_pictures.
Additional changes:

Add instance count to bench_pictures.

Remove various PictureBenchmark subclasses which did not do
anything besides have a different PictureRenderer.

BUG=https://code.google.com/p/skia/issues/detail?id=856

Review URL: https://codereview.appspot.com/6496109

git-svn-id: http://skia.googlecode.com/svn/trunk@5496 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-09-11 19:15:32 +00:00

75 lines
1.7 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"
class BenchTimer;
class SkBenchLogger;
class SkPicture;
class SkString;
namespace sk_tools {
class PictureBenchmark {
public:
PictureBenchmark();
~PictureBenchmark();
void run(SkPicture* pict);
void setRepeats(int repeats) {
fRepeats = repeats;
}
PictureRenderer* setRenderer(PictureRenderer*);
void setDeviceType(PictureRenderer::SkDeviceTypes deviceType) {
if (fRenderer != NULL) {
fRenderer->setDeviceType(deviceType);
}
}
void setLogPerIter(bool log) { fLogPerIter = log; }
void setPrintMin(bool min) { fPrintMin = min; }
void setTimersToShow(bool wall, bool truncatedWall, bool cpu, bool truncatedCpu, bool gpu) {
fShowWallTime = wall;
fShowTruncatedWallTime = truncatedWall;
fShowCpuTime = cpu;
fShowTruncatedCpuTime = truncatedCpu;
fShowGpuTime = gpu;
}
void setLogger(SkBenchLogger* logger) { fLogger = logger; }
private:
int fRepeats;
SkBenchLogger* fLogger;
PictureRenderer* fRenderer;
bool fLogPerIter;
bool fPrintMin;
bool fShowWallTime;
bool fShowTruncatedWallTime;
bool fShowCpuTime;
bool fShowTruncatedCpuTime;
bool fShowGpuTime;
void logProgress(const char msg[]);
BenchTimer* setupTimer();
};
}
#endif // PictureBenchmark_DEFINED