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 "PictureRenderer.h"
|
2014-05-29 17:10:24 +00:00
|
|
|
#include "PictureResultsWriter.h"
|
2014-06-19 19:32:29 +00:00
|
|
|
#include "SkTypes.h"
|
|
|
|
#include "TimerData.h"
|
2012-08-01 17:53:29 +00:00
|
|
|
|
|
|
|
class SkPicture;
|
2014-06-20 18:29:20 +00:00
|
|
|
class Timer;
|
2012-08-01 17:53:29 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
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
|
|
|
/**
|
|
|
|
* Draw the provided SkPicture fRepeats times while collecting timing data, and log the output
|
2014-05-29 17:10:24 +00:00
|
|
|
* via fWriter.
|
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-10-09 11:59:19 +00:00
|
|
|
void run(SkPicture* pict, bool useMultiPictureDraw);
|
2012-08-01 17:53:29 +00:00
|
|
|
|
|
|
|
void setRepeats(int repeats) {
|
|
|
|
fRepeats = repeats;
|
|
|
|
}
|
|
|
|
|
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 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.
|
|
|
|
*/
|
2013-03-04 16:41:06 +00:00
|
|
|
void setTimeIndividualTiles(bool indiv) { fTimeIndividualTiles = indiv; }
|
2013-12-18 17:25:33 +00:00
|
|
|
bool timeIndividualTiles() const { return fTimeIndividualTiles; }
|
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
|
|
|
|
2013-12-18 17:25:33 +00:00
|
|
|
void setPurgeDecodedTex(bool purgeDecodedTex) { fPurgeDecodedTex = purgeDecodedTex; }
|
|
|
|
bool purgeDecodedText() const { return fPurgeDecodedTex; }
|
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
|
|
|
|
2012-09-11 19:15:32 +00:00
|
|
|
PictureRenderer* setRenderer(PictureRenderer*);
|
2014-09-18 20:52:08 +00:00
|
|
|
PictureRenderer* renderer() { return fRenderer; }
|
2012-08-20 15:03:41 +00:00
|
|
|
|
2013-07-31 20:00:56 +00:00
|
|
|
void setTimerResultType(TimerData::Result resultType) { fTimerResult = resultType; }
|
2012-08-01 17:53:29 +00:00
|
|
|
|
2013-07-31 20:00:56 +00:00
|
|
|
void setTimersToShow(bool wall, bool truncatedWall, bool cpu, bool truncatedCpu, bool gpu);
|
2012-09-07 15:21:18 +00:00
|
|
|
|
2014-05-29 17:10:24 +00:00
|
|
|
void setWriter(PictureResultsWriter* writer) { fWriter = writer; }
|
2012-08-01 17:53:29 +00:00
|
|
|
|
2012-08-07 17:11:33 +00:00
|
|
|
private:
|
2013-07-31 20:00:56 +00:00
|
|
|
int fRepeats;
|
|
|
|
PictureRenderer* fRenderer;
|
|
|
|
TimerData::Result fTimerResult;
|
|
|
|
uint32_t fTimerTypes; // bitfield of TimerData::TimerFlags values
|
|
|
|
bool fTimeIndividualTiles;
|
2013-12-18 17:25:33 +00:00
|
|
|
bool fPurgeDecodedTex;
|
2012-09-07 15:21:18 +00:00
|
|
|
|
2014-05-29 17:10:24 +00:00
|
|
|
PictureResultsWriter* fWriter;
|
2012-09-07 15:21:18 +00:00
|
|
|
|
2014-06-20 18:29:20 +00:00
|
|
|
Timer* setupTimer(bool useGLTimer = true);
|
2012-08-01 17:53:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // PictureBenchmark_DEFINED
|