2012-08-01 17:53:29 +00:00
|
|
|
/*
|
|
|
|
* 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
|
2012-09-11 19:15:32 +00:00
|
|
|
|
2012-08-01 17:53:29 +00:00
|
|
|
#include "SkTypes.h"
|
|
|
|
#include "PictureRenderer.h"
|
|
|
|
|
2012-08-20 15:03:47 +00:00
|
|
|
class BenchTimer;
|
2012-09-07 15:21:18 +00:00
|
|
|
class SkBenchLogger;
|
2012-08-01 17:53:29 +00:00
|
|
|
class SkPicture;
|
|
|
|
class SkString;
|
|
|
|
|
|
|
|
namespace sk_tools {
|
|
|
|
|
2012-09-11 19:15:32 +00:00
|
|
|
class PictureBenchmark {
|
2012-08-01 17:53:29 +00:00
|
|
|
public:
|
2012-09-11 19:15:32 +00:00
|
|
|
PictureBenchmark();
|
|
|
|
|
|
|
|
~PictureBenchmark();
|
2012-09-07 15:21:18 +00:00
|
|
|
|
|
|
|
void run(SkPicture* pict);
|
2012-08-01 17:53:29 +00:00
|
|
|
|
|
|
|
void setRepeats(int repeats) {
|
|
|
|
fRepeats = repeats;
|
|
|
|
}
|
|
|
|
|
2012-09-11 19:15:32 +00:00
|
|
|
PictureRenderer* setRenderer(PictureRenderer*);
|
2012-08-20 15:03:41 +00:00
|
|
|
|
2012-09-11 19:15:32 +00:00
|
|
|
void setDeviceType(PictureRenderer::SkDeviceTypes deviceType) {
|
|
|
|
if (fRenderer != NULL) {
|
|
|
|
fRenderer->setDeviceType(deviceType);
|
2012-08-20 15:03:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-11 19:15:32 +00:00
|
|
|
void setLogPerIter(bool log) { fLogPerIter = log; }
|
2012-08-01 17:53:29 +00:00
|
|
|
|
2012-09-11 19:15:32 +00:00
|
|
|
void setPrintMin(bool min) { fPrintMin = min; }
|
2012-08-20 15:03:41 +00:00
|
|
|
|
2012-09-11 19:15:32 +00:00
|
|
|
void setTimersToShow(bool wall, bool truncatedWall, bool cpu, bool truncatedCpu, bool gpu) {
|
|
|
|
fShowWallTime = wall;
|
|
|
|
fShowTruncatedWallTime = truncatedWall;
|
|
|
|
fShowCpuTime = cpu;
|
|
|
|
fShowTruncatedCpuTime = truncatedCpu;
|
|
|
|
fShowGpuTime = gpu;
|
2012-08-20 15:03:41 +00:00
|
|
|
}
|
2012-09-07 15:21:18 +00:00
|
|
|
|
2012-09-11 19:15:32 +00:00
|
|
|
void setLogger(SkBenchLogger* logger) { fLogger = logger; }
|
2012-08-01 17:53:29 +00:00
|
|
|
|
2012-08-07 17:11:33 +00:00
|
|
|
private:
|
2012-09-11 19:15:32 +00:00
|
|
|
int fRepeats;
|
|
|
|
SkBenchLogger* fLogger;
|
|
|
|
PictureRenderer* fRenderer;
|
|
|
|
bool fLogPerIter;
|
|
|
|
bool fPrintMin;
|
|
|
|
bool fShowWallTime;
|
|
|
|
bool fShowTruncatedWallTime;
|
|
|
|
bool fShowCpuTime;
|
|
|
|
bool fShowTruncatedCpuTime;
|
|
|
|
bool fShowGpuTime;
|
2012-09-07 15:21:18 +00:00
|
|
|
|
2012-09-11 19:15:32 +00:00
|
|
|
void logProgress(const char msg[]);
|
2012-09-07 15:21:18 +00:00
|
|
|
|
2012-09-11 19:15:32 +00:00
|
|
|
BenchTimer* setupTimer();
|
2012-08-01 17:53:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // PictureBenchmark_DEFINED
|