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.
|
|
|
|
*/
|
|
|
|
|
2012-09-07 15:21:18 +00:00
|
|
|
#include "SkBenchLogger.h"
|
2012-08-01 17:53:29 +00:00
|
|
|
#include "BenchTimer.h"
|
|
|
|
#include "PictureBenchmark.h"
|
|
|
|
#include "SkCanvas.h"
|
|
|
|
#include "SkPicture.h"
|
|
|
|
#include "SkString.h"
|
|
|
|
#include "picture_utils.h"
|
|
|
|
|
|
|
|
namespace sk_tools {
|
|
|
|
|
2012-09-11 19:15:32 +00:00
|
|
|
PictureBenchmark::PictureBenchmark()
|
|
|
|
: fRepeats(1)
|
|
|
|
, fLogger(NULL)
|
|
|
|
, fRenderer(NULL)
|
2013-07-31 20:00:56 +00:00
|
|
|
, fTimerResult(TimerData::kAvg_Result)
|
|
|
|
, fTimerTypes(0)
|
Provide an option to bench drawing individual tiles in bench_pictures.
Provides output like the following:
running bench [1236 12045] androidpolice.skp
tile_256x256: tile [0,0] out of [5,48]: msecs = 1.00
tile_256x256: tile [1,0] out of [5,48]: msecs = 1.50
tile_256x256: tile [2,0] out of [5,48]: msecs = 1.00
tile_256x256: tile [3,0] out of [5,48]: msecs = 1.50
tile_256x256: tile [4,0] out of [5,48]: msecs = 2.50
tile_256x256: tile [0,1] out of [5,48]: msecs = 2.00
tile_256x256: tile [1,1] out of [5,48]: msecs = 3.50
tile_256x256: tile [2,1] out of [5,48]: msecs = 3.50
tile_256x256: tile [3,1] out of [5,48]: msecs = 6.00
tile_256x256: tile [4,1] out of [5,48]: msecs = 2.50
tile_256x256: tile [0,2] out of [5,48]: msecs = 2.00
BUG=https://code.google.com/p/skia/issues/detail?id=1016
Review URL: https://codereview.appspot.com/6937047
git-svn-id: http://skia.googlecode.com/svn/trunk@6805 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-12-13 22:09:28 +00:00
|
|
|
, fTimeIndividualTiles(false)
|
2013-12-18 17:25:33 +00:00
|
|
|
, fPurgeDecodedTex(false)
|
2012-09-11 19:15:32 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
PictureBenchmark::~PictureBenchmark() {
|
|
|
|
SkSafeUnref(fRenderer);
|
|
|
|
}
|
|
|
|
|
2013-07-31 20:00:56 +00:00
|
|
|
void PictureBenchmark::setTimersToShow(bool wall,
|
|
|
|
bool truncatedWall,
|
|
|
|
bool cpu,
|
|
|
|
bool truncatedCpu,
|
|
|
|
bool gpu) {
|
|
|
|
fTimerTypes = 0;
|
|
|
|
fTimerTypes |= wall ? TimerData::kWall_Flag : 0;
|
|
|
|
fTimerTypes |= truncatedWall ? TimerData::kTruncatedWall_Flag : 0;
|
|
|
|
fTimerTypes |= cpu ? TimerData::kCpu_Flag : 0;
|
|
|
|
fTimerTypes |= truncatedCpu ? TimerData::kTruncatedCpu_Flag : 0;
|
|
|
|
fTimerTypes |= gpu ? TimerData::kGpu_Flag : 0;
|
|
|
|
}
|
|
|
|
|
2013-02-07 16:21:22 +00:00
|
|
|
BenchTimer* PictureBenchmark::setupTimer(bool useGLTimer) {
|
2012-08-20 15:03:47 +00:00
|
|
|
#if SK_SUPPORT_GPU
|
2013-02-07 16:21:22 +00:00
|
|
|
if (useGLTimer && fRenderer != NULL && fRenderer->isUsingGpuDevice()) {
|
2012-09-11 19:15:32 +00:00
|
|
|
return SkNEW_ARGS(BenchTimer, (fRenderer->getGLContext()));
|
2012-08-20 15:03:47 +00:00
|
|
|
}
|
|
|
|
#endif
|
Provide an option to bench drawing individual tiles in bench_pictures.
Provides output like the following:
running bench [1236 12045] androidpolice.skp
tile_256x256: tile [0,0] out of [5,48]: msecs = 1.00
tile_256x256: tile [1,0] out of [5,48]: msecs = 1.50
tile_256x256: tile [2,0] out of [5,48]: msecs = 1.00
tile_256x256: tile [3,0] out of [5,48]: msecs = 1.50
tile_256x256: tile [4,0] out of [5,48]: msecs = 2.50
tile_256x256: tile [0,1] out of [5,48]: msecs = 2.00
tile_256x256: tile [1,1] out of [5,48]: msecs = 3.50
tile_256x256: tile [2,1] out of [5,48]: msecs = 3.50
tile_256x256: tile [3,1] out of [5,48]: msecs = 6.00
tile_256x256: tile [4,1] out of [5,48]: msecs = 2.50
tile_256x256: tile [0,2] out of [5,48]: msecs = 2.00
BUG=https://code.google.com/p/skia/issues/detail?id=1016
Review URL: https://codereview.appspot.com/6937047
git-svn-id: http://skia.googlecode.com/svn/trunk@6805 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-12-13 22:09:28 +00:00
|
|
|
return SkNEW_ARGS(BenchTimer, (NULL));
|
2012-08-20 15:03:47 +00:00
|
|
|
}
|
|
|
|
|
2012-09-07 15:21:18 +00:00
|
|
|
void PictureBenchmark::logProgress(const char msg[]) {
|
|
|
|
if (fLogger != NULL) {
|
|
|
|
fLogger->logProgress(msg);
|
2012-08-07 17:11:33 +00:00
|
|
|
}
|
2012-08-01 17:53:29 +00:00
|
|
|
}
|
|
|
|
|
2012-09-11 19:15:32 +00:00
|
|
|
PictureRenderer* PictureBenchmark::setRenderer(sk_tools::PictureRenderer* renderer) {
|
|
|
|
SkRefCnt_SafeAssign(fRenderer, renderer);
|
|
|
|
return renderer;
|
|
|
|
}
|
|
|
|
|
2012-09-07 15:21:18 +00:00
|
|
|
void PictureBenchmark::run(SkPicture* pict) {
|
2012-08-07 17:11:33 +00:00
|
|
|
SkASSERT(pict);
|
2012-08-20 15:03:44 +00:00
|
|
|
if (NULL == pict) {
|
2012-08-07 17:11:33 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-09-11 19:15:32 +00:00
|
|
|
SkASSERT(fRenderer != NULL);
|
|
|
|
if (NULL == fRenderer) {
|
2012-08-07 17:11:33 +00:00
|
|
|
return;
|
|
|
|
}
|
2012-08-01 17:53:29 +00:00
|
|
|
|
2012-09-11 19:15:32 +00:00
|
|
|
fRenderer->init(pict);
|
|
|
|
|
|
|
|
// We throw this away to remove first time effects (such as paging in this program)
|
|
|
|
fRenderer->setup();
|
2012-09-20 14:54:21 +00:00
|
|
|
fRenderer->render(NULL);
|
2014-03-11 22:58:00 +00:00
|
|
|
fRenderer->resetState(true); // flush, swapBuffers and Finish
|
2012-08-01 17:53:29 +00:00
|
|
|
|
2013-12-18 17:25:33 +00:00
|
|
|
if (fPurgeDecodedTex) {
|
|
|
|
fRenderer->purgeTextures();
|
|
|
|
}
|
|
|
|
|
2012-09-07 15:21:18 +00:00
|
|
|
bool usingGpu = false;
|
2012-08-20 15:03:52 +00:00
|
|
|
#if SK_SUPPORT_GPU
|
2012-09-11 19:15:32 +00:00
|
|
|
usingGpu = fRenderer->isUsingGpuDevice();
|
2012-08-20 15:03:52 +00:00
|
|
|
#endif
|
2012-08-20 15:03:47 +00:00
|
|
|
|
2013-07-31 20:00:56 +00:00
|
|
|
uint32_t timerTypes = fTimerTypes;
|
|
|
|
if (!usingGpu) {
|
|
|
|
timerTypes &= ~TimerData::kGpu_Flag;
|
|
|
|
}
|
|
|
|
|
|
|
|
SkString timeFormat;
|
|
|
|
if (TimerData::kPerIter_Result == fTimerResult) {
|
|
|
|
timeFormat = fRenderer->getPerIterTimeFormat();
|
|
|
|
} else {
|
|
|
|
timeFormat = fRenderer->getNormalTimeFormat();
|
|
|
|
}
|
|
|
|
|
2014-03-11 22:58:00 +00:00
|
|
|
static const int kNumInnerLoops = 5;
|
|
|
|
int numOuterLoops = 1;
|
|
|
|
int numInnerLoops = fRepeats;
|
|
|
|
|
|
|
|
if (TimerData::kPerIter_Result == fTimerResult && fRepeats > 1) {
|
|
|
|
// interpret this flag combination to mean: generate 'fRepeats'
|
|
|
|
// numbers by averaging each rendering 'kNumInnerLoops' times
|
|
|
|
numOuterLoops = fRepeats;
|
|
|
|
numInnerLoops = kNumInnerLoops;
|
|
|
|
}
|
|
|
|
|
Provide an option to bench drawing individual tiles in bench_pictures.
Provides output like the following:
running bench [1236 12045] androidpolice.skp
tile_256x256: tile [0,0] out of [5,48]: msecs = 1.00
tile_256x256: tile [1,0] out of [5,48]: msecs = 1.50
tile_256x256: tile [2,0] out of [5,48]: msecs = 1.00
tile_256x256: tile [3,0] out of [5,48]: msecs = 1.50
tile_256x256: tile [4,0] out of [5,48]: msecs = 2.50
tile_256x256: tile [0,1] out of [5,48]: msecs = 2.00
tile_256x256: tile [1,1] out of [5,48]: msecs = 3.50
tile_256x256: tile [2,1] out of [5,48]: msecs = 3.50
tile_256x256: tile [3,1] out of [5,48]: msecs = 6.00
tile_256x256: tile [4,1] out of [5,48]: msecs = 2.50
tile_256x256: tile [0,2] out of [5,48]: msecs = 2.00
BUG=https://code.google.com/p/skia/issues/detail?id=1016
Review URL: https://codereview.appspot.com/6937047
git-svn-id: http://skia.googlecode.com/svn/trunk@6805 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-12-13 22:09:28 +00:00
|
|
|
if (fTimeIndividualTiles) {
|
|
|
|
TiledPictureRenderer* tiledRenderer = fRenderer->getTiledRenderer();
|
2013-03-04 16:41:06 +00:00
|
|
|
SkASSERT(tiledRenderer && tiledRenderer->supportsTimingIndividualTiles());
|
|
|
|
if (NULL == tiledRenderer || !tiledRenderer->supportsTimingIndividualTiles()) {
|
Provide an option to bench drawing individual tiles in bench_pictures.
Provides output like the following:
running bench [1236 12045] androidpolice.skp
tile_256x256: tile [0,0] out of [5,48]: msecs = 1.00
tile_256x256: tile [1,0] out of [5,48]: msecs = 1.50
tile_256x256: tile [2,0] out of [5,48]: msecs = 1.00
tile_256x256: tile [3,0] out of [5,48]: msecs = 1.50
tile_256x256: tile [4,0] out of [5,48]: msecs = 2.50
tile_256x256: tile [0,1] out of [5,48]: msecs = 2.00
tile_256x256: tile [1,1] out of [5,48]: msecs = 3.50
tile_256x256: tile [2,1] out of [5,48]: msecs = 3.50
tile_256x256: tile [3,1] out of [5,48]: msecs = 6.00
tile_256x256: tile [4,1] out of [5,48]: msecs = 2.50
tile_256x256: tile [0,2] out of [5,48]: msecs = 2.00
BUG=https://code.google.com/p/skia/issues/detail?id=1016
Review URL: https://codereview.appspot.com/6937047
git-svn-id: http://skia.googlecode.com/svn/trunk@6805 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-12-13 22:09:28 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
int xTiles, yTiles;
|
|
|
|
if (!tiledRenderer->tileDimensions(xTiles, yTiles)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Insert a newline so that each tile is reported on its own line (separate from the line
|
|
|
|
// that describes the skp being run).
|
|
|
|
this->logProgress("\n");
|
|
|
|
|
|
|
|
int x, y;
|
|
|
|
while (tiledRenderer->nextTile(x, y)) {
|
Change the method for timing individual tiles in bench_pictures.
When timing individual tiles in bench_pictures, keep a timer running
across all repeats, and then take the average. The former method of
timing each iteration separately runs into precision errors on some
platforms.
Running on my Mac Pro with OSX 10.8, the cmsecs for the new method
and the old method are roughly the same when checking the CPU time.
When checking the wall time, the old method often gives me 0ms,
while the new method gives me a larger value. I don't think this
can be entirely attributed to rounding though, since on occasion I
see the old method showing a short time period (.05 - .15ms) while
the new method shows .15ms higher (which is in range for the
difference I'm seeing for other tiles where the old method reports
0ms).
Some other changes:
PictureRenderer::resetState now takes a boolean parameter. If called
with false, it will only do a flush, while if called with true, it
will also call finish.
resetState is now called with true everywhere except in between
iterations of drawing the same tile (when timing individual tiles).
render_pictures_main no longer calls resetState directly, since it
already calls end, which calls resetState.
BUG=http://code.google.com/p/skia/issues/detail?id=1066
Review URL: https://codereview.appspot.com/7101060
git-svn-id: http://skia.googlecode.com/svn/trunk@7424 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-01-28 20:40:24 +00:00
|
|
|
// There are two timers, which will behave slightly differently:
|
|
|
|
// 1) longRunningTimer, along with perTileTimerData, will time how long it takes to draw
|
2014-03-11 22:58:00 +00:00
|
|
|
// one tile fRepeats times, and take the average. As such, it will not respect the
|
Change the method for timing individual tiles in bench_pictures.
When timing individual tiles in bench_pictures, keep a timer running
across all repeats, and then take the average. The former method of
timing each iteration separately runs into precision errors on some
platforms.
Running on my Mac Pro with OSX 10.8, the cmsecs for the new method
and the old method are roughly the same when checking the CPU time.
When checking the wall time, the old method often gives me 0ms,
while the new method gives me a larger value. I don't think this
can be entirely attributed to rounding though, since on occasion I
see the old method showing a short time period (.05 - .15ms) while
the new method shows .15ms higher (which is in range for the
difference I'm seeing for other tiles where the old method reports
0ms).
Some other changes:
PictureRenderer::resetState now takes a boolean parameter. If called
with false, it will only do a flush, while if called with true, it
will also call finish.
resetState is now called with true everywhere except in between
iterations of drawing the same tile (when timing individual tiles).
render_pictures_main no longer calls resetState directly, since it
already calls end, which calls resetState.
BUG=http://code.google.com/p/skia/issues/detail?id=1066
Review URL: https://codereview.appspot.com/7101060
git-svn-id: http://skia.googlecode.com/svn/trunk@7424 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-01-28 20:40:24 +00:00
|
|
|
// logPerIter or printMin options, since it does not know the time per iteration. It
|
|
|
|
// will also be unable to call flush() for each tile.
|
|
|
|
// The goal of this timer is to make up for a system timer that is not precise enough to
|
|
|
|
// measure the small amount of time it takes to draw one tile once.
|
|
|
|
//
|
|
|
|
// 2) perTileTimer, along with perTileTimerData, will record each run separately, and
|
|
|
|
// then take the average. As such, it supports logPerIter and printMin options.
|
2013-02-07 20:20:27 +00:00
|
|
|
//
|
|
|
|
// Although "legal", having two gpu timers running at the same time
|
2013-02-08 07:16:45 +00:00
|
|
|
// seems to cause problems (i.e., INVALID_OPERATIONs) on several
|
|
|
|
// platforms. To work around this, we disable the gpu timer on the
|
2013-02-07 20:20:27 +00:00
|
|
|
// long running timer.
|
2013-02-11 18:42:43 +00:00
|
|
|
SkAutoTDelete<BenchTimer> longRunningTimer(this->setupTimer());
|
2014-03-11 22:58:00 +00:00
|
|
|
TimerData longRunningTimerData(numOuterLoops);
|
|
|
|
|
|
|
|
for (int outer = 0; outer < numOuterLoops; ++outer) {
|
|
|
|
SkAutoTDelete<BenchTimer> perTileTimer(this->setupTimer(false));
|
|
|
|
TimerData perTileTimerData(numInnerLoops);
|
|
|
|
|
|
|
|
longRunningTimer->start();
|
|
|
|
for (int inner = 0; inner < numInnerLoops; ++inner) {
|
|
|
|
perTileTimer->start();
|
|
|
|
tiledRenderer->drawCurrentTile();
|
|
|
|
perTileTimer->truncatedEnd();
|
|
|
|
tiledRenderer->resetState(false); // flush & swapBuffers, but don't Finish
|
|
|
|
perTileTimer->end();
|
|
|
|
SkAssertResult(perTileTimerData.appendTimes(perTileTimer.get()));
|
|
|
|
|
|
|
|
if (fPurgeDecodedTex) {
|
|
|
|
fRenderer->purgeTextures();
|
|
|
|
}
|
2013-12-18 17:25:33 +00:00
|
|
|
}
|
2014-03-11 22:58:00 +00:00
|
|
|
longRunningTimer->truncatedEnd();
|
|
|
|
tiledRenderer->resetState(true); // flush, swapBuffers and Finish
|
|
|
|
longRunningTimer->end();
|
|
|
|
SkAssertResult(longRunningTimerData.appendTimes(longRunningTimer.get()));
|
Provide an option to bench drawing individual tiles in bench_pictures.
Provides output like the following:
running bench [1236 12045] androidpolice.skp
tile_256x256: tile [0,0] out of [5,48]: msecs = 1.00
tile_256x256: tile [1,0] out of [5,48]: msecs = 1.50
tile_256x256: tile [2,0] out of [5,48]: msecs = 1.00
tile_256x256: tile [3,0] out of [5,48]: msecs = 1.50
tile_256x256: tile [4,0] out of [5,48]: msecs = 2.50
tile_256x256: tile [0,1] out of [5,48]: msecs = 2.00
tile_256x256: tile [1,1] out of [5,48]: msecs = 3.50
tile_256x256: tile [2,1] out of [5,48]: msecs = 3.50
tile_256x256: tile [3,1] out of [5,48]: msecs = 6.00
tile_256x256: tile [4,1] out of [5,48]: msecs = 2.50
tile_256x256: tile [0,2] out of [5,48]: msecs = 2.00
BUG=https://code.google.com/p/skia/issues/detail?id=1016
Review URL: https://codereview.appspot.com/6937047
git-svn-id: http://skia.googlecode.com/svn/trunk@6805 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-12-13 22:09:28 +00:00
|
|
|
}
|
Change the method for timing individual tiles in bench_pictures.
When timing individual tiles in bench_pictures, keep a timer running
across all repeats, and then take the average. The former method of
timing each iteration separately runs into precision errors on some
platforms.
Running on my Mac Pro with OSX 10.8, the cmsecs for the new method
and the old method are roughly the same when checking the CPU time.
When checking the wall time, the old method often gives me 0ms,
while the new method gives me a larger value. I don't think this
can be entirely attributed to rounding though, since on occasion I
see the old method showing a short time period (.05 - .15ms) while
the new method shows .15ms higher (which is in range for the
difference I'm seeing for other tiles where the old method reports
0ms).
Some other changes:
PictureRenderer::resetState now takes a boolean parameter. If called
with false, it will only do a flush, while if called with true, it
will also call finish.
resetState is now called with true everywhere except in between
iterations of drawing the same tile (when timing individual tiles).
render_pictures_main no longer calls resetState directly, since it
already calls end, which calls resetState.
BUG=http://code.google.com/p/skia/issues/detail?id=1066
Review URL: https://codereview.appspot.com/7101060
git-svn-id: http://skia.googlecode.com/svn/trunk@7424 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-01-28 20:40:24 +00:00
|
|
|
|
Provide an option to bench drawing individual tiles in bench_pictures.
Provides output like the following:
running bench [1236 12045] androidpolice.skp
tile_256x256: tile [0,0] out of [5,48]: msecs = 1.00
tile_256x256: tile [1,0] out of [5,48]: msecs = 1.50
tile_256x256: tile [2,0] out of [5,48]: msecs = 1.00
tile_256x256: tile [3,0] out of [5,48]: msecs = 1.50
tile_256x256: tile [4,0] out of [5,48]: msecs = 2.50
tile_256x256: tile [0,1] out of [5,48]: msecs = 2.00
tile_256x256: tile [1,1] out of [5,48]: msecs = 3.50
tile_256x256: tile [2,1] out of [5,48]: msecs = 3.50
tile_256x256: tile [3,1] out of [5,48]: msecs = 6.00
tile_256x256: tile [4,1] out of [5,48]: msecs = 2.50
tile_256x256: tile [0,2] out of [5,48]: msecs = 2.00
BUG=https://code.google.com/p/skia/issues/detail?id=1016
Review URL: https://codereview.appspot.com/6937047
git-svn-id: http://skia.googlecode.com/svn/trunk@6805 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-12-13 22:09:28 +00:00
|
|
|
SkString configName = tiledRenderer->getConfigName();
|
|
|
|
configName.appendf(": tile [%i,%i] out of [%i,%i]", x, y, xTiles, yTiles);
|
2013-07-31 20:00:56 +00:00
|
|
|
|
2014-03-11 22:58:00 +00:00
|
|
|
// TODO(borenet): Turn off per-iteration tile time reporting for now.
|
|
|
|
// Avoiding logging the time for every iteration for each tile cuts
|
|
|
|
// down on data file size by a significant amount. Re-enable this once
|
|
|
|
// we're loading the bench data directly into a data store and are no
|
|
|
|
// longer generating SVG graphs.
|
|
|
|
#if 0
|
2013-07-31 20:00:56 +00:00
|
|
|
SkString result = perTileTimerData.getResult(timeFormat.c_str(), fTimerResult,
|
|
|
|
configName.c_str(), timerTypes);
|
Provide an option to bench drawing individual tiles in bench_pictures.
Provides output like the following:
running bench [1236 12045] androidpolice.skp
tile_256x256: tile [0,0] out of [5,48]: msecs = 1.00
tile_256x256: tile [1,0] out of [5,48]: msecs = 1.50
tile_256x256: tile [2,0] out of [5,48]: msecs = 1.00
tile_256x256: tile [3,0] out of [5,48]: msecs = 1.50
tile_256x256: tile [4,0] out of [5,48]: msecs = 2.50
tile_256x256: tile [0,1] out of [5,48]: msecs = 2.00
tile_256x256: tile [1,1] out of [5,48]: msecs = 3.50
tile_256x256: tile [2,1] out of [5,48]: msecs = 3.50
tile_256x256: tile [3,1] out of [5,48]: msecs = 6.00
tile_256x256: tile [4,1] out of [5,48]: msecs = 2.50
tile_256x256: tile [0,2] out of [5,48]: msecs = 2.00
BUG=https://code.google.com/p/skia/issues/detail?id=1016
Review URL: https://codereview.appspot.com/6937047
git-svn-id: http://skia.googlecode.com/svn/trunk@6805 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-12-13 22:09:28 +00:00
|
|
|
result.append("\n");
|
|
|
|
this->logProgress(result.c_str());
|
2013-02-11 18:42:43 +00:00
|
|
|
#endif
|
2014-03-11 22:58:00 +00:00
|
|
|
|
2013-12-18 17:25:33 +00:00
|
|
|
if (fPurgeDecodedTex) {
|
|
|
|
configName.append(" <withPurging>");
|
|
|
|
}
|
Change the method for timing individual tiles in bench_pictures.
When timing individual tiles in bench_pictures, keep a timer running
across all repeats, and then take the average. The former method of
timing each iteration separately runs into precision errors on some
platforms.
Running on my Mac Pro with OSX 10.8, the cmsecs for the new method
and the old method are roughly the same when checking the CPU time.
When checking the wall time, the old method often gives me 0ms,
while the new method gives me a larger value. I don't think this
can be entirely attributed to rounding though, since on occasion I
see the old method showing a short time period (.05 - .15ms) while
the new method shows .15ms higher (which is in range for the
difference I'm seeing for other tiles where the old method reports
0ms).
Some other changes:
PictureRenderer::resetState now takes a boolean parameter. If called
with false, it will only do a flush, while if called with true, it
will also call finish.
resetState is now called with true everywhere except in between
iterations of drawing the same tile (when timing individual tiles).
render_pictures_main no longer calls resetState directly, since it
already calls end, which calls resetState.
BUG=http://code.google.com/p/skia/issues/detail?id=1066
Review URL: https://codereview.appspot.com/7101060
git-svn-id: http://skia.googlecode.com/svn/trunk@7424 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-01-28 20:40:24 +00:00
|
|
|
configName.append(" <averaged>");
|
2013-07-31 20:00:56 +00:00
|
|
|
SkString longRunningResult = longRunningTimerData.getResult(
|
|
|
|
tiledRenderer->getNormalTimeFormat().c_str(),
|
|
|
|
TimerData::kAvg_Result,
|
2014-03-11 22:58:00 +00:00
|
|
|
configName.c_str(), timerTypes, numInnerLoops);
|
Change the method for timing individual tiles in bench_pictures.
When timing individual tiles in bench_pictures, keep a timer running
across all repeats, and then take the average. The former method of
timing each iteration separately runs into precision errors on some
platforms.
Running on my Mac Pro with OSX 10.8, the cmsecs for the new method
and the old method are roughly the same when checking the CPU time.
When checking the wall time, the old method often gives me 0ms,
while the new method gives me a larger value. I don't think this
can be entirely attributed to rounding though, since on occasion I
see the old method showing a short time period (.05 - .15ms) while
the new method shows .15ms higher (which is in range for the
difference I'm seeing for other tiles where the old method reports
0ms).
Some other changes:
PictureRenderer::resetState now takes a boolean parameter. If called
with false, it will only do a flush, while if called with true, it
will also call finish.
resetState is now called with true everywhere except in between
iterations of drawing the same tile (when timing individual tiles).
render_pictures_main no longer calls resetState directly, since it
already calls end, which calls resetState.
BUG=http://code.google.com/p/skia/issues/detail?id=1066
Review URL: https://codereview.appspot.com/7101060
git-svn-id: http://skia.googlecode.com/svn/trunk@7424 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-01-28 20:40:24 +00:00
|
|
|
longRunningResult.append("\n");
|
|
|
|
this->logProgress(longRunningResult.c_str());
|
Provide an option to bench drawing individual tiles in bench_pictures.
Provides output like the following:
running bench [1236 12045] androidpolice.skp
tile_256x256: tile [0,0] out of [5,48]: msecs = 1.00
tile_256x256: tile [1,0] out of [5,48]: msecs = 1.50
tile_256x256: tile [2,0] out of [5,48]: msecs = 1.00
tile_256x256: tile [3,0] out of [5,48]: msecs = 1.50
tile_256x256: tile [4,0] out of [5,48]: msecs = 2.50
tile_256x256: tile [0,1] out of [5,48]: msecs = 2.00
tile_256x256: tile [1,1] out of [5,48]: msecs = 3.50
tile_256x256: tile [2,1] out of [5,48]: msecs = 3.50
tile_256x256: tile [3,1] out of [5,48]: msecs = 6.00
tile_256x256: tile [4,1] out of [5,48]: msecs = 2.50
tile_256x256: tile [0,2] out of [5,48]: msecs = 2.00
BUG=https://code.google.com/p/skia/issues/detail?id=1016
Review URL: https://codereview.appspot.com/6937047
git-svn-id: http://skia.googlecode.com/svn/trunk@6805 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-12-13 22:09:28 +00:00
|
|
|
}
|
|
|
|
} else {
|
2013-12-17 13:40:20 +00:00
|
|
|
SkAutoTDelete<BenchTimer> longRunningTimer(this->setupTimer());
|
2014-03-11 22:58:00 +00:00
|
|
|
TimerData longRunningTimerData(numOuterLoops);
|
|
|
|
|
|
|
|
for (int outer = 0; outer < numOuterLoops; ++outer) {
|
|
|
|
SkAutoTDelete<BenchTimer> perRunTimer(this->setupTimer(false));
|
|
|
|
TimerData perRunTimerData(numInnerLoops);
|
2013-12-17 13:40:20 +00:00
|
|
|
|
2014-03-11 22:58:00 +00:00
|
|
|
longRunningTimer->start();
|
|
|
|
for (int inner = 0; inner < numInnerLoops; ++inner) {
|
|
|
|
fRenderer->setup();
|
Provide an option to bench drawing individual tiles in bench_pictures.
Provides output like the following:
running bench [1236 12045] androidpolice.skp
tile_256x256: tile [0,0] out of [5,48]: msecs = 1.00
tile_256x256: tile [1,0] out of [5,48]: msecs = 1.50
tile_256x256: tile [2,0] out of [5,48]: msecs = 1.00
tile_256x256: tile [3,0] out of [5,48]: msecs = 1.50
tile_256x256: tile [4,0] out of [5,48]: msecs = 2.50
tile_256x256: tile [0,1] out of [5,48]: msecs = 2.00
tile_256x256: tile [1,1] out of [5,48]: msecs = 3.50
tile_256x256: tile [2,1] out of [5,48]: msecs = 3.50
tile_256x256: tile [3,1] out of [5,48]: msecs = 6.00
tile_256x256: tile [4,1] out of [5,48]: msecs = 2.50
tile_256x256: tile [0,2] out of [5,48]: msecs = 2.00
BUG=https://code.google.com/p/skia/issues/detail?id=1016
Review URL: https://codereview.appspot.com/6937047
git-svn-id: http://skia.googlecode.com/svn/trunk@6805 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-12-13 22:09:28 +00:00
|
|
|
|
2014-03-11 22:58:00 +00:00
|
|
|
perRunTimer->start();
|
|
|
|
fRenderer->render(NULL);
|
|
|
|
perRunTimer->truncatedEnd();
|
|
|
|
fRenderer->resetState(false); // flush & swapBuffers, but don't Finish
|
|
|
|
perRunTimer->end();
|
Provide an option to bench drawing individual tiles in bench_pictures.
Provides output like the following:
running bench [1236 12045] androidpolice.skp
tile_256x256: tile [0,0] out of [5,48]: msecs = 1.00
tile_256x256: tile [1,0] out of [5,48]: msecs = 1.50
tile_256x256: tile [2,0] out of [5,48]: msecs = 1.00
tile_256x256: tile [3,0] out of [5,48]: msecs = 1.50
tile_256x256: tile [4,0] out of [5,48]: msecs = 2.50
tile_256x256: tile [0,1] out of [5,48]: msecs = 2.00
tile_256x256: tile [1,1] out of [5,48]: msecs = 3.50
tile_256x256: tile [2,1] out of [5,48]: msecs = 3.50
tile_256x256: tile [3,1] out of [5,48]: msecs = 6.00
tile_256x256: tile [4,1] out of [5,48]: msecs = 2.50
tile_256x256: tile [0,2] out of [5,48]: msecs = 2.00
BUG=https://code.google.com/p/skia/issues/detail?id=1016
Review URL: https://codereview.appspot.com/6937047
git-svn-id: http://skia.googlecode.com/svn/trunk@6805 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-12-13 22:09:28 +00:00
|
|
|
|
2014-03-11 22:58:00 +00:00
|
|
|
SkAssertResult(perRunTimerData.appendTimes(perRunTimer.get()));
|
2013-12-18 17:25:33 +00:00
|
|
|
|
2014-03-11 22:58:00 +00:00
|
|
|
if (fPurgeDecodedTex) {
|
|
|
|
fRenderer->purgeTextures();
|
|
|
|
}
|
2013-12-18 17:25:33 +00:00
|
|
|
}
|
2014-03-11 22:58:00 +00:00
|
|
|
longRunningTimer->truncatedEnd();
|
|
|
|
fRenderer->resetState(true); // flush, swapBuffers and Finish
|
|
|
|
longRunningTimer->end();
|
|
|
|
SkAssertResult(longRunningTimerData.appendTimes(longRunningTimer.get()));
|
Provide an option to bench drawing individual tiles in bench_pictures.
Provides output like the following:
running bench [1236 12045] androidpolice.skp
tile_256x256: tile [0,0] out of [5,48]: msecs = 1.00
tile_256x256: tile [1,0] out of [5,48]: msecs = 1.50
tile_256x256: tile [2,0] out of [5,48]: msecs = 1.00
tile_256x256: tile [3,0] out of [5,48]: msecs = 1.50
tile_256x256: tile [4,0] out of [5,48]: msecs = 2.50
tile_256x256: tile [0,1] out of [5,48]: msecs = 2.00
tile_256x256: tile [1,1] out of [5,48]: msecs = 3.50
tile_256x256: tile [2,1] out of [5,48]: msecs = 3.50
tile_256x256: tile [3,1] out of [5,48]: msecs = 6.00
tile_256x256: tile [4,1] out of [5,48]: msecs = 2.50
tile_256x256: tile [0,2] out of [5,48]: msecs = 2.00
BUG=https://code.google.com/p/skia/issues/detail?id=1016
Review URL: https://codereview.appspot.com/6937047
git-svn-id: http://skia.googlecode.com/svn/trunk@6805 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-12-13 22:09:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SkString configName = fRenderer->getConfigName();
|
2013-12-18 17:25:33 +00:00
|
|
|
if (fPurgeDecodedTex) {
|
|
|
|
configName.append(" <withPurging>");
|
|
|
|
}
|
2013-07-31 20:00:56 +00:00
|
|
|
|
2013-12-17 13:40:20 +00:00
|
|
|
// Beware - since the per-run-timer doesn't ever include a glFinish it can
|
|
|
|
// report a lower time then the long-running-timer
|
|
|
|
#if 0
|
|
|
|
SkString result = perRunTimerData.getResult(timeFormat.c_str(),
|
|
|
|
fTimerResult,
|
|
|
|
configName.c_str(),
|
|
|
|
timerTypes);
|
Provide an option to bench drawing individual tiles in bench_pictures.
Provides output like the following:
running bench [1236 12045] androidpolice.skp
tile_256x256: tile [0,0] out of [5,48]: msecs = 1.00
tile_256x256: tile [1,0] out of [5,48]: msecs = 1.50
tile_256x256: tile [2,0] out of [5,48]: msecs = 1.00
tile_256x256: tile [3,0] out of [5,48]: msecs = 1.50
tile_256x256: tile [4,0] out of [5,48]: msecs = 2.50
tile_256x256: tile [0,1] out of [5,48]: msecs = 2.00
tile_256x256: tile [1,1] out of [5,48]: msecs = 3.50
tile_256x256: tile [2,1] out of [5,48]: msecs = 3.50
tile_256x256: tile [3,1] out of [5,48]: msecs = 6.00
tile_256x256: tile [4,1] out of [5,48]: msecs = 2.50
tile_256x256: tile [0,2] out of [5,48]: msecs = 2.00
BUG=https://code.google.com/p/skia/issues/detail?id=1016
Review URL: https://codereview.appspot.com/6937047
git-svn-id: http://skia.googlecode.com/svn/trunk@6805 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-12-13 22:09:28 +00:00
|
|
|
result.append("\n");
|
2013-12-17 13:40:20 +00:00
|
|
|
|
Provide an option to bench drawing individual tiles in bench_pictures.
Provides output like the following:
running bench [1236 12045] androidpolice.skp
tile_256x256: tile [0,0] out of [5,48]: msecs = 1.00
tile_256x256: tile [1,0] out of [5,48]: msecs = 1.50
tile_256x256: tile [2,0] out of [5,48]: msecs = 1.00
tile_256x256: tile [3,0] out of [5,48]: msecs = 1.50
tile_256x256: tile [4,0] out of [5,48]: msecs = 2.50
tile_256x256: tile [0,1] out of [5,48]: msecs = 2.00
tile_256x256: tile [1,1] out of [5,48]: msecs = 3.50
tile_256x256: tile [2,1] out of [5,48]: msecs = 3.50
tile_256x256: tile [3,1] out of [5,48]: msecs = 6.00
tile_256x256: tile [4,1] out of [5,48]: msecs = 2.50
tile_256x256: tile [0,2] out of [5,48]: msecs = 2.00
BUG=https://code.google.com/p/skia/issues/detail?id=1016
Review URL: https://codereview.appspot.com/6937047
git-svn-id: http://skia.googlecode.com/svn/trunk@6805 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-12-13 22:09:28 +00:00
|
|
|
this->logProgress(result.c_str());
|
2013-12-17 13:40:20 +00:00
|
|
|
#else
|
2013-12-18 07:01:56 +00:00
|
|
|
SkString result = longRunningTimerData.getResult(timeFormat.c_str(),
|
2014-03-11 22:58:00 +00:00
|
|
|
fTimerResult,
|
|
|
|
configName.c_str(),
|
|
|
|
timerTypes,
|
|
|
|
numInnerLoops);
|
2013-12-17 13:40:20 +00:00
|
|
|
result.append("\n");
|
|
|
|
this->logProgress(result.c_str());
|
|
|
|
#endif
|
2012-08-01 17:53:29 +00:00
|
|
|
}
|
|
|
|
|
2012-09-11 19:15:32 +00:00
|
|
|
fRenderer->end();
|
2012-08-01 17:53:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|