Make bench_pictures output a meaningful config name.

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

git-svn-id: http://skia.googlecode.com/svn/trunk@6288 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
scroggo@google.com 2012-11-02 22:01:26 +00:00
parent 17fc651dbe
commit 0a049b861e
3 changed files with 80 additions and 3 deletions

View File

@ -95,9 +95,9 @@ void PictureBenchmark::run(SkPicture* pict) {
timerData.appendTimes(timer, fRepeats - 1 == i);
}
const char* configName = usingGpu ? "gpu" : "raster";
SkString configName = fRenderer->getConfigName();
SkString result = timerData.getResult(fLogPerIter, fPrintMin, fRepeats,
configName, fShowWallTime, fShowTruncatedWallTime,
configName.c_str(), fShowWallTime, fShowTruncatedWallTime,
fShowCpuTime, fShowTruncatedCpuTime,
usingGpu && fShowGpuTime);
result.append("\n");

View File

@ -174,6 +174,10 @@ bool RecordPictureRenderer::render(const SkString*) {
return false;
}
SkString RecordPictureRenderer::getConfigNameInternal() {
return SkString("record");
}
///////////////////////////////////////////////////////////////////////////////////////////////
bool PipePictureRenderer::render(const SkString* path) {
@ -195,6 +199,10 @@ bool PipePictureRenderer::render(const SkString* path) {
return true;
}
SkString PipePictureRenderer::getConfigNameInternal() {
return SkString("pipe");
}
///////////////////////////////////////////////////////////////////////////////////////////////
void SimplePictureRenderer::init(SkPicture* picture) {
@ -217,6 +225,10 @@ bool SimplePictureRenderer::render(const SkString* path) {
return true;
}
SkString SimplePictureRenderer::getConfigNameInternal() {
return SkString("simple");
}
///////////////////////////////////////////////////////////////////////////////////////////////
TiledPictureRenderer::TiledPictureRenderer()
@ -361,6 +373,29 @@ SkCanvas* TiledPictureRenderer::setupCanvas(int width, int height) {
canvas->clipRect(clip);
return canvas;
}
SkString TiledPictureRenderer::getConfigNameInternal() {
SkString name;
if (fTileMinPowerOf2Width > 0) {
name.append("pow2tile_");
name.appendf("%i", fTileMinPowerOf2Width);
} else {
name.append("tile_");
if (fTileWidthPercentage > 0) {
name.appendf("%.f%%", fTileWidthPercentage);
} else {
name.appendf("%i", fTileWidth);
}
}
name.append("x");
if (fTileHeightPercentage > 0) {
name.appendf("%.f%%", fTileHeightPercentage);
} else {
name.appendf("%i", fTileHeight);
}
return name;
}
///////////////////////////////////////////////////////////////////////////////////////////////
// Holds all of the information needed to draw a set of tiles.
@ -484,6 +519,12 @@ MultiCorePictureRenderer::~MultiCorePictureRenderer() {
SkDELETE_ARRAY(fPictureClones);
}
SkString MultiCorePictureRenderer::getConfigNameInternal() {
SkString name = this->INHERITED::getConfigNameInternal();
name.appendf("_multi_%i_threads", fNumThreads);
return name;
}
///////////////////////////////////////////////////////////////////////////////////////////////
void PlaybackCreationRenderer::setup() {
@ -499,6 +540,10 @@ bool PlaybackCreationRenderer::render(const SkString*) {
return false;
}
SkString PlaybackCreationRenderer::getConfigNameInternal() {
return SkString("playback_creation");
}
///////////////////////////////////////////////////////////////////////////////////////////////
// SkPicture variants for each BBoxHierarchy type

View File

@ -91,6 +91,22 @@ public:
virtual SkString getNormalTimeFormat() { return SkString("%6.2f"); }
/**
* Reports the configuration of this PictureRenderer.
*/
SkString getConfigName() {
SkString config = this->getConfigNameInternal();
if (kRTree_BBoxHierarchyType == fBBoxHierarchyType) {
config.append("_rtree");
}
#if SK_SUPPORT_GPU
if (this->isUsingGpuDevice()) {
config.append("_gpu");
}
#endif
return config;
}
#if SK_SUPPORT_GPU
bool isUsingGpuDevice() {
return kGPU_DeviceType == fDeviceType;
@ -137,6 +153,8 @@ protected:
#endif
private:
virtual SkString getConfigNameInternal() = 0;
typedef SkRefCnt INHERITED;
};
@ -150,6 +168,9 @@ class RecordPictureRenderer : public PictureRenderer {
virtual SkString getPerIterTimeFormat() SK_OVERRIDE { return SkString("%.4f"); }
virtual SkString getNormalTimeFormat() SK_OVERRIDE { return SkString("%6.4f"); }
private:
virtual SkString getConfigNameInternal() SK_OVERRIDE;
};
class PipePictureRenderer : public PictureRenderer {
@ -157,6 +178,8 @@ public:
virtual bool render(const SkString*) SK_OVERRIDE;
private:
virtual SkString getConfigNameInternal() SK_OVERRIDE;
typedef PictureRenderer INHERITED;
};
@ -167,6 +190,8 @@ public:
virtual bool render(const SkString*) SK_OVERRIDE;
private:
virtual SkString getConfigNameInternal() SK_OVERRIDE;
typedef PictureRenderer INHERITED;
};
@ -231,9 +256,11 @@ public:
}
protected:
virtual SkCanvas* setupCanvas(int width, int height) SK_OVERRIDE;
SkTDArray<SkRect> fTileRects;
virtual SkCanvas* setupCanvas(int width, int height) SK_OVERRIDE;
virtual SkString getConfigNameInternal() SK_OVERRIDE;
private:
int fTileWidth;
int fTileHeight;
@ -265,6 +292,8 @@ public:
virtual void end() SK_OVERRIDE;
private:
virtual SkString getConfigNameInternal() SK_OVERRIDE;
const int fNumThreads;
SkTDArray<SkCanvas*> fCanvasPool;
SkThreadPool fThreadPool;
@ -291,6 +320,9 @@ public:
private:
SkAutoTUnref<SkPicture> fReplayer;
virtual SkString getConfigNameInternal() SK_OVERRIDE;
typedef PictureRenderer INHERITED;
};