From f168b86d7fafc5c20c87bebc6fd393cb17e120ca Mon Sep 17 00:00:00 2001 From: tfarina Date: Thu, 19 Jun 2014 12:32:29 -0700 Subject: Remove Sk prefix from some bench classes. This idea came while commenting on https://codereview.chromium.org/343583005/ Since SkBenchmark, SkBenchLogger and SkGMBench are not part of the Skia library, they should not have the Sk prefix. BUG=None TEST=make all R=mtklein@google.com Author: tfarina@chromium.org Review URL: https://codereview.chromium.org/347823004 --- bench/AAClipBench.cpp | 22 ++-- bench/BenchLogger.cpp | 30 +++++ bench/BenchLogger.h | 76 ++++++++++++ .../BenchTool/BenchTool.xcodeproj/project.pbxproj | 8 +- bench/Benchmark.cpp | 56 +++++++++ bench/Benchmark.h | 128 +++++++++++++++++++++ bench/BicubicBench.cpp | 8 +- bench/BitmapBench.cpp | 8 +- bench/BitmapRectBench.cpp | 8 +- bench/BitmapScaleBench.cpp | 8 +- bench/BlurBench.cpp | 8 +- bench/BlurImageFilterBench.cpp | 6 +- bench/BlurRectBench.cpp | 8 +- bench/BlurRoundRectBench.cpp | 8 +- bench/ChartBench.cpp | 6 +- bench/ChecksumBench.cpp | 6 +- bench/ChromeBench.cpp | 6 +- bench/CmapBench.cpp | 6 +- bench/ColorFilterBench.cpp | 6 +- bench/ColorPrivBench.cpp | 4 +- bench/CoverageBench.cpp | 6 +- bench/DashBench.cpp | 26 ++--- bench/DecodeBench.cpp | 6 +- bench/DeferredCanvasBench.cpp | 6 +- bench/DeferredSurfaceCopyBench.cpp | 6 +- bench/DisplacementBench.cpp | 6 +- bench/ETCBitmapBench.cpp | 22 ++-- bench/FSRectBench.cpp | 6 +- bench/FontCacheBench.cpp | 10 +- bench/FontScalerBench.cpp | 6 +- bench/GMBench.cpp | 51 ++++++++ bench/GMBench.h | 31 +++++ bench/GameBench.cpp | 6 +- bench/GrMemoryPoolBench.cpp | 14 +-- bench/GrOrderedSetBench.cpp | 14 +-- bench/GrResourceCacheBench.cpp | 12 +- bench/GradientBench.cpp | 10 +- bench/HairlinePathBench.cpp | 8 +- bench/ImageCacheBench.cpp | 6 +- bench/ImageDecodeBench.cpp | 6 +- bench/ImageFilterDAGBench.cpp | 8 +- bench/InterpBench.cpp | 8 +- bench/LightingBench.cpp | 6 +- bench/LineBench.cpp | 6 +- bench/MagnifierBench.cpp | 6 +- bench/MathBench.cpp | 30 ++--- bench/Matrix44Bench.cpp | 6 +- bench/MatrixBench.cpp | 6 +- bench/MatrixConvolutionBench.cpp | 8 +- bench/MemcpyBench.cpp | 4 +- bench/MemoryBench.cpp | 10 +- bench/MemsetBench.cpp | 8 +- bench/MergeBench.cpp | 6 +- bench/MorphologyBench.cpp | 8 +- bench/MutexBench.cpp | 6 +- bench/PathBench.cpp | 34 +++--- bench/PathIterBench.cpp | 6 +- bench/PathUtilsBench.cpp | 8 +- bench/PerlinNoiseBench.cpp | 6 +- bench/PicturePlaybackBench.cpp | 6 +- bench/PictureRecordBench.cpp | 6 +- bench/PremulAndUnpremulAlphaOpsBench.cpp | 6 +- bench/QuadTreeBench.cpp | 10 +- bench/RTreeBench.cpp | 10 +- bench/ReadPixBench.cpp | 6 +- bench/RectBench.cpp | 10 +- bench/RectanizerBench.cpp | 6 +- bench/RectoriBench.cpp | 10 +- bench/RefCntBench.cpp | 28 ++--- bench/RegionBench.cpp | 10 +- bench/RegionContainBench.cpp | 6 +- bench/RepeatTileBench.cpp | 6 +- bench/ResultsWriter.h | 8 +- bench/ScalarBench.cpp | 10 +- bench/ShaderMaskBench.cpp | 6 +- bench/SkBenchLogger.cpp | 30 ----- bench/SkBenchLogger.h | 77 ------------- bench/SkBenchmark.cpp | 56 --------- bench/SkBenchmark.h | 128 --------------------- bench/SkGMBench.cpp | 51 -------- bench/SkGMBench.h | 31 ----- bench/SkipZeroesBench.cpp | 6 +- bench/SortBench.cpp | 14 +-- bench/StackBench.cpp | 4 +- bench/StrokeBench.cpp | 6 +- bench/TableBench.cpp | 6 +- bench/TextBench.cpp | 6 +- bench/TileBench.cpp | 6 +- bench/VertBench.cpp | 8 +- bench/WritePixelsBench.cpp | 6 +- bench/WriterBench.cpp | 6 +- bench/XfermodeBench.cpp | 10 +- bench/benchmain.cpp | 62 +++++----- dm/DM.cpp | 6 +- dm/DMBenchTask.cpp | 8 +- dm/DMBenchTask.h | 10 +- dm/DMUtil.h | 2 +- gyp/bench.gyp | 8 +- gyp/bench.gypi | 4 +- gyp/tools.gyp | 4 +- tools/PictureBenchmark.h | 6 +- tools/PictureResultsWriter.h | 10 +- tools/bbh_shootout.cpp | 4 +- tools/bench_pictures_main.cpp | 8 +- 104 files changed, 790 insertions(+), 791 deletions(-) create mode 100644 bench/BenchLogger.cpp create mode 100644 bench/BenchLogger.h create mode 100644 bench/Benchmark.cpp create mode 100644 bench/Benchmark.h create mode 100644 bench/GMBench.cpp create mode 100644 bench/GMBench.h delete mode 100644 bench/SkBenchLogger.cpp delete mode 100644 bench/SkBenchLogger.h delete mode 100644 bench/SkBenchmark.cpp delete mode 100644 bench/SkBenchmark.h delete mode 100644 bench/SkGMBench.cpp delete mode 100644 bench/SkGMBench.h diff --git a/bench/AAClipBench.cpp b/bench/AAClipBench.cpp index ab0f4f9a00..4cc9abe9fc 100644 --- a/bench/AAClipBench.cpp +++ b/bench/AAClipBench.cpp @@ -5,17 +5,17 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkAAClip.h" +#include "SkCanvas.h" #include "SkPath.h" +#include "SkRandom.h" #include "SkRegion.h" #include "SkString.h" -#include "SkCanvas.h" -#include "SkRandom.h" //////////////////////////////////////////////////////////////////////////////// // This bench tests out AA/BW clipping via canvas' clipPath and clipRect calls -class AAClipBench : public SkBenchmark { +class AAClipBench : public Benchmark { SkString fName; SkPath fClipPath; SkRect fClipRect; @@ -79,13 +79,13 @@ protected: } } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; //////////////////////////////////////////////////////////////////////////////// // This bench tests out nested clip stacks. It is intended to simulate // how WebKit nests clips. -class NestedAAClipBench : public SkBenchmark { +class NestedAAClipBench : public Benchmark { SkString fName; bool fDoAA; SkRect fDrawRect; @@ -167,11 +167,11 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; //////////////////////////////////////////////////////////////////////////////// -class AAClipBuilderBench : public SkBenchmark { +class AAClipBuilderBench : public Benchmark { SkString fName; SkPath fPath; SkRect fRect; @@ -209,11 +209,11 @@ protected: } } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; //////////////////////////////////////////////////////////////////////////////// -class AAClipRegionBench : public SkBenchmark { +class AAClipRegionBench : public Benchmark { public: AAClipRegionBench() { SkPath path; @@ -239,7 +239,7 @@ protected: private: SkRegion fRegion; - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; //////////////////////////////////////////////////////////////////////////////// diff --git a/bench/BenchLogger.cpp b/bench/BenchLogger.cpp new file mode 100644 index 0000000000..98423d0150 --- /dev/null +++ b/bench/BenchLogger.cpp @@ -0,0 +1,30 @@ +/* + * Copyright 2012 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "BenchLogger.h" + +#include "SkStream.h" + +BenchLogger::BenchLogger() +: fFileStream(NULL) {} + +BenchLogger::~BenchLogger() { + if (fFileStream) { + SkDELETE(fFileStream); + } +} + +bool BenchLogger::SetLogFile(const char *file) { + fFileStream = SkNEW_ARGS(SkFILEWStream, (file)); + return fFileStream->isValid(); +} + +void BenchLogger::fileWrite(const char msg[], size_t size) { + if (fFileStream && fFileStream->isValid()) { + fFileStream->write(msg, size); + } +} diff --git a/bench/BenchLogger.h b/bench/BenchLogger.h new file mode 100644 index 0000000000..a7c283ad50 --- /dev/null +++ b/bench/BenchLogger.h @@ -0,0 +1,76 @@ +/* + * 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 BenchLogger_DEFINED +#define BenchLogger_DEFINED + +#include +#include "SkString.h" +#include "SkTypes.h" + +class SkFILEWStream; + +/** + * Class that allows logging to a file while simultaneously logging to stdout/stderr. + */ +class BenchLogger { +public: + BenchLogger(); + + /** + * Not virtual, since this class is not intended to be subclassed. + */ + ~BenchLogger(); + + /** + * Specify a file to write progress logs to. Unless this is called with a valid file path, + * BenchLogger will only write to stdout/stderr. + */ + bool SetLogFile(const char file[]); + + /** + * Log an error to stderr, taking a C style string as input. + */ + void logError(const char msg[]) { this->nativeLogError(msg); } + + /** + * Log an error to stderr, taking an SkString as input. + */ + void logError(const SkString& str) { this->nativeLogError(str.c_str()); } + + /** + * Log the progress of the bench tool to both stdout and the log file specified by SetLogFile, + * if any, taking a C style string as input. + */ + void logProgress(const char msg[]) { + this->nativeLogProgress(msg); + this->fileWrite(msg, strlen(msg)); + } + + /** + * Log the progress of the bench tool to both stdout and the log file specified by SetLogFile, + * if any, taking an SkString as input. + */ + void logProgress(const SkString& str) { + this->nativeLogProgress(str.c_str()); + this->fileWrite(str.c_str(), str.size()); + } + +private: +#ifdef SK_BUILD_FOR_ANDROID + void nativeLogError(const char msg[]) { SkDebugf("%s", msg); } +#else + void nativeLogError(const char msg[]) { fprintf(stderr, "%s", msg); } +#endif + void nativeLogProgress(const char msg[]) { SkDebugf("%s", msg); } + + void fileWrite(const char msg[], size_t size); + + SkFILEWStream* fFileStream; +}; + +#endif // BenchLogger_DEFINED diff --git a/bench/BenchTool/BenchTool.xcodeproj/project.pbxproj b/bench/BenchTool/BenchTool.xcodeproj/project.pbxproj index b6374949fe..4bb4b9cdc4 100644 --- a/bench/BenchTool/BenchTool.xcodeproj/project.pbxproj +++ b/bench/BenchTool/BenchTool.xcodeproj/project.pbxproj @@ -8,7 +8,7 @@ /* Begin PBXBuildFile section */ 272FB43A0F11A19C00CA935D /* RectBench.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 272FB4390F11A19C00CA935D /* RectBench.cpp */; }; - 272FB4F30F11B40300CA935D /* SkBenchmark.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 272FB4F20F11B40300CA935D /* SkBenchmark.cpp */; }; + 272FB4F30F11B40300CA935D /* Benchmark.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 272FB4F20F11B40300CA935D /* Benchmark.cpp */; }; 2752A08A0F14CE1300BBDC03 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2752A0890F14CE1300BBDC03 /* main.cpp */; }; 27739F4D0F11439200F233EA /* libmaccore.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 27739F240F11404A00F233EA /* libmaccore.a */; }; 27739F4E0F11439300F233EA /* libcore.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 27739F1A0F11403B00F233EA /* libcore.a */; }; @@ -62,7 +62,7 @@ /* Begin PBXFileReference section */ 272FB4390F11A19C00CA935D /* RectBench.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RectBench.cpp; path = ../RectBench.cpp; sourceTree = SOURCE_ROOT; }; - 272FB4F20F11B40300CA935D /* SkBenchmark.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkBenchmark.cpp; path = ../SkBenchmark.cpp; sourceTree = SOURCE_ROOT; }; + 272FB4F20F11B40300CA935D /* Benchmark.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Benchmark.cpp; path = ../Benchmark.cpp; sourceTree = SOURCE_ROOT; }; 2752A0890F14CE1300BBDC03 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = main.cpp; path = ../main.cpp; sourceTree = SOURCE_ROOT; }; 27739F120F11403B00F233EA /* core.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = core.xcodeproj; path = ../../xcode/core/core.xcodeproj; sourceTree = SOURCE_ROOT; }; 27739F1C0F11404A00F233EA /* maccore.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = maccore.xcodeproj; path = ../../xcode/maccore/maccore.xcodeproj; sourceTree = SOURCE_ROOT; }; @@ -102,7 +102,7 @@ isa = PBXGroup; children = ( 2752A0890F14CE1300BBDC03 /* main.cpp */, - 272FB4F20F11B40300CA935D /* SkBenchmark.cpp */, + 272FB4F20F11B40300CA935D /* Benchmark.cpp */, 272FB4390F11A19C00CA935D /* RectBench.cpp */, ); name = Source; @@ -213,7 +213,7 @@ buildActionMask = 2147483647; files = ( 272FB43A0F11A19C00CA935D /* RectBench.cpp in Sources */, - 272FB4F30F11B40300CA935D /* SkBenchmark.cpp in Sources */, + 272FB4F30F11B40300CA935D /* Benchmark.cpp in Sources */, 2752A08A0F14CE1300BBDC03 /* main.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/bench/Benchmark.cpp b/bench/Benchmark.cpp new file mode 100644 index 0000000000..ae614f04f9 --- /dev/null +++ b/bench/Benchmark.cpp @@ -0,0 +1,56 @@ +/* + * Copyright 2011 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "Benchmark.h" + +#include "SkPaint.h" +#include "SkParse.h" + +const char* SkTriState::Name[] = { "default", "true", "false" }; + +template BenchRegistry* BenchRegistry::gHead; + +Benchmark::Benchmark() { + fForceAlpha = 0xFF; + fForceAA = true; + fForceFilter = false; + fDither = SkTriState::kDefault; + fOrMask = fClearMask = 0; +} + +const char* Benchmark::getName() { + return this->onGetName(); +} + +SkIPoint Benchmark::getSize() { + return this->onGetSize(); +} + +void Benchmark::preDraw() { + this->onPreDraw(); +} + +void Benchmark::draw(const int loops, SkCanvas* canvas) { + this->onDraw(loops, canvas); +} + +void Benchmark::setupPaint(SkPaint* paint) { + paint->setAlpha(fForceAlpha); + paint->setAntiAlias(fForceAA); + paint->setFilterLevel(fForceFilter ? SkPaint::kLow_FilterLevel + : SkPaint::kNone_FilterLevel); + + paint->setFlags((paint->getFlags() & ~fClearMask) | fOrMask); + + if (SkTriState::kDefault != fDither) { + paint->setDither(SkTriState::kTrue == fDither); + } +} + +SkIPoint Benchmark::onGetSize() { + return SkIPoint::Make(640, 480); +} diff --git a/bench/Benchmark.h b/bench/Benchmark.h new file mode 100644 index 0000000000..db70bbe49c --- /dev/null +++ b/bench/Benchmark.h @@ -0,0 +1,128 @@ +/* + * Copyright 2011 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef Benchmark_DEFINED +#define Benchmark_DEFINED + +#include "SkPoint.h" +#include "SkRefCnt.h" +#include "SkString.h" +#include "SkTRegistry.h" + +#define DEF_BENCH(code) \ +namespace { \ +static Benchmark* SK_MACRO_APPEND_LINE(factory)(void*) { code; } \ +BenchRegistry SK_MACRO_APPEND_LINE(g_R_)(SK_MACRO_APPEND_LINE(factory)); \ +} + +/* + * With the above macros, you can register benches as follows (at the bottom + * of your .cpp) + * + * DEF_BENCH(return new MyBenchmark(...)) + * DEF_BENCH(return new MyBenchmark(...)) + * DEF_BENCH(return new MyBenchmark(...)) + */ + + +class SkCanvas; +class SkPaint; + +class SkTriState { +public: + enum State { + kDefault, + kTrue, + kFalse + }; + static const char* Name[]; +}; + +class Benchmark : public SkRefCnt { +public: + SK_DECLARE_INST_COUNT(Benchmark) + + Benchmark(); + + const char* getName(); + SkIPoint getSize(); + + enum Backend { + kNonRendering_Backend, + kRaster_Backend, + kGPU_Backend, + kPDF_Backend, + }; + + // Call to determine whether the benchmark is intended for + // the rendering mode. + virtual bool isSuitableFor(Backend backend) { + return backend != kNonRendering_Backend; + } + + // Call before draw, allows the benchmark to do setup work outside of the + // timer. When a benchmark is repeatedly drawn, this should be called once + // before the initial draw. + void preDraw(); + + // Bench framework can tune loops to be large enough for stable timing. + void draw(const int loops, SkCanvas*); + + void setForceAlpha(int alpha) { + fForceAlpha = alpha; + } + + void setForceAA(bool aa) { + fForceAA = aa; + } + + void setForceFilter(bool filter) { + fForceFilter = filter; + } + + void setDither(SkTriState::State state) { + fDither = state; + } + + /** Assign masks for paint-flags. These will be applied when setupPaint() + * is called. + * + * Performs the following on the paint: + * uint32_t flags = paint.getFlags(); + * flags &= ~clearMask; + * flags |= orMask; + * paint.setFlags(flags); + */ + void setPaintMasks(uint32_t orMask, uint32_t clearMask) { + fOrMask = orMask; + fClearMask = clearMask; + } + +protected: + virtual void setupPaint(SkPaint* paint); + + virtual const char* onGetName() = 0; + virtual void onPreDraw() {} + // Each bench should do its main work in a loop like this: + // for (int i = 0; i < loops; i++) { } + virtual void onDraw(const int loops, SkCanvas*) = 0; + + virtual SkIPoint onGetSize(); + +private: + int fForceAlpha; + bool fForceAA; + bool fForceFilter; + SkTriState::State fDither; + uint32_t fOrMask, fClearMask; + + typedef SkRefCnt INHERITED; +}; + +typedef SkTRegistry BenchRegistry; + +#endif diff --git a/bench/BicubicBench.cpp b/bench/BicubicBench.cpp index 162ec61370..9d03dd1574 100644 --- a/bench/BicubicBench.cpp +++ b/bench/BicubicBench.cpp @@ -5,16 +5,16 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" +#include "SkBicubicImageFilter.h" #include "SkCanvas.h" #include "SkShader.h" #include "SkString.h" -#include "SkBicubicImageFilter.h" // This bench exercises SkBicubicImageFilter, upsampling a 40x40 input to // 100x100, 400x100, 100x400, and 400x400. -class BicubicBench : public SkBenchmark { +class BicubicBench : public Benchmark { SkSize fScale; SkString fName; @@ -49,7 +49,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; DEF_BENCH( return new BicubicBench(10.0f, 10.0f); ) diff --git a/bench/BitmapBench.cpp b/bench/BitmapBench.cpp index e877bd472d..a269e906f6 100644 --- a/bench/BitmapBench.cpp +++ b/bench/BitmapBench.cpp @@ -5,11 +5,11 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkBitmap.h" -#include "SkPaint.h" #include "SkCanvas.h" #include "SkColorPriv.h" +#include "SkPaint.h" #include "SkRandom.h" #include "SkString.h" #include "sk_tool_utils.h" @@ -70,7 +70,7 @@ static void convertToIndex666(const SkBitmap& src, SkBitmap* dst, SkAlphaType aT */ -class BitmapBench : public SkBenchmark { +class BitmapBench : public Benchmark { const SkColorType fColorType; const SkAlphaType fAlphaType; const bool fForceUpdate; //bitmap marked as dirty before each draw. forces bitmap to be updated on device cache @@ -168,7 +168,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; /** Explicitly invoke some filter types to improve coverage of acceleration diff --git a/bench/BitmapRectBench.cpp b/bench/BitmapRectBench.cpp index 32589fc38d..2ad7bdf9b5 100644 --- a/bench/BitmapRectBench.cpp +++ b/bench/BitmapRectBench.cpp @@ -5,11 +5,11 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkBitmap.h" -#include "SkPaint.h" #include "SkCanvas.h" #include "SkColorPriv.h" +#include "SkPaint.h" #include "SkRandom.h" #include "SkString.h" @@ -38,7 +38,7 @@ static void draw_into_bitmap(const SkBitmap& bm) { paint : filter-p */ -class BitmapRectBench : public SkBenchmark { +class BitmapRectBench : public Benchmark { SkBitmap fBitmap; bool fSlightMatrix; uint8_t fAlpha; @@ -101,7 +101,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; DEF_BENCH(return new BitmapRectBench(0xFF, SkPaint::kNone_FilterLevel, false)) diff --git a/bench/BitmapScaleBench.cpp b/bench/BitmapScaleBench.cpp index 93e10fa43c..fad741aebc 100644 --- a/bench/BitmapScaleBench.cpp +++ b/bench/BitmapScaleBench.cpp @@ -5,15 +5,15 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" +#include "SkBlurMask.h" #include "SkCanvas.h" #include "SkPaint.h" #include "SkRandom.h" #include "SkShader.h" #include "SkString.h" -#include "SkBlurMask.h" -class BitmapScaleBench: public SkBenchmark { +class BitmapScaleBench: public Benchmark { int fLoopCount; int fInputSize; int fOutputSize; @@ -79,7 +79,7 @@ protected: virtual void doScaleImage() = 0; virtual void preBenchSetup() {} private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; class BitmapFilterScaleBench: public BitmapScaleBench { diff --git a/bench/BlurBench.cpp b/bench/BlurBench.cpp index ae31804deb..cafc6f3a2a 100644 --- a/bench/BlurBench.cpp +++ b/bench/BlurBench.cpp @@ -5,14 +5,14 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkBlurMask.h" +#include "SkBlurMaskFilter.h" #include "SkCanvas.h" #include "SkPaint.h" #include "SkRandom.h" #include "SkShader.h" #include "SkString.h" -#include "SkBlurMaskFilter.h" #define SMALL SkIntToScalar(2) #define REAL 1.5f @@ -26,7 +26,7 @@ static const char* gStyleName[] = { "inner" }; -class BlurBench : public SkBenchmark { +class BlurBench : public Benchmark { SkScalar fRadius; SkBlurStyle fStyle; uint32_t fFlags; @@ -75,7 +75,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; DEF_BENCH(return new BlurBench(SMALL, kNormal_SkBlurStyle);) diff --git a/bench/BlurImageFilterBench.cpp b/bench/BlurImageFilterBench.cpp index 7739730a77..786611b150 100644 --- a/bench/BlurImageFilterBench.cpp +++ b/bench/BlurImageFilterBench.cpp @@ -5,7 +5,7 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkBitmapDevice.h" #include "SkBlurImageFilter.h" #include "SkCanvas.h" @@ -22,7 +22,7 @@ #define BLUR_SIGMA_LARGE 10.0f #define BLUR_SIGMA_HUGE 80.0f -class BlurImageFilterBench : public SkBenchmark { +class BlurImageFilterBench : public Benchmark { public: BlurImageFilterBench(SkScalar sigmaX, SkScalar sigmaY, bool small) : fIsSmall(small), fInitialized(false), fSigmaX(sigmaX), fSigmaY(sigmaY) { @@ -80,7 +80,7 @@ private: bool fInitialized; SkBitmap fCheckerboard; SkScalar fSigmaX, fSigmaY; - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_LARGE, 0, false);) diff --git a/bench/BlurRectBench.cpp b/bench/BlurRectBench.cpp index 6871e0e4ca..cdcdfe57f3 100644 --- a/bench/BlurRectBench.cpp +++ b/bench/BlurRectBench.cpp @@ -5,13 +5,13 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" +#include "SkBlurMask.h" #include "SkCanvas.h" #include "SkPaint.h" #include "SkRandom.h" #include "SkShader.h" #include "SkString.h" -#include "SkBlurMask.h" #define SMALL SkIntToScalar(2) #define REAL 1.5f @@ -20,7 +20,7 @@ static const SkScalar kMedium = SkIntToScalar(5); static const SkScalar kMedBig = SkIntToScalar(20); #define REALBIG 30.5f -class BlurRectBench: public SkBenchmark { +class BlurRectBench: public Benchmark { int fLoopCount; SkScalar fRadius; SkString fName; @@ -70,7 +70,7 @@ protected: virtual void makeBlurryRect(const SkRect&) = 0; virtual void preBenchSetup(const SkRect&) {} private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; diff --git a/bench/BlurRoundRectBench.cpp b/bench/BlurRoundRectBench.cpp index 43391bf57c..52de22a4dc 100644 --- a/bench/BlurRoundRectBench.cpp +++ b/bench/BlurRoundRectBench.cpp @@ -5,7 +5,7 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkBlurMask.h" #include "SkBlurMaskFilter.h" #include "SkCanvas.h" @@ -14,14 +14,14 @@ #include "SkPaint.h" #include "SkPath.h" #include "SkPoint.h" -#include "SkRect.h" #include "SkRRect.h" +#include "SkRect.h" #include "SkString.h" #include "SkXfermode.h" // Large blurred RR appear frequently on web pages. This benchmark measures our // performance in this case. -class BlurRoundRectBench : public SkBenchmark { +class BlurRoundRectBench : public Benchmark { public: BlurRoundRectBench(int width, int height, int cornerRadius) : fName("blurroundrect") { @@ -81,7 +81,7 @@ private: SkString fName; SkRRect fRRect; - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; // Create one with dimensions/rounded corners based on the skp diff --git a/bench/ChartBench.cpp b/bench/ChartBench.cpp index 9dae5b8070..f33d2da398 100644 --- a/bench/ChartBench.cpp +++ b/bench/ChartBench.cpp @@ -5,7 +5,7 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkCanvas.h" #include "SkPaint.h" #include "SkRandom.h" @@ -84,7 +84,7 @@ static void gen_paths(const SkTDArray& topData, // A set of scrolling line plots with the area between each plot filled. Stresses out GPU path // filling -class ChartBench : public SkBenchmark { +class ChartBench : public Benchmark { public: ChartBench(bool aa) { fShift = 0; @@ -183,7 +183,7 @@ private: SkTDArray fData[kNumGraphs]; bool fAA; - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; ////////////////////////////////////////////////////////////////////////////// diff --git a/bench/ChecksumBench.cpp b/bench/ChecksumBench.cpp index 898c411641..7d3ec9ff9f 100644 --- a/bench/ChecksumBench.cpp +++ b/bench/ChecksumBench.cpp @@ -4,7 +4,7 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkCanvas.h" #include "SkChecksum.h" #include "SkMD5.h" @@ -19,7 +19,7 @@ enum ChecksumType { kMurmur3_ChecksumType, }; -class ComputeChecksumBench : public SkBenchmark { +class ComputeChecksumBench : public Benchmark { enum { U32COUNT = 256, SIZE = U32COUNT * 4, @@ -86,7 +86,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; /////////////////////////////////////////////////////////////////////////////// diff --git a/bench/ChromeBench.cpp b/bench/ChromeBench.cpp index b2fc185f20..493878526a 100644 --- a/bench/ChromeBench.cpp +++ b/bench/ChromeBench.cpp @@ -4,7 +4,7 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkCanvas.h" #include "SkPaint.h" #include "SkString.h" @@ -449,7 +449,7 @@ int gmailScrollingRectSpec [431*3] = { }; /// Emulates the mix of rects blitted by gmail during scrolling -class ScrollGmailBench : public SkBenchmark { +class ScrollGmailBench : public Benchmark { enum { W = 1254, H = 1160, @@ -488,7 +488,7 @@ protected: private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; // Disabled this benchmark: it takes 15x longer than any other benchmark diff --git a/bench/CmapBench.cpp b/bench/CmapBench.cpp index fcf40be88a..db4ed74951 100644 --- a/bench/CmapBench.cpp +++ b/bench/CmapBench.cpp @@ -5,7 +5,7 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkCanvas.h" #include "SkPaint.h" #include "SkTypeface.h" @@ -62,7 +62,7 @@ static void charsToGlyphsNull_proc(int loops, const SkPaint& paint, const void* } } -class CMAPBench : public SkBenchmark { +class CMAPBench : public Benchmark { TypefaceProc fProc; SkString fName; char fText[NGLYPHS]; @@ -91,7 +91,7 @@ protected: private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; ////////////////////////////////////////////////////////////////////////////// diff --git a/bench/ColorFilterBench.cpp b/bench/ColorFilterBench.cpp index 3d9515477c..7eae21aa75 100644 --- a/bench/ColorFilterBench.cpp +++ b/bench/ColorFilterBench.cpp @@ -4,7 +4,7 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkCanvas.h" #include "SkColorFilterImageFilter.h" #include "SkColorMatrixFilter.h" @@ -16,7 +16,7 @@ #define FILTER_WIDTH_LARGE SkIntToScalar(256) #define FILTER_HEIGHT_LARGE SkIntToScalar(256) -class ColorFilterBaseBench : public SkBenchmark { +class ColorFilterBaseBench : public Benchmark { public: ColorFilterBaseBench(bool small) : fIsSmall(small) { } @@ -58,7 +58,7 @@ protected: private: bool fIsSmall; - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; class ColorFilterDimBrightBench : public ColorFilterBaseBench { diff --git a/bench/ColorPrivBench.cpp b/bench/ColorPrivBench.cpp index 9c15a8400c..01810ed239 100644 --- a/bench/ColorPrivBench.cpp +++ b/bench/ColorPrivBench.cpp @@ -1,10 +1,10 @@ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkColorPriv.h" #include "SkRandom.h" #include "SkString.h" template -class FourByteInterpBench : public SkBenchmark { +class FourByteInterpBench : public Benchmark { public: FourByteInterpBench() { fName.set("four_byte_interp"); diff --git a/bench/CoverageBench.cpp b/bench/CoverageBench.cpp index 0631c179ac..ecb0ee6fa7 100644 --- a/bench/CoverageBench.cpp +++ b/bench/CoverageBench.cpp @@ -5,7 +5,7 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkBitmap.h" #include "SkCanvas.h" #include "SkColorPriv.h" @@ -14,7 +14,7 @@ #include "SkPath.h" #include "SkRasterClip.h" -class DrawPathBench : public SkBenchmark { +class DrawPathBench : public Benchmark { SkPaint fPaint; SkString fName; SkPath fPath; @@ -61,7 +61,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; /////////////////////////////////////////////////////////////////////////////// diff --git a/bench/DashBench.cpp b/bench/DashBench.cpp index bbe9512245..f4d09c66f2 100644 --- a/bench/DashBench.cpp +++ b/bench/DashBench.cpp @@ -5,7 +5,7 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkBitmap.h" #include "SkCanvas.h" #include "SkDashPathEffect.h" @@ -29,7 +29,7 @@ static void path_hline(SkPath* path) { path->lineTo(SkIntToScalar(600), SkIntToScalar(10)); } -class DashBench : public SkBenchmark { +class DashBench : public Benchmark { protected: SkString fName; SkTDArray fIntervals; @@ -94,7 +94,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; class RectDashBench : public DashBench { @@ -175,7 +175,7 @@ static void make_cubic(SkPath* path) { x0 + 600 * SK_Scalar1, y0); } -class MakeDashBench : public SkBenchmark { +class MakeDashBench : public Benchmark { SkString fName; SkPath fPath; SkAutoTUnref fPE; @@ -205,13 +205,13 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; /* * We try to special case square dashes (intervals are equal to strokewidth). */ -class DashLineBench : public SkBenchmark { +class DashLineBench : public Benchmark { SkString fName; SkScalar fStrokeWidth; bool fIsRound; @@ -245,10 +245,10 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; -class DrawPointsDashingBench : public SkBenchmark { +class DrawPointsDashingBench : public Benchmark { SkString fName; int fStrokeWidth; bool fDoAA; @@ -292,11 +292,11 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; // Want to test how we handle dashing when 99% of the dash is clipped out -class GiantDashBench : public SkBenchmark { +class GiantDashBench : public Benchmark { SkString fName; SkScalar fStrokeWidth; SkPoint fPts[2]; @@ -370,12 +370,12 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; // Want to test how we draw a dashed grid (like what is used in spreadsheets) of many // small dashed lines switching back and forth between horizontal and vertical -class DashGridBench : public SkBenchmark { +class DashGridBench : public Benchmark { SkString fName; int fStrokeWidth; bool fDoAA; @@ -437,7 +437,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; /////////////////////////////////////////////////////////////////////////////// diff --git a/bench/DecodeBench.cpp b/bench/DecodeBench.cpp index 15a80b1b5c..a4717f8eb7 100644 --- a/bench/DecodeBench.cpp +++ b/bench/DecodeBench.cpp @@ -5,7 +5,7 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkBitmap.h" #include "SkCommandLineFlags.h" #include "SkImageDecoder.h" @@ -15,7 +15,7 @@ DEFINE_string(decodeBenchFilename, "resources/CMYK.jpeg", "Path to image for DecodeBench."); -class DecodeBench : public SkBenchmark { +class DecodeBench : public Benchmark { const SkColorType fPrefColorType; SkString fName; public: @@ -42,7 +42,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; DEF_BENCH( return new DecodeBench(kN32_SkColorType); ) diff --git a/bench/DeferredCanvasBench.cpp b/bench/DeferredCanvasBench.cpp index 6ffd2d2327..667895c22f 100644 --- a/bench/DeferredCanvasBench.cpp +++ b/bench/DeferredCanvasBench.cpp @@ -4,12 +4,12 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkDeferredCanvas.h" #include "SkDevice.h" #include "SkString.h" -class DeferredCanvasBench : public SkBenchmark { +class DeferredCanvasBench : public Benchmark { public: DeferredCanvasBench(const char name[]) { fName.printf("deferred_canvas_%s", name); @@ -46,7 +46,7 @@ protected: SkString fName; private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; class SimpleNotificationClient : public SkDeferredCanvas::NotificationClient { diff --git a/bench/DeferredSurfaceCopyBench.cpp b/bench/DeferredSurfaceCopyBench.cpp index 6449b611bd..f4002b87be 100644 --- a/bench/DeferredSurfaceCopyBench.cpp +++ b/bench/DeferredSurfaceCopyBench.cpp @@ -6,7 +6,7 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkDeferredCanvas.h" #include "SkDevice.h" #include "SkImage.h" @@ -15,7 +15,7 @@ #include "GrRenderTarget.h" #endif -class DeferredSurfaceCopyBench : public SkBenchmark { +class DeferredSurfaceCopyBench : public Benchmark { enum { kSurfaceWidth = 1000, kSurfaceHeight = 1000, @@ -73,7 +73,7 @@ protected: private: bool fDiscardableContents; - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; ////////////////////////////////////////////////////////////////////////////// diff --git a/bench/DisplacementBench.cpp b/bench/DisplacementBench.cpp index 904f47d842..881ba33b24 100644 --- a/bench/DisplacementBench.cpp +++ b/bench/DisplacementBench.cpp @@ -4,7 +4,7 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkBitmapDevice.h" #include "SkBitmapSource.h" #include "SkCanvas.h" @@ -15,7 +15,7 @@ #define FILTER_WIDTH_LARGE 256 #define FILTER_HEIGHT_LARGE 256 -class DisplacementBaseBench : public SkBenchmark { +class DisplacementBaseBench : public Benchmark { public: DisplacementBaseBench(bool small) : fInitialized(false), fIsSmall(small) { @@ -82,7 +82,7 @@ protected: private: bool fInitialized; bool fIsSmall; - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; class DisplacementZeroBench : public DisplacementBaseBench { diff --git a/bench/ETCBitmapBench.cpp b/bench/ETCBitmapBench.cpp index d5f32db3e0..aaa2ce7a66 100644 --- a/bench/ETCBitmapBench.cpp +++ b/bench/ETCBitmapBench.cpp @@ -5,8 +5,8 @@ * found in the LICENSE file. */ +#include "Benchmark.h" #include "Resources.h" -#include "SkBenchmark.h" #include "SkCanvas.h" #include "SkData.h" #include "SkDecodingImageGenerator.h" @@ -77,7 +77,7 @@ static etc1_byte* create_expanded_etc1_bitmap(const uint8_t* orig, int factor) { // the ETC1 benches should all be working on the same data. Due to the // simplicity of the PKM file, that data is the 128x128 mandrill etc1 // compressed texture repeated by some factor (currently 8 -> 1024x1024) -class ETCBitmapBenchBase : public SkBenchmark { +class ETCBitmapBenchBase : public Benchmark { public: ETCBitmapBenchBase() : fPKMData(loadPKM()) { if (NULL == fPKMData) { @@ -115,7 +115,7 @@ private: return SkData::NewFromMalloc(expandedETC1, dataSz); } - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; // This is the rendering benchmark. Prior to rendering the data, create a @@ -220,16 +220,16 @@ private: typedef ETCBitmapBench INHERITED; }; -DEF_BENCH(return new ETCBitmapBench(false, SkBenchmark::kRaster_Backend);) -DEF_BENCH(return new ETCBitmapBench(true, SkBenchmark::kRaster_Backend);) +DEF_BENCH(return new ETCBitmapBench(false, Benchmark::kRaster_Backend);) +DEF_BENCH(return new ETCBitmapBench(true, Benchmark::kRaster_Backend);) -DEF_BENCH(return new ETCBitmapBench(false, SkBenchmark::kGPU_Backend);) -DEF_BENCH(return new ETCBitmapBench(true, SkBenchmark::kGPU_Backend);) +DEF_BENCH(return new ETCBitmapBench(false, Benchmark::kGPU_Backend);) +DEF_BENCH(return new ETCBitmapBench(true, Benchmark::kGPU_Backend);) -DEF_BENCH(return new ETCBitmapUploadBench(false, SkBenchmark::kRaster_Backend);) -DEF_BENCH(return new ETCBitmapUploadBench(true, SkBenchmark::kRaster_Backend);) +DEF_BENCH(return new ETCBitmapUploadBench(false, Benchmark::kRaster_Backend);) +DEF_BENCH(return new ETCBitmapUploadBench(true, Benchmark::kRaster_Backend);) -DEF_BENCH(return new ETCBitmapUploadBench(false, SkBenchmark::kGPU_Backend);) -DEF_BENCH(return new ETCBitmapUploadBench(true, SkBenchmark::kGPU_Backend);) +DEF_BENCH(return new ETCBitmapUploadBench(false, Benchmark::kGPU_Backend);) +DEF_BENCH(return new ETCBitmapUploadBench(true, Benchmark::kGPU_Backend);) #endif // SK_IGNORE_ETC1_SUPPORT diff --git a/bench/FSRectBench.cpp b/bench/FSRectBench.cpp index ea65f30eee..3c5304294d 100644 --- a/bench/FSRectBench.cpp +++ b/bench/FSRectBench.cpp @@ -6,7 +6,7 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkCanvas.h" #include "SkPaint.h" #include "SkRandom.h" @@ -15,7 +15,7 @@ * Draws full screen opaque rectangles. It is designed to test any optimizations in the GPU backend * to turn such draws into clears. */ -class FSRectBench : public SkBenchmark { +class FSRectBench : public Benchmark { public: FSRectBench() : fInit(false) { } @@ -57,7 +57,7 @@ private: SkColor fColors[N]; bool fInit; - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; DEF_BENCH( return SkNEW_ARGS(FSRectBench, ()); ) diff --git a/bench/FontCacheBench.cpp b/bench/FontCacheBench.cpp index a3c0672ef4..0e75c9cb17 100644 --- a/bench/FontCacheBench.cpp +++ b/bench/FontCacheBench.cpp @@ -5,7 +5,7 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkCanvas.h" #include "SkFontHost.h" #include "SkPaint.h" @@ -23,7 +23,7 @@ static int count_glyphs(const uint16_t start[]) { return static_cast(curr - start); } -class FontCacheBench : public SkBenchmark { +class FontCacheBench : public Benchmark { public: FontCacheBench() {} @@ -48,7 +48,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; /////////////////////////////////////////////////////////////////////////////// @@ -107,7 +107,7 @@ static void dump_array(const uint16_t array[], int count) { SkDebugf("\n"); } -class FontCacheEfficiency : public SkBenchmark { +class FontCacheEfficiency : public Benchmark { public: FontCacheEfficiency() { if (false) dump_array(NULL, 0); @@ -147,7 +147,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; /////////////////////////////////////////////////////////////////////////////// diff --git a/bench/FontScalerBench.cpp b/bench/FontScalerBench.cpp index a14723c0ff..0326a0cce6 100644 --- a/bench/FontScalerBench.cpp +++ b/bench/FontScalerBench.cpp @@ -5,14 +5,14 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkCanvas.h" #include "SkGraphics.h" #include "SkPaint.h" #include "SkRandom.h" #include "SkString.h" -class FontScalerBench : public SkBenchmark { +class FontScalerBench : public Benchmark { SkString fName; SkString fText; bool fDoLCD; @@ -43,7 +43,7 @@ protected: } } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; /////////////////////////////////////////////////////////////////////////////// diff --git a/bench/GMBench.cpp b/bench/GMBench.cpp new file mode 100644 index 0000000000..41a8e8c5f4 --- /dev/null +++ b/bench/GMBench.cpp @@ -0,0 +1,51 @@ +/* + * Copyright 2014 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "GMBench.h" + +GMBench::GMBench(skiagm::GM* gm) : fGM(gm) { + fName.printf("GM:%s", gm->getName()); +} + +GMBench::~GMBench() { delete fGM; } + +const char* GMBench::onGetName() { + return fName.c_str(); +} + +bool GMBench::isSuitableFor(Backend backend) { + uint32_t flags = fGM->getFlags(); + switch (backend) { + case kGPU_Backend: + return !(skiagm::GM::kSkipGPU_Flag & flags); + case kPDF_Backend: + return !(skiagm::GM::kSkipPDF_Flag & flags); + case kRaster_Backend: + // GM doesn't have an equivalent flag. If the GM has known issues with 565 then + // we skip it for ALL raster configs in bench. + return !(skiagm::GM::kSkip565_Flag & flags); + case kNonRendering_Backend: + return false; + default: + SkDEBUGFAIL("Unexpected backend type."); + return false; + } +} + +void GMBench::onDraw(const int loops, SkCanvas* canvas) { + // Do we care about timing the draw of the background (once)? + // Does the GM ever rely on drawBackground to lazily compute something? + fGM->drawBackground(canvas); + for (int i = 0; i < loops; ++i) { + fGM->drawContent(canvas); + } +} + +SkIPoint GMBench::onGetSize() { + SkISize size = fGM->getISize(); + return SkIPoint::Make(size.fWidth, size.fHeight); +} diff --git a/bench/GMBench.h b/bench/GMBench.h new file mode 100644 index 0000000000..75cee6c063 --- /dev/null +++ b/bench/GMBench.h @@ -0,0 +1,31 @@ +/* + * Copyright 2014 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "Benchmark.h" +#include "SkCanvas.h" +#include "gm.h" + +/** + * Runs a GM as a benchmark by repeatedly drawing the GM. + */ +class GMBench : public Benchmark { +public: + // Constructor takes ownership of the GM param. + GMBench(skiagm::GM* gm); + virtual ~GMBench(); + +protected: + virtual const char* onGetName() SK_OVERRIDE; + virtual bool isSuitableFor(Backend backend) SK_OVERRIDE; + virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE; + virtual SkIPoint onGetSize() SK_OVERRIDE; + +private: + skiagm::GM* fGM; + SkString fName; + typedef Benchmark INHERITED; +}; diff --git a/bench/GameBench.cpp b/bench/GameBench.cpp index d197f3e170..c37f46df30 100644 --- a/bench/GameBench.cpp +++ b/bench/GameBench.cpp @@ -5,7 +5,7 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkCanvas.h" #include "SkPaint.h" #include "SkRandom.h" @@ -14,7 +14,7 @@ // This bench simulates the calls Skia sees from various HTML5 canvas // game bench marks -class GameBench : public SkBenchmark { +class GameBench : public Benchmark { public: enum Type { kScale_Type, @@ -304,7 +304,7 @@ private: } } - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; // Partial clear diff --git a/bench/GrMemoryPoolBench.cpp b/bench/GrMemoryPoolBench.cpp index 96526e5fc2..6e6a37e76c 100644 --- a/bench/GrMemoryPoolBench.cpp +++ b/bench/GrMemoryPoolBench.cpp @@ -8,8 +8,8 @@ // This tests a Gr class #if SK_SUPPORT_GPU +#include "Benchmark.h" #include "GrMemoryPool.h" -#include "SkBenchmark.h" #include "SkRandom.h" #include "SkTDArray.h" #include "SkTemplates.h" @@ -30,7 +30,7 @@ GrMemoryPool A::gBenchPool(10 * (1 << 10), 10 * (1 << 10)); /** * This benchmark creates and deletes objects in stack order */ -class GrMemoryPoolBenchStack : public SkBenchmark { +class GrMemoryPoolBenchStack : public Benchmark { public: virtual bool isSuitableFor(Backend backend) SK_OVERRIDE { return backend == kNonRendering_Backend; @@ -76,7 +76,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; struct B { @@ -92,7 +92,7 @@ GrMemoryPool B::gBenchPool(10 * (1 << 10), 10 * (1 << 10)); /** * This benchmark creates objects and deletes them in random order */ -class GrMemoryPoolBenchRandom : public SkBenchmark { +class GrMemoryPoolBenchRandom : public Benchmark { public: virtual bool isSuitableFor(Backend backend) SK_OVERRIDE { return backend == kNonRendering_Backend; @@ -121,7 +121,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; struct C { @@ -137,7 +137,7 @@ GrMemoryPool C::gBenchPool(10 * (1 << 10), 10 * (1 << 10)); /** * This benchmark creates objects and deletes them in queue order */ -class GrMemoryPoolBenchQueue : public SkBenchmark { +class GrMemoryPoolBenchQueue : public Benchmark { enum { M = 4 * (1 << 10), }; @@ -166,7 +166,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; /////////////////////////////////////////////////////////////////////////////// diff --git a/bench/GrOrderedSetBench.cpp b/bench/GrOrderedSetBench.cpp index 4d32f0dc04..dde1c4a3f0 100644 --- a/bench/GrOrderedSetBench.cpp +++ b/bench/GrOrderedSetBench.cpp @@ -5,7 +5,7 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkCanvas.h" #include "SkRandom.h" #include "SkString.h" @@ -15,7 +15,7 @@ static const int NUM_ELEMENTS = 1000; // Time how long it takes to build a set -class GrOrderedSetBuildBench : public SkBenchmark { +class GrOrderedSetBuildBench : public Benchmark { public: GrOrderedSetBuildBench() { fName.append("ordered_set_build"); @@ -52,11 +52,11 @@ protected: private: SkString fName; int fData[NUM_ELEMENTS]; - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; // Time how long it takes to find elements in a set -class GrOrderedSetFindBench : public SkBenchmark { +class GrOrderedSetFindBench : public Benchmark { public: GrOrderedSetFindBench() { fName.append("ordered_set_find"); @@ -93,11 +93,11 @@ private: SkString fName; int fData[NUM_ELEMENTS]; GrOrderedSet fSet; - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; // Time how long it takes to iterate over and remove all elements from set -class GrOrderedSetRemoveBench : public SkBenchmark { +class GrOrderedSetRemoveBench : public Benchmark { public: GrOrderedSetRemoveBench() { fName.append("ordered_set_remove"); @@ -137,7 +137,7 @@ protected: private: SkString fName; GrOrderedSet fSet; - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; /////////////////////////////////////////////////////////////////////////////// diff --git a/bench/GrResourceCacheBench.cpp b/bench/GrResourceCacheBench.cpp index b2a5d1e718..93ae356a4c 100644 --- a/bench/GrResourceCacheBench.cpp +++ b/bench/GrResourceCacheBench.cpp @@ -8,12 +8,12 @@ #if SK_SUPPORT_GPU -#include "GrContext.h" +#include "Benchmark.h" #include "GrCacheable.h" +#include "GrContext.h" #include "GrResourceCache.h" #include "GrStencilBuffer.h" #include "GrTexture.h" -#include "SkBenchmark.h" #include "SkCanvas.h" enum { @@ -164,7 +164,7 @@ static void check_cache_contents_or_die(GrResourceCache* cache, int k) { } } -class GrResourceCacheBenchAdd : public SkBenchmark { +class GrResourceCacheBenchAdd : public Benchmark { enum { RESOURCE_COUNT = CACHE_SIZE_COUNT / 2, DUPLICATE_COUNT = CACHE_SIZE_COUNT / 4, @@ -197,10 +197,10 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; -class GrResourceCacheBenchFind : public SkBenchmark { +class GrResourceCacheBenchFind : public Benchmark { enum { RESOURCE_COUNT = (CACHE_SIZE_COUNT / 2) - 100, DUPLICATE_COUNT = 100 @@ -230,7 +230,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; DEF_BENCH( return new GrResourceCacheBenchAdd(); ) diff --git a/bench/GradientBench.cpp b/bench/GradientBench.cpp index fa07bce4fd..90d45c812c 100644 --- a/bench/GradientBench.cpp +++ b/bench/GradientBench.cpp @@ -5,7 +5,7 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkBitmap.h" #include "SkCanvas.h" #include "SkColorPriv.h" @@ -197,7 +197,7 @@ static const char* geomtypename(GeomType gt) { /////////////////////////////////////////////////////////////////////////////// -class GradientBench : public SkBenchmark { +class GradientBench : public Benchmark { SkString fName; SkShader* fShader; enum { @@ -262,7 +262,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; GeomType fGeomType; }; @@ -306,7 +306,7 @@ DEF_BENCH( return new GradientBench(kConicalOutZero_GradType, gGradData[2]); ) /////////////////////////////////////////////////////////////////////////////// -class Gradient2Bench : public SkBenchmark { +class Gradient2Bench : public Benchmark { SkString fName; bool fHasAlpha; @@ -347,7 +347,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; DEF_BENCH( return new Gradient2Bench(false); ) diff --git a/bench/HairlinePathBench.cpp b/bench/HairlinePathBench.cpp index 11faff57f8..e7e2b428e8 100644 --- a/bench/HairlinePathBench.cpp +++ b/bench/HairlinePathBench.cpp @@ -5,7 +5,7 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkCanvas.h" #include "SkPaint.h" #include "SkRandom.h" @@ -13,8 +13,8 @@ #include "SkString.h" #if SK_SUPPORT_GPU -#include "GrTest.h" #include "GrDrawTargetCaps.h" +#include "GrTest.h" #endif enum Flags { @@ -36,7 +36,7 @@ static const int points[] = { static const int kMaxPathSize = 10; -class HairlinePathBench : public SkBenchmark { +class HairlinePathBench : public Benchmark { public: HairlinePathBench(Flags flags) : fFlags(flags) { fPaint.setStyle(SkPaint::kStroke_Style); @@ -78,7 +78,7 @@ private: SkPaint fPaint; SkString fName; Flags fFlags; - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; class LinePathBench : public HairlinePathBench { diff --git a/bench/ImageCacheBench.cpp b/bench/ImageCacheBench.cpp index ef29cf88ff..5f1715fc31 100644 --- a/bench/ImageCacheBench.cpp +++ b/bench/ImageCacheBench.cpp @@ -5,10 +5,10 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkScaledImageCache.h" -class ImageCacheBench : public SkBenchmark { +class ImageCacheBench : public Benchmark { SkScaledImageCache fCache; SkBitmap fBM; @@ -49,7 +49,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; /////////////////////////////////////////////////////////////////////////////// diff --git a/bench/ImageDecodeBench.cpp b/bench/ImageDecodeBench.cpp index a2ca0ecaec..47993cfa7d 100644 --- a/bench/ImageDecodeBench.cpp +++ b/bench/ImageDecodeBench.cpp @@ -5,7 +5,7 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkBitmap.h" #include "SkData.h" #include "SkForceLinking.h" @@ -18,7 +18,7 @@ __SK_FORCE_IMAGE_DECODER_LINKING; class SkCanvas; -class ImageDecodeBench : public SkBenchmark { +class ImageDecodeBench : public Benchmark { public: ImageDecodeBench(void* p, const char* filename) : fName("image_decode_") @@ -85,7 +85,7 @@ private: SkMemoryStream fStream; bool fValid; - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; // These are files which call decodePalette diff --git a/bench/ImageFilterDAGBench.cpp b/bench/ImageFilterDAGBench.cpp index e6a3169507..29d1da1a61 100644 --- a/bench/ImageFilterDAGBench.cpp +++ b/bench/ImageFilterDAGBench.cpp @@ -5,10 +5,10 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkBlurImageFilter.h" -#include "SkMergeImageFilter.h" #include "SkCanvas.h" +#include "SkMergeImageFilter.h" enum { kNumInputs = 5 }; @@ -16,7 +16,7 @@ enum { kNumInputs = 5 }; // This bench shows an improvement in performance once cacheing of re-used // nodes is implemented, since the DAG is no longer flattened to a tree. -class ImageFilterDAGBench : public SkBenchmark { +class ImageFilterDAGBench : public Benchmark { public: ImageFilterDAGBench() { } @@ -40,7 +40,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; DEF_BENCH(return new ImageFilterDAGBench;) diff --git a/bench/InterpBench.cpp b/bench/InterpBench.cpp index f6f70d44c8..b19af8f35f 100644 --- a/bench/InterpBench.cpp +++ b/bench/InterpBench.cpp @@ -1,13 +1,13 @@ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkColorPriv.h" #include "SkMatrix.h" +#include "SkPaint.h" #include "SkRandom.h" #include "SkString.h" -#include "SkPaint.h" #define TILE(x, width) (((x) & 0xFFFF) * width >> 16) -class InterpBench : public SkBenchmark { +class InterpBench : public Benchmark { enum { kBuffer = 128, kLoop = 20000 @@ -43,7 +43,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; class Fixed16D16Interp : public InterpBench { diff --git a/bench/LightingBench.cpp b/bench/LightingBench.cpp index 4529041a78..4d234b951f 100644 --- a/bench/LightingBench.cpp +++ b/bench/LightingBench.cpp @@ -4,7 +4,7 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkBitmapSource.h" #include "SkCanvas.h" #include "SkDevice.h" @@ -15,7 +15,7 @@ #define FILTER_WIDTH_LARGE SkIntToScalar(256) #define FILTER_HEIGHT_LARGE SkIntToScalar(256) -class LightingBaseBench : public SkBenchmark { +class LightingBaseBench : public Benchmark { public: LightingBaseBench(bool small) : fIsSmall(small) { } @@ -92,7 +92,7 @@ protected: } bool fIsSmall; - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; class LightingPointLitDiffuseBench : public LightingBaseBench { diff --git a/bench/LineBench.cpp b/bench/LineBench.cpp index dc57d9f165..bb6215b03f 100644 --- a/bench/LineBench.cpp +++ b/bench/LineBench.cpp @@ -5,7 +5,7 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkBitmap.h" #include "SkCanvas.h" #include "SkColorPriv.h" @@ -16,7 +16,7 @@ #include "SkTArray.h" -class LineBench : public SkBenchmark { +class LineBench : public Benchmark { SkScalar fStrokeWidth; bool fDoAA; SkString fName; @@ -56,7 +56,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; DEF_BENCH(return new LineBench(0, false);) diff --git a/bench/MagnifierBench.cpp b/bench/MagnifierBench.cpp index e4a51815d4..875ec4f465 100644 --- a/bench/MagnifierBench.cpp +++ b/bench/MagnifierBench.cpp @@ -4,7 +4,7 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkBitmapDevice.h" #include "SkCanvas.h" #include "SkMagnifierImageFilter.h" @@ -15,7 +15,7 @@ #define FILTER_WIDTH_LARGE 256 #define FILTER_HEIGHT_LARGE 256 -class MagnifierBench : public SkBenchmark { +class MagnifierBench : public Benchmark { public: MagnifierBench(bool small) : fIsSmall(small), fInitialized(false) { @@ -76,7 +76,7 @@ private: bool fIsSmall; bool fInitialized; SkBitmap fCheckerboard; - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; /////////////////////////////////////////////////////////////////////////////// diff --git a/bench/MathBench.cpp b/bench/MathBench.cpp index da65456822..dbd661f8d3 100644 --- a/bench/MathBench.cpp +++ b/bench/MathBench.cpp @@ -1,9 +1,9 @@ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkColorPriv.h" #include "SkMatrix.h" +#include "SkPaint.h" #include "SkRandom.h" #include "SkString.h" -#include "SkPaint.h" static float sk_fsel(float pred, float result_ge, float result_lt) { return pred >= 0 ? result_ge : result_lt; @@ -15,7 +15,7 @@ static float fast_floor(float x) { return (x + big) - big; } -class MathBench : public SkBenchmark { +class MathBench : public Benchmark { enum { kBuffer = 100, }; @@ -54,7 +54,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; class MathBenchU32 : public MathBench { @@ -262,7 +262,7 @@ static bool isFinite(const SkRect& r) { return value == value; } -class IsFiniteBench : public SkBenchmark { +class IsFiniteBench : public Benchmark { enum { N = 1000, }; @@ -328,10 +328,10 @@ private: IsFiniteProc fProc; const char* fName; - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; -class FloorBench : public SkBenchmark { +class FloorBench : public Benchmark { enum { ARRAY = 1000, }; @@ -389,10 +389,10 @@ protected: private: const char* fName; - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; -class CLZBench : public SkBenchmark { +class CLZBench : public Benchmark { enum { ARRAY = 1000, }; @@ -449,12 +449,12 @@ protected: private: const char* fName; - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; /////////////////////////////////////////////////////////////////////////////// -class NormalizeBench : public SkBenchmark { +class NormalizeBench : public Benchmark { enum { ARRAY =1000, }; @@ -496,12 +496,12 @@ protected: private: const char* fName; - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; /////////////////////////////////////////////////////////////////////////////// -class FixedMathBench : public SkBenchmark { +class FixedMathBench : public Benchmark { enum { N = 1000, }; @@ -540,13 +540,13 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; /////////////////////////////////////////////////////////////////////////////// template -class DivModBench : public SkBenchmark { +class DivModBench : public Benchmark { SkString fName; public: explicit DivModBench(const char* name) { diff --git a/bench/Matrix44Bench.cpp b/bench/Matrix44Bench.cpp index 55f377cb03..8a7c50e606 100644 --- a/bench/Matrix44Bench.cpp +++ b/bench/Matrix44Bench.cpp @@ -5,12 +5,12 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkMatrix44.h" #include "SkRandom.h" #include "SkString.h" -class Matrix44Bench : public SkBenchmark { +class Matrix44Bench : public Benchmark { SkString fName; public: Matrix44Bench(const char name[]) { @@ -37,7 +37,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; class EqualsMatrix44Bench : public Matrix44Bench { diff --git a/bench/MatrixBench.cpp b/bench/MatrixBench.cpp index fa19fc8157..78482d963d 100644 --- a/bench/MatrixBench.cpp +++ b/bench/MatrixBench.cpp @@ -5,13 +5,13 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkMatrix.h" #include "SkMatrixUtils.h" #include "SkRandom.h" #include "SkString.h" -class MatrixBench : public SkBenchmark { +class MatrixBench : public Benchmark { SkString fName; public: MatrixBench(const char name[]) { @@ -38,7 +38,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; diff --git a/bench/MatrixConvolutionBench.cpp b/bench/MatrixConvolutionBench.cpp index 77910c90a9..6593ab0259 100644 --- a/bench/MatrixConvolutionBench.cpp +++ b/bench/MatrixConvolutionBench.cpp @@ -4,14 +4,14 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkCanvas.h" +#include "SkMatrixConvolutionImageFilter.h" #include "SkPaint.h" #include "SkRandom.h" #include "SkString.h" -#include "SkMatrixConvolutionImageFilter.h" -class MatrixConvolutionBench : public SkBenchmark { +class MatrixConvolutionBench : public Benchmark { public: MatrixConvolutionBench(SkMatrixConvolutionImageFilter::TileMode tileMode, bool convolveAlpha) : fName("matrixconvolution") { @@ -49,7 +49,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; SkMatrixConvolutionImageFilter* fFilter; SkString fName; }; diff --git a/bench/MemcpyBench.cpp b/bench/MemcpyBench.cpp index 3fd6dcbcfb..f550192751 100644 --- a/bench/MemcpyBench.cpp +++ b/bench/MemcpyBench.cpp @@ -5,13 +5,13 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkRandom.h" #include "SkTemplates.h" #include "SkUtils.h" template -class Memcpy32Bench : public SkBenchmark { +class Memcpy32Bench : public Benchmark { public: explicit Memcpy32Bench(int count, Memcpy32 memcpy32, const char* name) : fCount(count) diff --git a/bench/MemoryBench.cpp b/bench/MemoryBench.cpp index 19919ab635..3fc46dccf4 100644 --- a/bench/MemoryBench.cpp +++ b/bench/MemoryBench.cpp @@ -5,14 +5,14 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkCanvas.h" +#include "SkChunkAlloc.h" #include "SkPaint.h" #include "SkRandom.h" -#include "SkChunkAlloc.h" #include "SkString.h" -class ChunkAllocBench : public SkBenchmark { +class ChunkAllocBench : public Benchmark { SkString fName; size_t fMinSize; public: @@ -50,7 +50,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; DEF_BENCH( return new ChunkAllocBench(64); ) @@ -67,7 +67,7 @@ static int* malloc_bzero(size_t num) { return ints; } -class ZerosBench : public SkBenchmark { +class ZerosBench : public Benchmark { size_t fNum; bool fRead; bool fWrite; diff --git a/bench/MemsetBench.cpp b/bench/MemsetBench.cpp index bfdff5cbcc..6a1bd24c84 100644 --- a/bench/MemsetBench.cpp +++ b/bench/MemsetBench.cpp @@ -5,12 +5,12 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkCanvas.h" -#include "SkUtils.h" #include "SkString.h" +#include "SkUtils.h" -class MemsetBench : public SkBenchmark { +class MemsetBench : public Benchmark { SkString fName; protected: @@ -54,7 +54,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; class Memset32Bench : public MemsetBench { diff --git a/bench/MergeBench.cpp b/bench/MergeBench.cpp index 9f16449a82..a6bb3acfb1 100644 --- a/bench/MergeBench.cpp +++ b/bench/MergeBench.cpp @@ -4,7 +4,7 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkBitmapDevice.h" #include "SkBitmapSource.h" #include "SkCanvas.h" @@ -15,7 +15,7 @@ #define FILTER_WIDTH_LARGE SkIntToScalar(256) #define FILTER_HEIGHT_LARGE SkIntToScalar(256) -class MergeBench : public SkBenchmark { +class MergeBench : public Benchmark { public: MergeBench(bool small) : fIsSmall(small), fInitialized(false) { } @@ -88,7 +88,7 @@ private: bool fInitialized; SkBitmap fBitmap, fCheckerboard; - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; /////////////////////////////////////////////////////////////////////////////// diff --git a/bench/MorphologyBench.cpp b/bench/MorphologyBench.cpp index a32bca620a..97995e8195 100644 --- a/bench/MorphologyBench.cpp +++ b/bench/MorphologyBench.cpp @@ -5,13 +5,13 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkCanvas.h" +#include "SkMorphologyImageFilter.h" #include "SkPaint.h" #include "SkRandom.h" #include "SkShader.h" #include "SkString.h" -#include "SkMorphologyImageFilter.h" #define SMALL SkIntToScalar(2) #define REAL 1.5f @@ -27,7 +27,7 @@ static const char* gStyleName[] = { "dilate" }; -class MorphologyBench : public SkBenchmark { +class MorphologyBench : public Benchmark { SkScalar fRadius; MorphologyType fStyle; SkString fName; @@ -81,7 +81,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; DEF_BENCH( return new MorphologyBench(SMALL, kErode_MT); ) diff --git a/bench/MutexBench.cpp b/bench/MutexBench.cpp index 3191ce17be..67648b5dec 100644 --- a/bench/MutexBench.cpp +++ b/bench/MutexBench.cpp @@ -4,10 +4,10 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkThread.h" -class MutexBench : public SkBenchmark { +class MutexBench : public Benchmark { public: virtual bool isSuitableFor(Backend backend) SK_OVERRIDE { return backend == kNonRendering_Backend; @@ -27,7 +27,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; /////////////////////////////////////////////////////////////////////////////// diff --git a/bench/PathBench.cpp b/bench/PathBench.cpp index 4b21ccf7f1..59b3bfa2ef 100644 --- a/bench/PathBench.cpp +++ b/bench/PathBench.cpp @@ -5,7 +5,7 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkBitmap.h" #include "SkCanvas.h" #include "SkColorPriv.h" @@ -25,7 +25,7 @@ enum Flags { #define FLAGS10 Flags(kBig_Flag) #define FLAGS11 Flags(kStroke_Flag | kBig_Flag) -class PathBench : public SkBenchmark { +class PathBench : public Benchmark { SkPaint fPaint; SkString fName; Flags fFlags; @@ -74,7 +74,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; class TrianglePathBench : public PathBench { @@ -214,7 +214,7 @@ private: typedef PathBench INHERITED; }; -class RandomPathBench : public SkBenchmark { +class RandomPathBench : public Benchmark { public: virtual bool isSuitableFor(Backend backend) SK_OVERRIDE { return backend == kNonRendering_Backend; @@ -312,7 +312,7 @@ private: int fCurrVerb; int fCurrPoint; SkRandom fRandom; - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; class PathCreateBench : public RandomPathBench { @@ -567,7 +567,7 @@ private: }; -class CirclesBench : public SkBenchmark { +class CirclesBench : public Benchmark { protected: SkString fName; Flags fFlags; @@ -619,7 +619,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; @@ -628,7 +628,7 @@ private: // Note: PathTest::test_arb_round_rect_is_convex and // test_arb_zero_rad_round_rect_is_rect perform almost exactly // the same test (but with no drawing) -class ArbRoundRectBench : public SkBenchmark { +class ArbRoundRectBench : public Benchmark { protected: SkString fName; @@ -723,10 +723,10 @@ protected: private: bool fZeroRad; // should 0 radius rounds rects be tested? - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; -class ConservativelyContainsBench : public SkBenchmark { +class ConservativelyContainsBench : public Benchmark { public: enum Type { kRect_Type, @@ -799,14 +799,14 @@ private: bool fParity; SkTDArray fQueryRects; - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; /////////////////////////////////////////////////////////////////////////////// #include "SkGeometry.h" -class ConicBench_Chop5 : public SkBenchmark { +class ConicBench_Chop5 : public Benchmark { SkConic fRQ; public: ConicBench_Chop5() { @@ -828,10 +828,10 @@ private: } } - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; -class ConicBench_ChopHalf : public SkBenchmark { +class ConicBench_ChopHalf : public Benchmark { SkConic fRQ; public: ConicBench_ChopHalf() { @@ -853,7 +853,7 @@ private: } } - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; /////////////////////////////////////////////////////////////////////////////// @@ -869,7 +869,7 @@ static void rand_conic(SkConic* conic, SkRandom& rand) { } } -class ConicBench : public SkBenchmark { +class ConicBench : public Benchmark { public: ConicBench() { SkRandom rand; @@ -889,7 +889,7 @@ protected: SkConic fConics[CONICS]; private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; class ConicBench_ComputeError : public ConicBench { diff --git a/bench/PathIterBench.cpp b/bench/PathIterBench.cpp index 4e956ce3a5..b82146d1b2 100644 --- a/bench/PathIterBench.cpp +++ b/bench/PathIterBench.cpp @@ -5,7 +5,7 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkBitmap.h" #include "SkCanvas.h" #include "SkColorPriv.h" @@ -25,7 +25,7 @@ static int rand_pts(SkRandom& rand, SkPoint pts[4]) { return n; } -class PathIterBench : public SkBenchmark { +class PathIterBench : public Benchmark { SkString fName; SkPath fPath; bool fRaw; @@ -86,7 +86,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; /////////////////////////////////////////////////////////////////////////////// diff --git a/bench/PathUtilsBench.cpp b/bench/PathUtilsBench.cpp index 4231b72fab..6c8086fb9d 100644 --- a/bench/PathUtilsBench.cpp +++ b/bench/PathUtilsBench.cpp @@ -4,12 +4,12 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkCanvas.h" #include "SkPathUtils.h" #include "SkRandom.h" -#include "SkTime.h" #include "SkString.h" +#include "SkTime.h" #define H 16 #define W 16 @@ -34,7 +34,7 @@ static void region_proc(char* bits, SkPath* path) { } /// Emulates the mix of rects blitted by gmail during scrolling -class PathUtilsBench : public SkBenchmark { +class PathUtilsBench : public Benchmark { typedef void (*Proc)(char*, SkPath*); Proc fProc; @@ -65,7 +65,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; DEF_BENCH( return SkNEW_ARGS(PathUtilsBench, (path_proc, "path")); ) diff --git a/bench/PerlinNoiseBench.cpp b/bench/PerlinNoiseBench.cpp index ff0baf35fc..560628f4fd 100644 --- a/bench/PerlinNoiseBench.cpp +++ b/bench/PerlinNoiseBench.cpp @@ -4,11 +4,11 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkCanvas.h" #include "SkPerlinNoiseShader.h" -class PerlinNoiseBench : public SkBenchmark { +class PerlinNoiseBench : public Benchmark { SkISize fSize; public: @@ -54,7 +54,7 @@ private: } } - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; /////////////////////////////////////////////////////////////////////////////// diff --git a/bench/PicturePlaybackBench.cpp b/bench/PicturePlaybackBench.cpp index 08c96d59b5..0109c720fc 100644 --- a/bench/PicturePlaybackBench.cpp +++ b/bench/PicturePlaybackBench.cpp @@ -4,7 +4,7 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkCanvas.h" #include "SkColor.h" #include "SkPaint.h" @@ -17,7 +17,7 @@ // This is designed to emulate about 4 screens of textual content -class PicturePlaybackBench : public SkBenchmark { +class PicturePlaybackBench : public Benchmark { public: PicturePlaybackBench(const char name[]) { fName.printf("picture_playback_%s", name); @@ -63,7 +63,7 @@ protected: SkScalar fPictureHeight; SkScalar fTextSize; private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; diff --git a/bench/PictureRecordBench.cpp b/bench/PictureRecordBench.cpp index f890e0d4f6..ef5361d20a 100644 --- a/bench/PictureRecordBench.cpp +++ b/bench/PictureRecordBench.cpp @@ -4,7 +4,7 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkCanvas.h" #include "SkColor.h" #include "SkPaint.h" @@ -15,7 +15,7 @@ #include "SkRect.h" #include "SkString.h" -class PictureRecordBench : public SkBenchmark { +class PictureRecordBench : public Benchmark { public: PictureRecordBench(const char name[]) { fName.printf("picture_record_%s", name); @@ -35,7 +35,7 @@ protected: } private: SkString fName; - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; diff --git a/bench/PremulAndUnpremulAlphaOpsBench.cpp b/bench/PremulAndUnpremulAlphaOpsBench.cpp index e937e14f17..311bdf2d47 100644 --- a/bench/PremulAndUnpremulAlphaOpsBench.cpp +++ b/bench/PremulAndUnpremulAlphaOpsBench.cpp @@ -5,13 +5,13 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkCanvas.h" #include "SkConfig8888.h" #include "SkString.h" #include "sk_tool_utils.h" -class PremulAndUnpremulAlphaOpsBench : public SkBenchmark { +class PremulAndUnpremulAlphaOpsBench : public Benchmark { enum { W = 256, H = 256, @@ -58,7 +58,7 @@ private: SkColorType fColorType; SkString fName; - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; diff --git a/bench/QuadTreeBench.cpp b/bench/QuadTreeBench.cpp index 3846ada307..79078a8ae9 100644 --- a/bench/QuadTreeBench.cpp +++ b/bench/QuadTreeBench.cpp @@ -5,7 +5,7 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkCanvas.h" #include "SkQuadTree.h" #include "SkRandom.h" @@ -22,7 +22,7 @@ static const SkIRect QUAD_TREE_BOUNDS = SkIRect::MakeLTRB( typedef SkIRect (*MakeRectProc)(SkRandom&, int, int); // Time how long it takes to build an QuadTree -class QuadTreeBuildBench : public SkBenchmark { +class QuadTreeBuildBench : public Benchmark { public: QuadTreeBuildBench(const char* name, MakeRectProc proc, SkBBoxHierarchy* tree) : fTree(tree) @@ -57,11 +57,11 @@ private: SkBBoxHierarchy* fTree; MakeRectProc fProc; SkString fName; - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; // Time how long it takes to perform queries on an QuadTree -class QuadTreeQueryBench : public SkBenchmark { +class QuadTreeQueryBench : public Benchmark { public: enum QueryType { kSmall_QueryType, // small queries @@ -141,7 +141,7 @@ private: MakeRectProc fProc; SkString fName; QueryType fQuery; - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; static inline SkIRect make_concentric_rects_increasing(SkRandom&, int index, int numRects) { diff --git a/bench/RTreeBench.cpp b/bench/RTreeBench.cpp index d8e6347379..95f55c9a8f 100644 --- a/bench/RTreeBench.cpp +++ b/bench/RTreeBench.cpp @@ -6,7 +6,7 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkCanvas.h" #include "SkRTree.h" #include "SkRandom.h" @@ -21,7 +21,7 @@ static const int GRID_WIDTH = 100; typedef SkIRect (*MakeRectProc)(SkRandom&, int, int); // Time how long it takes to build an R-Tree either bulk-loaded or not -class RTreeBuildBench : public SkBenchmark { +class RTreeBuildBench : public Benchmark { public: RTreeBuildBench(const char* name, MakeRectProc proc, bool bulkLoad, SkBBoxHierarchy* tree) @@ -63,11 +63,11 @@ private: MakeRectProc fProc; SkString fName; bool fBulkLoad; - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; // Time how long it takes to perform queries on an R-Tree, bulk-loaded or not -class RTreeQueryBench : public SkBenchmark { +class RTreeQueryBench : public Benchmark { public: enum QueryType { kSmall_QueryType, // small queries @@ -152,7 +152,7 @@ private: SkString fName; bool fBulkLoad; QueryType fQuery; - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; static inline SkIRect make_concentric_rects_increasing(SkRandom&, int index, int numRects) { diff --git a/bench/ReadPixBench.cpp b/bench/ReadPixBench.cpp index 805aaeb5f8..7848ebc757 100644 --- a/bench/ReadPixBench.cpp +++ b/bench/ReadPixBench.cpp @@ -6,7 +6,7 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkCanvas.h" @@ -15,7 +15,7 @@ * and then reads small chunks from it repeatedly. This can cause trouble * for the GPU as readbacks are very expensive. */ -class ReadPixBench : public SkBenchmark { +class ReadPixBench : public Benchmark { public: ReadPixBench() {} @@ -59,7 +59,7 @@ private: static const int kNumStepsY = 30; static const int kWindowSize = 5; - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; //////////////////////////////////////////////////////////////////////////////// diff --git a/bench/RectBench.cpp b/bench/RectBench.cpp index a2029e601f..f50324a580 100644 --- a/bench/RectBench.cpp +++ b/bench/RectBench.cpp @@ -5,7 +5,7 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkCanvas.h" #include "SkCommandLineFlags.h" #include "SkPaint.h" @@ -15,7 +15,7 @@ DEFINE_double(strokeWidth, -1.0, "If set, use this stroke width in RectBench."); -class RectBench : public SkBenchmark { +class RectBench : public Benchmark { public: int fShift, fStroke; enum { @@ -78,7 +78,7 @@ protected: } } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; class SrcModeRectBench : public RectBench { @@ -170,7 +170,7 @@ protected: virtual const char* onGetName() { return fName; } }; -class AARectBench : public SkBenchmark { +class AARectBench : public Benchmark { public: enum { W = 640, @@ -221,7 +221,7 @@ protected: } private: bool fRotate; - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; /******************************************************************************* diff --git a/bench/RectanizerBench.cpp b/bench/RectanizerBench.cpp index 99f10c0014..286b681d38 100644 --- a/bench/RectanizerBench.cpp +++ b/bench/RectanizerBench.cpp @@ -5,7 +5,7 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkRandom.h" #include "SkSize.h" #include "SkTDArray.h" @@ -25,7 +25,7 @@ * random power of two rects * small constant sized power of 2 rects (e.g., glyph cache use case) */ -class RectanizerBench : public SkBenchmark { +class RectanizerBench : public Benchmark { public: static const int kWidth = 1024; static const int kHeight = 1024; @@ -117,7 +117,7 @@ private: RectType fRectType; SkAutoTDelete fRectanizer; - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; ////////////////////////////////////////////////////////////////////////////// diff --git a/bench/RectoriBench.cpp b/bench/RectoriBench.cpp index 84af352a37..5c115115e3 100644 --- a/bench/RectoriBench.cpp +++ b/bench/RectoriBench.cpp @@ -5,16 +5,16 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" +#include "SkBlurMaskFilter.h" #include "SkCanvas.h" +#include "SkLayerDrawLooper.h" #include "SkPaint.h" #include "SkRandom.h" -#include "SkBlurMaskFilter.h" -#include "SkLayerDrawLooper.h" // This bench replicates a problematic use case of a draw looper used // to create an inner blurred rect -class RectoriBench : public SkBenchmark { +class RectoriBench : public Benchmark { public: RectoriBench() {} @@ -98,7 +98,7 @@ private: return looperBuilder.detachLooper(); } - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; DEF_BENCH( return SkNEW_ARGS(RectoriBench, ()); ) diff --git a/bench/RefCntBench.cpp b/bench/RefCntBench.cpp index b7a111bcb0..351513b831 100644 --- a/bench/RefCntBench.cpp +++ b/bench/RefCntBench.cpp @@ -4,17 +4,17 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include +#include "Benchmark.h" #include "SkRefCnt.h" #include "SkThread.h" #include "SkWeakRefCnt.h" -#include enum { M = 2 }; -class RefCntBench_Stack : public SkBenchmark { +class RefCntBench_Stack : public Benchmark { public: virtual bool isSuitableFor(Backend backend) SK_OVERRIDE { return backend == kNonRendering_Backend; @@ -36,7 +36,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; class PlacedRefCnt : public SkRefCnt { @@ -50,7 +50,7 @@ private: typedef SkRefCnt INHERITED; }; -class RefCntBench_Heap : public SkBenchmark { +class RefCntBench_Heap : public Benchmark { public: virtual bool isSuitableFor(Backend backend) SK_OVERRIDE { return backend == kNonRendering_Backend; @@ -74,10 +74,10 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; -class RefCntBench_New : public SkBenchmark { +class RefCntBench_New : public Benchmark { public: virtual bool isSuitableFor(Backend backend) SK_OVERRIDE { return backend == kNonRendering_Backend; @@ -100,12 +100,12 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; /////////////////////////////////////////////////////////////////////////////// -class WeakRefCntBench_Stack : public SkBenchmark { +class WeakRefCntBench_Stack : public Benchmark { public: virtual bool isSuitableFor(Backend backend) SK_OVERRIDE { return backend == kNonRendering_Backend; @@ -127,7 +127,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; class PlacedWeakRefCnt : public SkWeakRefCnt { @@ -136,7 +136,7 @@ public: void operator delete(void*) { } }; -class WeakRefCntBench_Heap : public SkBenchmark { +class WeakRefCntBench_Heap : public Benchmark { public: virtual bool isSuitableFor(Backend backend) SK_OVERRIDE { return backend == kNonRendering_Backend; @@ -160,10 +160,10 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; -class WeakRefCntBench_New : public SkBenchmark { +class WeakRefCntBench_New : public Benchmark { public: virtual bool isSuitableFor(Backend backend) SK_OVERRIDE { return backend == kNonRendering_Backend; @@ -186,7 +186,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; /////////////////////////////////////////////////////////////////////////////// diff --git a/bench/RegionBench.cpp b/bench/RegionBench.cpp index 21c10afd4e..b3722d4caa 100644 --- a/bench/RegionBench.cpp +++ b/bench/RegionBench.cpp @@ -5,7 +5,7 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkRandom.h" #include "SkRegion.h" #include "SkString.h" @@ -67,7 +67,7 @@ static bool containsxy_proc(SkRegion& a, SkRegion& b) { return true; } -class RegionBench : public SkBenchmark { +class RegionBench : public Benchmark { public: typedef bool (*Proc)(SkRegion& a, SkRegion& b); @@ -114,10 +114,10 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; -class RectSectBench : public SkBenchmark { +class RectSectBench : public Benchmark { enum { N = 1000 }; @@ -167,7 +167,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; /////////////////////////////////////////////////////////////////////////////// diff --git a/bench/RegionContainBench.cpp b/bench/RegionContainBench.cpp index 35ca46ff0f..a47ab3395f 100644 --- a/bench/RegionContainBench.cpp +++ b/bench/RegionContainBench.cpp @@ -5,7 +5,7 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkRandom.h" #include "SkRegion.h" #include "SkString.h" @@ -15,7 +15,7 @@ static bool sect_proc(SkRegion& a, SkRegion& b) { return result.op(a, b, SkRegion::kIntersect_Op); } -class RegionContainBench : public SkBenchmark { +class RegionContainBench : public Benchmark { public: typedef bool (*Proc)(SkRegion& a, SkRegion& b); SkRegion fA, fB; @@ -61,7 +61,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; DEF_BENCH( return SkNEW_ARGS(RegionContainBench, (sect_proc, "sect")); ) diff --git a/bench/RepeatTileBench.cpp b/bench/RepeatTileBench.cpp index 0e33ec0281..cf29b6a460 100644 --- a/bench/RepeatTileBench.cpp +++ b/bench/RepeatTileBench.cpp @@ -5,7 +5,7 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkBitmap.h" #include "SkCanvas.h" #include "SkColorPriv.h" @@ -81,7 +81,7 @@ static void convert_to_index666(const SkBitmap& src, SkBitmap* dst) { } } -class RepeatTileBench : public SkBenchmark { +class RepeatTileBench : public Benchmark { const SkColorType fColorType; const SkAlphaType fAlphaType; SkPaint fPaint; @@ -137,7 +137,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; DEF_BENCH(return new RepeatTileBench(kN32_SkColorType, kOpaque_SkAlphaType)) diff --git a/bench/ResultsWriter.h b/bench/ResultsWriter.h index e089d7fd07..ed10afa3ca 100644 --- a/bench/ResultsWriter.h +++ b/bench/ResultsWriter.h @@ -6,17 +6,17 @@ * * Classes for writing out bench results in various formats. */ + #ifndef SkResultsWriter_DEFINED #define SkResultsWriter_DEFINED -#include "SkBenchLogger.h" +#include "BenchLogger.h" #include "SkJSONCPP.h" #include "SkStream.h" #include "SkString.h" #include "SkTArray.h" #include "SkTypes.h" - /** * Base class for writing out the bench results. * @@ -50,7 +50,7 @@ public: */ class LoggerResultsWriter : public ResultsWriter { public: - explicit LoggerResultsWriter(SkBenchLogger& logger, const char* timeFormat) + explicit LoggerResultsWriter(BenchLogger& logger, const char* timeFormat) : fLogger(logger) , fTimeFormat(timeFormat) { fLogger.logProgress("skia bench:"); @@ -73,7 +73,7 @@ public: fLogger.logProgress("\n"); } private: - SkBenchLogger& fLogger; + BenchLogger& fLogger; const char* fTimeFormat; }; diff --git a/bench/ScalarBench.cpp b/bench/ScalarBench.cpp index 77849c6444..e09fa7533b 100644 --- a/bench/ScalarBench.cpp +++ b/bench/ScalarBench.cpp @@ -5,13 +5,13 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkFloatBits.h" #include "SkRandom.h" #include "SkRect.h" #include "SkString.h" -class ScalarBench : public SkBenchmark { +class ScalarBench : public Benchmark { SkString fName; public: ScalarBench(const char name[]) { @@ -38,7 +38,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; // having unknown values in our arrays can throw off the timing a lot, perhaps @@ -125,7 +125,7 @@ private: /////////////////////////////////////////////////////////////////////////////// -class RectBoundsBench : public SkBenchmark { +class RectBoundsBench : public Benchmark { enum { PTS = 100, }; @@ -157,7 +157,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; /////////////////////////////////////////////////////////////////////////////// diff --git a/bench/ShaderMaskBench.cpp b/bench/ShaderMaskBench.cpp index 7323d8ee7a..aa3dadff2f 100644 --- a/bench/ShaderMaskBench.cpp +++ b/bench/ShaderMaskBench.cpp @@ -5,7 +5,7 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkCanvas.h" #include "SkColorShader.h" #include "SkFontHost.h" @@ -32,7 +32,7 @@ static const char* fontQualityName(const SkPaint& paint) { return "AA"; } -class ShaderMaskBench : public SkBenchmark { +class ShaderMaskBench : public Benchmark { SkPaint fPaint; SkString fText; SkString fName; @@ -85,7 +85,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; /////////////////////////////////////////////////////////////////////////////// diff --git a/bench/SkBenchLogger.cpp b/bench/SkBenchLogger.cpp deleted file mode 100644 index 7cda32772c..0000000000 --- a/bench/SkBenchLogger.cpp +++ /dev/null @@ -1,30 +0,0 @@ - -/* - * Copyright 2012 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "SkBenchLogger.h" -#include "SkStream.h" - -SkBenchLogger::SkBenchLogger() -: fFileStream(NULL) {} - -SkBenchLogger::~SkBenchLogger() { - if (fFileStream) { - SkDELETE(fFileStream); - } -} - -bool SkBenchLogger::SetLogFile(const char *file) { - fFileStream = SkNEW_ARGS(SkFILEWStream, (file)); - return fFileStream->isValid(); -} - -void SkBenchLogger::fileWrite(const char msg[], size_t size) { - if (fFileStream && fFileStream->isValid()) { - fFileStream->write(msg, size); - } -} diff --git a/bench/SkBenchLogger.h b/bench/SkBenchLogger.h deleted file mode 100644 index 77a08373bf..0000000000 --- a/bench/SkBenchLogger.h +++ /dev/null @@ -1,77 +0,0 @@ - -/* - * 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 SkBenchLogger_DEFINED -#define SkBenchLogger_DEFINED - -#include "SkTypes.h" -#include "SkString.h" -#include - -class SkFILEWStream; - -/** - * Class that allows logging to a file while simultaneously logging to stdout/stderr. - */ -class SkBenchLogger { -public: - SkBenchLogger(); - - /** - * Not virtual, since this class is not intended to be subclassed. - */ - ~SkBenchLogger(); - - /** - * Specify a file to write progress logs to. Unless this is called with a valid file path, - * SkBenchLogger will only write to stdout/stderr. - */ - bool SetLogFile(const char file[]); - - /** - * Log an error to stderr, taking a C style string as input. - */ - void logError(const char msg[]) { this->nativeLogError(msg); } - - /** - * Log an error to stderr, taking an SkString as input. - */ - void logError(const SkString& str) { this->nativeLogError(str.c_str()); } - - /** - * Log the progress of the bench tool to both stdout and the log file specified by SetLogFile, - * if any, taking a C style string as input. - */ - void logProgress(const char msg[]) { - this->nativeLogProgress(msg); - this->fileWrite(msg, strlen(msg)); - } - - /** - * Log the progress of the bench tool to both stdout and the log file specified by SetLogFile, - * if any, taking an SkString as input. - */ - void logProgress(const SkString& str) { - this->nativeLogProgress(str.c_str()); - this->fileWrite(str.c_str(), str.size()); - } - -private: -#ifdef SK_BUILD_FOR_ANDROID - void nativeLogError(const char msg[]) { SkDebugf("%s", msg); } -#else - void nativeLogError(const char msg[]) { fprintf(stderr, "%s", msg); } -#endif - void nativeLogProgress(const char msg[]) { SkDebugf("%s", msg); } - - void fileWrite(const char msg[], size_t size); - - SkFILEWStream* fFileStream; -}; - -#endif // SkBenchLogger_DEFINED diff --git a/bench/SkBenchmark.cpp b/bench/SkBenchmark.cpp deleted file mode 100644 index 4c5d077b53..0000000000 --- a/bench/SkBenchmark.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2011 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "SkBenchmark.h" - -#include "SkPaint.h" -#include "SkParse.h" - -const char* SkTriState::Name[] = { "default", "true", "false" }; - -template BenchRegistry* BenchRegistry::gHead; - -SkBenchmark::SkBenchmark() { - fForceAlpha = 0xFF; - fForceAA = true; - fForceFilter = false; - fDither = SkTriState::kDefault; - fOrMask = fClearMask = 0; -} - -const char* SkBenchmark::getName() { - return this->onGetName(); -} - -SkIPoint SkBenchmark::getSize() { - return this->onGetSize(); -} - -void SkBenchmark::preDraw() { - this->onPreDraw(); -} - -void SkBenchmark::draw(const int loops, SkCanvas* canvas) { - this->onDraw(loops, canvas); -} - -void SkBenchmark::setupPaint(SkPaint* paint) { - paint->setAlpha(fForceAlpha); - paint->setAntiAlias(fForceAA); - paint->setFilterLevel(fForceFilter ? SkPaint::kLow_FilterLevel - : SkPaint::kNone_FilterLevel); - - paint->setFlags((paint->getFlags() & ~fClearMask) | fOrMask); - - if (SkTriState::kDefault != fDither) { - paint->setDither(SkTriState::kTrue == fDither); - } -} - -SkIPoint SkBenchmark::onGetSize() { - return SkIPoint::Make(640, 480); -} diff --git a/bench/SkBenchmark.h b/bench/SkBenchmark.h deleted file mode 100644 index 012d0fd0b0..0000000000 --- a/bench/SkBenchmark.h +++ /dev/null @@ -1,128 +0,0 @@ - -/* - * Copyright 2011 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ -#ifndef SkBenchmark_DEFINED -#define SkBenchmark_DEFINED - -#include "SkRefCnt.h" -#include "SkPoint.h" -#include "SkString.h" -#include "SkTRegistry.h" - -#define DEF_BENCH(code) \ -namespace { \ -static SkBenchmark* SK_MACRO_APPEND_LINE(factory)(void*) { code; } \ -BenchRegistry SK_MACRO_APPEND_LINE(g_R_)(SK_MACRO_APPEND_LINE(factory)); \ -} - -/* - * With the above macros, you can register benches as follows (at the bottom - * of your .cpp) - * - * DEF_BENCH(return new MyBenchmark(...)) - * DEF_BENCH(return new MyBenchmark(...)) - * DEF_BENCH(return new MyBenchmark(...)) - */ - - -class SkCanvas; -class SkPaint; - -class SkTriState { -public: - enum State { - kDefault, - kTrue, - kFalse - }; - static const char* Name[]; -}; - -class SkBenchmark : public SkRefCnt { -public: - SK_DECLARE_INST_COUNT(SkBenchmark) - - SkBenchmark(); - - const char* getName(); - SkIPoint getSize(); - - enum Backend { - kNonRendering_Backend, - kRaster_Backend, - kGPU_Backend, - kPDF_Backend, - }; - - // Call to determine whether the benchmark is intended for - // the rendering mode. - virtual bool isSuitableFor(Backend backend) { - return backend != kNonRendering_Backend; - } - - // Call before draw, allows the benchmark to do setup work outside of the - // timer. When a benchmark is repeatedly drawn, this should be called once - // before the initial draw. - void preDraw(); - - // Bench framework can tune loops to be large enough for stable timing. - void draw(const int loops, SkCanvas*); - - void setForceAlpha(int alpha) { - fForceAlpha = alpha; - } - - void setForceAA(bool aa) { - fForceAA = aa; - } - - void setForceFilter(bool filter) { - fForceFilter = filter; - } - - void setDither(SkTriState::State state) { - fDither = state; - } - - /** Assign masks for paint-flags. These will be applied when setupPaint() - * is called. - * - * Performs the following on the paint: - * uint32_t flags = paint.getFlags(); - * flags &= ~clearMask; - * flags |= orMask; - * paint.setFlags(flags); - */ - void setPaintMasks(uint32_t orMask, uint32_t clearMask) { - fOrMask = orMask; - fClearMask = clearMask; - } - -protected: - virtual void setupPaint(SkPaint* paint); - - virtual const char* onGetName() = 0; - virtual void onPreDraw() {} - // Each bench should do its main work in a loop like this: - // for (int i = 0; i < loops; i++) { } - virtual void onDraw(const int loops, SkCanvas*) = 0; - - virtual SkIPoint onGetSize(); - -private: - int fForceAlpha; - bool fForceAA; - bool fForceFilter; - SkTriState::State fDither; - uint32_t fOrMask, fClearMask; - - typedef SkRefCnt INHERITED; -}; - -typedef SkTRegistry BenchRegistry; - -#endif diff --git a/bench/SkGMBench.cpp b/bench/SkGMBench.cpp deleted file mode 100644 index 77d29a70a9..0000000000 --- a/bench/SkGMBench.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2014 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "SkGMBench.h" - -SkGMBench::SkGMBench(skiagm::GM* gm) : fGM(gm) { - fName.printf("GM:%s", gm->getName()); -} - -SkGMBench::~SkGMBench() { delete fGM; } - -const char* SkGMBench::onGetName() { - return fName.c_str(); -} - -bool SkGMBench::isSuitableFor(Backend backend) { - uint32_t flags = fGM->getFlags(); - switch (backend) { - case kGPU_Backend: - return !(skiagm::GM::kSkipGPU_Flag & flags); - case kPDF_Backend: - return !(skiagm::GM::kSkipPDF_Flag & flags); - case kRaster_Backend: - // GM doesn't have an equivalent flag. If the GM has known issues with 565 then - // we skip it for ALL raster configs in bench. - return !(skiagm::GM::kSkip565_Flag & flags); - case kNonRendering_Backend: - return false; - default: - SkDEBUGFAIL("Unexpected backend type."); - return false; - } -} - -void SkGMBench::onDraw(const int loops, SkCanvas* canvas) { - // Do we care about timing the draw of the background (once)? - // Does the GM ever rely on drawBackground to lazily compute something? - fGM->drawBackground(canvas); - for (int i = 0; i < loops; ++i) { - fGM->drawContent(canvas); - } -} - -SkIPoint SkGMBench::onGetSize() { - SkISize size = fGM->getISize(); - return SkIPoint::Make(size.fWidth, size.fHeight); -} diff --git a/bench/SkGMBench.h b/bench/SkGMBench.h deleted file mode 100644 index 925a87583c..0000000000 --- a/bench/SkGMBench.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2014 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "SkBenchmark.h" -#include "gm.h" -#include "SkCanvas.h" - -/** - * Runs a GM as a benchmark by repeatedly drawing the GM. - */ -class SkGMBench : public SkBenchmark { -public: - // Constructor takes ownership of the GM param. - SkGMBench(skiagm::GM* gm); - virtual ~SkGMBench(); - -protected: - virtual const char* onGetName() SK_OVERRIDE; - virtual bool isSuitableFor(Backend backend) SK_OVERRIDE; - virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE; - virtual SkIPoint onGetSize() SK_OVERRIDE; - -private: - skiagm::GM* fGM; - SkString fName; - typedef SkBenchmark INHERITED; -}; diff --git a/bench/SkipZeroesBench.cpp b/bench/SkipZeroesBench.cpp index 46acb9f1b2..30d9377a5e 100644 --- a/bench/SkipZeroesBench.cpp +++ b/bench/SkipZeroesBench.cpp @@ -5,8 +5,8 @@ * found in the LICENSE file. */ +#include "Benchmark.h" #include "Resources.h" -#include "SkBenchmark.h" #include "SkBitmap.h" #include "SkData.h" #include "SkForceLinking.h" @@ -19,7 +19,7 @@ __SK_FORCE_IMAGE_DECODER_LINKING; class SkCanvas; -class SkipZeroesBench : public SkBenchmark { +class SkipZeroesBench : public Benchmark { public: SkipZeroesBench(const char* filename, bool skipZeroes) : fName("SkipZeroes_") @@ -110,7 +110,7 @@ private: bool fSkipZeroes; bool fValid; - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; // Enable the true version once the feature is checked in. diff --git a/bench/SortBench.cpp b/bench/SortBench.cpp index 1f888f2462..a7e8c2cd0b 100644 --- a/bench/SortBench.cpp +++ b/bench/SortBench.cpp @@ -5,10 +5,10 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkRandom.h" -#include "SkTSort.h" #include "SkString.h" +#include "SkTSort.h" static const int N = 1000; @@ -96,7 +96,7 @@ static const struct { { "qsort", qsort_sort }, }; -class SortBench : public SkBenchmark { +class SortBench : public Benchmark { SkString fName; const Type fType; const SortProc fSortProc; @@ -136,18 +136,18 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; /////////////////////////////////////////////////////////////////////////////// -static SkBenchmark* NewSkQSort(Type t) { +static Benchmark* NewSkQSort(Type t) { return new SortBench(t, kSKQSort); } -static SkBenchmark* NewSkHeap(Type t) { +static Benchmark* NewSkHeap(Type t) { return new SortBench(t, kSKHeap); } -static SkBenchmark* NewQSort(Type t) { +static Benchmark* NewQSort(Type t) { return new SortBench(t, kQSort); } diff --git a/bench/StackBench.cpp b/bench/StackBench.cpp index 61af99fb1a..3b41cb65ce 100644 --- a/bench/StackBench.cpp +++ b/bench/StackBench.cpp @@ -5,7 +5,7 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkRandom.h" #include "SkChunkAlloc.h" @@ -29,7 +29,7 @@ // It wins every benchmark on every machine I tried (Desktop, Nexus S, Laptop). template -struct StackBench : public SkBenchmark { +struct StackBench : public Benchmark { virtual bool isSuitableFor(Backend b) SK_OVERRIDE { return b == kNonRendering_Backend; } virtual const char* onGetName() SK_OVERRIDE { return Impl::kName; } virtual void onDraw(const int loops, SkCanvas*) SK_OVERRIDE { Impl::bench(loops); } diff --git a/bench/StrokeBench.cpp b/bench/StrokeBench.cpp index 975c01f7b6..24e0cabbb0 100644 --- a/bench/StrokeBench.cpp +++ b/bench/StrokeBench.cpp @@ -5,7 +5,7 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkCanvas.h" #include "SkPaint.h" #include "SkRRect.h" @@ -53,7 +53,7 @@ static const char* draw_oval(const RRectRec* rec, int count) { // Test drawing a small stroked version to see the effect of special-casing // our stroke code for these convex single-contour shapes. // -class StrokeRRectBench : public SkBenchmark { +class StrokeRRectBench : public Benchmark { SkString fName; SkPaint::Join fJoin; RRectRec fRec; @@ -88,7 +88,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; DEF_BENCH( return new StrokeRRectBench(SkPaint::kRound_Join, draw_rect); ) diff --git a/bench/TableBench.cpp b/bench/TableBench.cpp index ce5c3d293d..a99e03b513 100644 --- a/bench/TableBench.cpp +++ b/bench/TableBench.cpp @@ -5,7 +5,7 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkCanvas.h" #include "SkRect.h" @@ -23,7 +23,7 @@ static const SkScalar kCellHeight = SkIntToScalar(10); // 2&4 are then drawn grey. Areas 2&3 are thus double drawn while area 4 is // triple drawn. // This trio of drawRects is then repeat for the next cell. -class TableBench : public SkBenchmark { +class TableBench : public Benchmark { public: static const int kNumRows = 48; static const int kNumCols = 32; @@ -66,7 +66,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; DEF_BENCH( return new TableBench(); ) diff --git a/bench/TextBench.cpp b/bench/TextBench.cpp index d32d0fd105..f150be2188 100644 --- a/bench/TextBench.cpp +++ b/bench/TextBench.cpp @@ -5,7 +5,7 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkCanvas.h" #include "SkFontHost.h" #include "SkPaint.h" @@ -38,7 +38,7 @@ static const char* fontQualityName(const SkPaint& paint) { textencoding? text -vs- postext - pathtext */ -class TextBench : public SkBenchmark { +class TextBench : public Benchmark { SkPaint fPaint; SkString fText; SkString fName; @@ -123,7 +123,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; /////////////////////////////////////////////////////////////////////////////// diff --git a/bench/TileBench.cpp b/bench/TileBench.cpp index 12c9629ee2..7487b1b8ea 100644 --- a/bench/TileBench.cpp +++ b/bench/TileBench.cpp @@ -6,7 +6,7 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkBitmap.h" #include "SkCanvas.h" #include "SkShader.h" @@ -28,7 +28,7 @@ static void create_gradient(SkBitmap* bm) { // Test out the special case of a tiled 1xN texture. Test out opacity, // filtering and the different tiling modes -class ConstXTileBench : public SkBenchmark { +class ConstXTileBench : public Benchmark { SkPaint fPaint; SkString fName; bool fDoFilter; @@ -111,7 +111,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; DEF_BENCH(return new ConstXTileBench(SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode, false, false, true)) diff --git a/bench/VertBench.cpp b/bench/VertBench.cpp index 3f07528142..e426ad8a5e 100644 --- a/bench/VertBench.cpp +++ b/bench/VertBench.cpp @@ -5,19 +5,19 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkCanvas.h" #include "SkPaint.h" #include "SkRandom.h" -#include "SkString.h" #include "SkShader.h" +#include "SkString.h" enum VertFlags { kColors_VertFlag, kTexture_VertFlag, }; -class VertBench : public SkBenchmark { +class VertBench : public Benchmark { SkString fName; enum { W = 640, @@ -87,7 +87,7 @@ protected: } } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; /////////////////////////////////////////////////////////////////////////////// diff --git a/bench/WritePixelsBench.cpp b/bench/WritePixelsBench.cpp index 80aeda74cb..5138375ffb 100644 --- a/bench/WritePixelsBench.cpp +++ b/bench/WritePixelsBench.cpp @@ -5,11 +5,11 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkCanvas.h" #include "SkString.h" -class WritePixelsBench : public SkBenchmark { +class WritePixelsBench : public Benchmark { public: WritePixelsBench(SkColorType ct, SkAlphaType at) : fColorType(ct) @@ -68,7 +68,7 @@ private: SkAlphaType fAlphaType; SkString fName; - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; ////////////////////////////////////////////////////////////////////////////// diff --git a/bench/WriterBench.cpp b/bench/WriterBench.cpp index 7696eab832..906a9d2ee8 100644 --- a/bench/WriterBench.cpp +++ b/bench/WriterBench.cpp @@ -6,11 +6,11 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkCanvas.h" #include "SkWriter32.h" -class WriterBench : public SkBenchmark { +class WriterBench : public Benchmark { public: virtual bool isSuitableFor(Backend backend) SK_OVERRIDE { return backend == kNonRendering_Backend; @@ -33,7 +33,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; //////////////////////////////////////////////////////////////////////////////// diff --git a/bench/XfermodeBench.cpp b/bench/XfermodeBench.cpp index 1910b75b21..f73943bcf7 100644 --- a/bench/XfermodeBench.cpp +++ b/bench/XfermodeBench.cpp @@ -6,7 +6,7 @@ * found in the LICENSE file. */ -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkCanvas.h" #include "SkPaint.h" #include "SkRandom.h" @@ -14,7 +14,7 @@ #include "SkXfermode.h" // Benchmark that draws non-AA rects with an SkXfermode::Mode -class XfermodeBench : public SkBenchmark { +class XfermodeBench : public Benchmark { public: XfermodeBench(SkXfermode::Mode mode) { fXfermode.reset(SkXfermode::Create(mode)); @@ -58,10 +58,10 @@ private: SkAutoTUnref fXfermode; SkString fName; - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; -class XferCreateBench : public SkBenchmark { +class XferCreateBench : public Benchmark { public: virtual bool isSuitableFor(Backend backend) SK_OVERRIDE { return backend == kNonRendering_Backend; @@ -80,7 +80,7 @@ protected: } private: - typedef SkBenchmark INHERITED; + typedef Benchmark INHERITED; }; ////////////////////////////////////////////////////////////////////////////// diff --git a/bench/benchmain.cpp b/bench/benchmain.cpp index b82dd017b0..6b3f5872f2 100644 --- a/bench/benchmain.cpp +++ b/bench/benchmain.cpp @@ -5,18 +5,18 @@ * found in the LICENSE file. */ +#include "BenchLogger.h" #include "BenchTimer.h" +#include "Benchmark.h" #include "CrashHandler.h" +#include "GMBench.h" #include "ResultsWriter.h" -#include "SkBenchLogger.h" -#include "SkBenchmark.h" #include "SkBitmapDevice.h" #include "SkCanvas.h" #include "SkColorPriv.h" #include "SkCommandLineFlags.h" #include "SkData.h" #include "SkDeferredCanvas.h" -#include "SkGMBench.h" #include "SkGraphics.h" #include "SkImageEncoder.h" #include "SkOSFile.h" @@ -56,7 +56,7 @@ class Iter { public: Iter() : fBenches(BenchRegistry::Head()), fGMs(skiagm::GMRegistry::Head()) {} - SkBenchmark* next() { + Benchmark* next() { if (fBenches) { BenchRegistry::Factory f = fBenches->factory(); fBenches = fBenches->next(); @@ -67,7 +67,7 @@ public: SkAutoTDelete gm(fGMs->factory()(NULL)); fGMs = fGMs->next(); if (gm->getFlags() & skiagm::GM::kAsBench_Flag) { - return SkNEW_ARGS(SkGMBench, (gm.detach())); + return SkNEW_ARGS(GMBench, (gm.detach())); } } @@ -144,24 +144,24 @@ static void perform_scale(SkCanvas* canvas, int w, int h) { } static SkSurface* make_surface(SkColorType colorType, const SkIPoint& size, - SkBenchmark::Backend backend, int sampleCount, + Benchmark::Backend backend, int sampleCount, GrContext* context) { SkSurface* surface = NULL; SkImageInfo info = SkImageInfo::Make(size.fX, size.fY, colorType, kPremul_SkAlphaType); switch (backend) { - case SkBenchmark::kRaster_Backend: + case Benchmark::kRaster_Backend: surface = SkSurface::NewRaster(info); surface->getCanvas()->clear(SK_ColorWHITE); break; #if SK_SUPPORT_GPU - case SkBenchmark::kGPU_Backend: { + case Benchmark::kGPU_Backend: { surface = SkSurface::NewRenderTarget(context, info, sampleCount); break; } #endif - case SkBenchmark::kPDF_Backend: + case Benchmark::kPDF_Backend: default: SkDEBUGFAIL("unsupported"); } @@ -193,24 +193,24 @@ static const struct Config { SkColorType fColorType; const char* name; int sampleCount; - SkBenchmark::Backend backend; + Benchmark::Backend backend; GLContextType contextType; bool runByDefault; } gConfigs[] = { - { kN32_SkColorType, "NONRENDERING", 0, SkBenchmark::kNonRendering_Backend, kNative, true}, - { kN32_SkColorType, "8888", 0, SkBenchmark::kRaster_Backend, kNative, true}, - { kRGB_565_SkColorType, "565", 0, SkBenchmark::kRaster_Backend, kNative, true}, + { kN32_SkColorType, "NONRENDERING", 0, Benchmark::kNonRendering_Backend, kNative, true}, + { kN32_SkColorType, "8888", 0, Benchmark::kRaster_Backend, kNative, true}, + { kRGB_565_SkColorType, "565", 0, Benchmark::kRaster_Backend, kNative, true}, #if SK_SUPPORT_GPU - { kN32_SkColorType, "GPU", 0, SkBenchmark::kGPU_Backend, kNative, true}, - { kN32_SkColorType, "MSAA4", 4, SkBenchmark::kGPU_Backend, kNative, false}, - { kN32_SkColorType, "MSAA16", 16, SkBenchmark::kGPU_Backend, kNative, false}, - { kN32_SkColorType, "NVPRMSAA4", 4, SkBenchmark::kGPU_Backend, kNVPR, true}, - { kN32_SkColorType, "NVPRMSAA16", 16, SkBenchmark::kGPU_Backend, kNVPR, false}, + { kN32_SkColorType, "GPU", 0, Benchmark::kGPU_Backend, kNative, true}, + { kN32_SkColorType, "MSAA4", 4, Benchmark::kGPU_Backend, kNative, false}, + { kN32_SkColorType, "MSAA16", 16, Benchmark::kGPU_Backend, kNative, false}, + { kN32_SkColorType, "NVPRMSAA4", 4, Benchmark::kGPU_Backend, kNVPR, true}, + { kN32_SkColorType, "NVPRMSAA16", 16, Benchmark::kGPU_Backend, kNVPR, false}, #if SK_ANGLE - { kN32_SkColorType, "ANGLE", 0, SkBenchmark::kGPU_Backend, kANGLE, true}, + { kN32_SkColorType, "ANGLE", 0, Benchmark::kGPU_Backend, kANGLE, true}, #endif // SK_ANGLE - { kN32_SkColorType, "Debug", 0, SkBenchmark::kGPU_Backend, kDebug, kIsDebug}, - { kN32_SkColorType, "NULLGPU", 0, SkBenchmark::kGPU_Backend, kNull, true}, + { kN32_SkColorType, "Debug", 0, Benchmark::kGPU_Backend, kDebug, kIsDebug}, + { kN32_SkColorType, "NULLGPU", 0, Benchmark::kGPU_Backend, kNull, true}, #endif // SK_SUPPORT_GPU }; @@ -281,7 +281,7 @@ int tool_main(int argc, char** argv) { SkAutoGraphics ag; // First, parse some flags. - SkBenchLogger logger; + BenchLogger logger; if (FLAGS_logFile.count()) { logger.SetLogFile(FLAGS_logFile[0]); } @@ -340,7 +340,7 @@ int tool_main(int argc, char** argv) { // Non-rendering configs only run in normal mode for (int i = 0; i < configs.count(); ++i) { const Config& config = gConfigs[configs[i]]; - if (SkBenchmark::kNonRendering_Backend == config.backend) { + if (Benchmark::kNonRendering_Backend == config.backend) { configs.remove(i, 1); --i; } @@ -351,7 +351,7 @@ int tool_main(int argc, char** argv) { for (int i = 0; i < configs.count(); ++i) { const Config& config = gConfigs[configs[i]]; - if (SkBenchmark::kGPU_Backend == config.backend) { + if (Benchmark::kGPU_Backend == config.backend) { GrContext* context = gContextFactory.get(config.contextType); if (NULL == context) { SkDebugf("GrContext could not be created for config %s. Config will be skipped.\n", @@ -409,7 +409,7 @@ int tool_main(int argc, char** argv) { for (size_t i = 0; i < SK_ARRAY_COUNT(gConfigs); ++i) { #if SK_SUPPORT_GPU const Config& config = gConfigs[i]; - if (SkBenchmark::kGPU_Backend != config.backend) { + if (Benchmark::kGPU_Backend != config.backend) { continue; } GrContext* context = gContextFactory.get(config.contextType); @@ -432,9 +432,9 @@ int tool_main(int argc, char** argv) { // Run each bench in each configuration it supports and we asked for. Iter iter; - SkBenchmark* bench; + Benchmark* bench; while ((bench = iter.next()) != NULL) { - SkAutoTUnref benchUnref(bench); + SkAutoTUnref benchUnref(bench); if (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getName())) { continue; } @@ -457,7 +457,7 @@ int tool_main(int argc, char** argv) { GrContext* context = NULL; #if SK_SUPPORT_GPU SkGLContextHelper* glContext = NULL; - if (SkBenchmark::kGPU_Backend == config.backend) { + if (Benchmark::kGPU_Backend == config.backend) { context = gContextFactory.get(config.contextType); if (NULL == context) { continue; @@ -472,7 +472,7 @@ int tool_main(int argc, char** argv) { const SkIPoint dim = bench->getSize(); SkAutoTUnref surface; - if (SkBenchmark::kNonRendering_Backend != config.backend) { + if (Benchmark::kNonRendering_Backend != config.backend) { surface.reset(make_surface(config.fColorType, dim, config.backend, @@ -527,7 +527,7 @@ int tool_main(int argc, char** argv) { #if SK_SUPPORT_GPU SkGLContextHelper* contextHelper = NULL; - if (SkBenchmark::kGPU_Backend == config.backend) { + if (Benchmark::kGPU_Backend == config.backend) { contextHelper = gContextFactory.getGLContext(config.contextType); } BenchTimer timer(contextHelper); @@ -642,7 +642,7 @@ int tool_main(int argc, char** argv) { } if (FLAGS_verbose) { SkDebugf("\n"); } - if (!FLAGS_dryRun && FLAGS_outDir.count() && SkBenchmark::kNonRendering_Backend != config.backend) { + if (!FLAGS_dryRun && FLAGS_outDir.count() && Benchmark::kNonRendering_Backend != config.backend) { SkAutoTUnref image(surface->newImageSnapshot()); if (image.get()) { saveFile(bench->getName(), config.name, FLAGS_outDir[0], diff --git a/dm/DM.cpp b/dm/DM.cpp index fde057d03f..29810130c3 100644 --- a/dm/DM.cpp +++ b/dm/DM.cpp @@ -1,7 +1,8 @@ // Main binary for DM. // For a high-level overview, please see dm/README. -#include "SkBenchmark.h" +#include "Benchmark.h" +#include "CrashHandler.h" #include "SkCommandLineFlags.h" #include "SkForceLinking.h" #include "SkGraphics.h" @@ -9,7 +10,6 @@ #include "SkString.h" #include "Test.h" #include "gm.h" -#include "CrashHandler.h" #include "DMBenchTask.h" #include "DMCpuGMTask.h" @@ -249,7 +249,7 @@ int tool_main(int argc, char** argv) { SkTDArray benches; if (FLAGS_benches) { - append_matching_factories(BenchRegistry::Head(), &benches); + append_matching_factories(BenchRegistry::Head(), &benches); } SkTDArray tests; diff --git a/dm/DMBenchTask.cpp b/dm/DMBenchTask.cpp index 619bbc1b14..7cd2fdcb03 100644 --- a/dm/DMBenchTask.cpp +++ b/dm/DMBenchTask.cpp @@ -41,18 +41,18 @@ GpuBenchTask::GpuBenchTask(const char* config, , fSampleCount(sampleCount) {} bool NonRenderingBenchTask::shouldSkip() const { - return !fBench->isSuitableFor(SkBenchmark::kNonRendering_Backend); + return !fBench->isSuitableFor(Benchmark::kNonRendering_Backend); } bool CpuBenchTask::shouldSkip() const { - return !fBench->isSuitableFor(SkBenchmark::kRaster_Backend); + return !fBench->isSuitableFor(Benchmark::kRaster_Backend); } bool GpuBenchTask::shouldSkip() const { - return kGPUDisabled || !fBench->isSuitableFor(SkBenchmark::kGPU_Backend); + return kGPUDisabled || !fBench->isSuitableFor(Benchmark::kGPU_Backend); } -static void draw_raster(SkBenchmark* bench, SkColorType colorType) { +static void draw_raster(Benchmark* bench, SkColorType colorType) { SkBitmap bitmap; AllocatePixels(colorType, bench->getSize().x(), bench->getSize().y(), &bitmap); SkCanvas canvas(bitmap); diff --git a/dm/DMBenchTask.h b/dm/DMBenchTask.h index ac7030b5f0..3c71cd76f0 100644 --- a/dm/DMBenchTask.h +++ b/dm/DMBenchTask.h @@ -1,14 +1,14 @@ #ifndef DMBenchTask_DEFINED #define DMBenchTask_DEFINED +#include "Benchmark.h" #include "DMReporter.h" #include "DMTask.h" #include "DMTaskRunner.h" -#include "SkBenchmark.h" #include "SkString.h" #include "SkTemplates.h" -// Tasks that run an SkBenchmark once as a check that it doesn't crash. +// Tasks that run an Benchmark once as a check that it doesn't crash. namespace DM { @@ -21,7 +21,7 @@ public: virtual SkString name() const SK_OVERRIDE { return fName; } private: - SkAutoTDelete fBench; + SkAutoTDelete fBench; const SkString fName; }; @@ -34,7 +34,7 @@ public: virtual SkString name() const SK_OVERRIDE { return fName; } private: - SkAutoTDelete fBench; + SkAutoTDelete fBench; const SkString fName; const SkColorType fColorType; }; @@ -53,7 +53,7 @@ public: virtual SkString name() const SK_OVERRIDE { return fName; } private: - SkAutoTDelete fBench; + SkAutoTDelete fBench; const SkString fName; const GrContextFactory::GLContextType fContextType; int fSampleCount; diff --git a/dm/DMUtil.h b/dm/DMUtil.h index 8011e96e1e..b99fe0c01a 100644 --- a/dm/DMUtil.h +++ b/dm/DMUtil.h @@ -1,7 +1,7 @@ #ifndef DMUtil_DEFINED #define DMUtil_DEFINED -#include "SkBenchmark.h" +#include "Benchmark.h" #include "SkBitmap.h" #include "SkString.h" #include "gm_expectations.h" diff --git a/gyp/bench.gyp b/gyp/bench.gyp index 6ec972f328..15927e6413 100644 --- a/gyp/bench.gyp +++ b/gyp/bench.gyp @@ -18,11 +18,11 @@ 'skia_lib.gyp:skia_lib', ], 'sources': [ + '../bench/BenchLogger.cpp', + '../bench/BenchLogger.h', + '../bench/GMBench.cpp', + '../bench/GMBench.h', '../bench/ResultsWriter.cpp', - '../bench/SkBenchLogger.cpp', - '../bench/SkBenchLogger.h', - '../bench/SkGMBench.cpp', - '../bench/SkGMBench.h', '../bench/benchmain.cpp', '../tools/sk_tool_utils.cpp', ], diff --git a/gyp/bench.gypi b/gyp/bench.gypi index 82a7cd6ba4..06df30bd26 100644 --- a/gyp/bench.gypi +++ b/gyp/bench.gypi @@ -9,8 +9,8 @@ 'skia_lib.gyp:skia_lib', ], 'sources': [ - '../bench/SkBenchmark.cpp', - '../bench/SkBenchmark.h', + '../bench/Benchmark.cpp', + '../bench/Benchmark.h', '../bench/AAClipBench.cpp', '../bench/BicubicBench.cpp', diff --git a/gyp/tools.gyp b/gyp/tools.gyp index 7af70f782f..5ea127296a 100644 --- a/gyp/tools.gyp +++ b/gyp/tools.gyp @@ -286,11 +286,11 @@ 'target_name': 'bench_pictures', 'type': 'executable', 'sources': [ + '../bench/BenchLogger.cpp', + '../bench/BenchLogger.h', '../bench/ResultsWriter.cpp', '../tools/PictureBenchmark.cpp', '../tools/PictureResultsWriter.h', - '../bench/SkBenchLogger.h', - '../bench/SkBenchLogger.cpp', '../tools/bench_pictures_main.cpp', ], 'include_dirs': [ diff --git a/tools/PictureBenchmark.h b/tools/PictureBenchmark.h index 3ec3c6691c..142d52685e 100644 --- a/tools/PictureBenchmark.h +++ b/tools/PictureBenchmark.h @@ -8,15 +8,13 @@ #ifndef PictureBenchmark_DEFINED #define PictureBenchmark_DEFINED -#include "SkTypes.h" #include "PictureRenderer.h" -#include "TimerData.h" #include "PictureResultsWriter.h" +#include "SkTypes.h" +#include "TimerData.h" class BenchTimer; -class SkBenchLogger; class SkPicture; -class SkString; namespace sk_tools { diff --git a/tools/PictureResultsWriter.h b/tools/PictureResultsWriter.h index 272a50c4c3..d4a15765f0 100644 --- a/tools/PictureResultsWriter.h +++ b/tools/PictureResultsWriter.h @@ -6,15 +6,17 @@ * * Classes for writing out bench results in various formats. */ + #ifndef SkPictureResultsWriter_DEFINED #define SkPictureResultsWriter_DEFINED +#include "BenchLogger.h" #include "ResultsWriter.h" -#include "SkBenchLogger.h" #include "SkJSONCPP.h" #include "SkStream.h" #include "SkString.h" #include "SkTArray.h" +#include "TimerData.h" /** * Base class for writing picture bench results. @@ -93,7 +95,7 @@ private: }; /** - * Writes to SkBenchLogger to mimic original behavior + * Writes to BenchLogger to mimic original behavior */ class PictureResultsLoggerWriter : public PictureResultsWriter { private: @@ -103,7 +105,7 @@ private: } } public: - PictureResultsLoggerWriter(SkBenchLogger* log) + PictureResultsLoggerWriter(BenchLogger* log) : fLogger(log), currentLine() {} virtual void bench(const char name[], int32_t x, int32_t y) { SkString result; @@ -136,7 +138,7 @@ public: } virtual void end() {} private: - SkBenchLogger* fLogger; + BenchLogger* fLogger; SkString currentLine; }; diff --git a/tools/bbh_shootout.cpp b/tools/bbh_shootout.cpp index f3758cb903..e657917aad 100644 --- a/tools/bbh_shootout.cpp +++ b/tools/bbh_shootout.cpp @@ -6,16 +6,16 @@ */ #include "BenchTimer.h" +#include "Benchmark.h" #include "LazyDecodeBitmap.h" #include "PictureBenchmark.h" #include "PictureRenderer.h" -#include "SkBenchmark.h" +#include "SkCommandLineFlags.h" #include "SkForceLinking.h" #include "SkGraphics.h" #include "SkStream.h" #include "SkString.h" #include "SkTArray.h" -#include "SkCommandLineFlags.h" typedef sk_tools::PictureRenderer::BBoxHierarchyType BBoxType; static const int kBBoxTypeCount = sk_tools::PictureRenderer::kLast_BBoxHierarchyType + 1; diff --git a/tools/bench_pictures_main.cpp b/tools/bench_pictures_main.cpp index c63ffff5b7..d9b767b2aa 100644 --- a/tools/bench_pictures_main.cpp +++ b/tools/bench_pictures_main.cpp @@ -5,13 +5,14 @@ * found in the LICENSE file. */ +#include "BenchLogger.h" #include "BenchTimer.h" -#include "CrashHandler.h" #include "CopyTilesRenderer.h" +#include "CrashHandler.h" #include "LazyDecodeBitmap.h" #include "PictureBenchmark.h" #include "PictureRenderingFlags.h" -#include "SkBenchLogger.h" +#include "PictureResultsWriter.h" #include "SkCommandLineFlags.h" #include "SkData.h" #include "SkDiscardableMemoryPool.h" @@ -22,9 +23,8 @@ #include "SkPicture.h" #include "SkStream.h" #include "picture_utils.h" -#include "PictureResultsWriter.h" -SkBenchLogger gLogger; +BenchLogger gLogger; PictureResultsLoggerWriter gLogWriter(&gLogger); PictureResultsMultiWriter gWriter; -- cgit v1.2.3