1 #ifndef DMBenchTask_DEFINED 2 #define DMBenchTask_DEFINED 3 4 #include "Benchmark.h" 5 #include "DMReporter.h" 6 #include "DMTask.h" 7 #include "DMTaskRunner.h" 8 #include "SkString.h" 9 #include "SkTemplates.h" 10 11 // Tasks that run an Benchmark once as a check that it doesn't crash. 12 13 namespace DM { 14 15 class NonRenderingBenchTask : public CpuTask { 16 public: 17 NonRenderingBenchTask(const char* config, Reporter*, TaskRunner*, BenchRegistry::Factory); 18 19 virtual void draw() SK_OVERRIDE; 20 virtual bool shouldSkip() const SK_OVERRIDE; name()21 virtual SkString name() const SK_OVERRIDE { return fName; } 22 23 private: 24 SkAutoTDelete<Benchmark> fBench; 25 const SkString fName; 26 }; 27 28 class CpuBenchTask : public CpuTask { 29 public: 30 CpuBenchTask(const char* config, Reporter*, TaskRunner*, BenchRegistry::Factory, SkColorType); 31 32 virtual void draw() SK_OVERRIDE; 33 virtual bool shouldSkip() const SK_OVERRIDE; name()34 virtual SkString name() const SK_OVERRIDE { return fName; } 35 36 private: 37 SkAutoTDelete<Benchmark> fBench; 38 const SkString fName; 39 const SkColorType fColorType; 40 }; 41 42 class GpuBenchTask : public GpuTask { 43 public: 44 GpuBenchTask(const char* config, 45 Reporter*, 46 TaskRunner*, 47 BenchRegistry::Factory, 48 GrContextFactory::GLContextType, 49 int sampleCount); 50 51 virtual void draw(GrContextFactory*) SK_OVERRIDE; 52 virtual bool shouldSkip() const SK_OVERRIDE; name()53 virtual SkString name() const SK_OVERRIDE { return fName; } 54 55 private: 56 SkAutoTDelete<Benchmark> fBench; 57 const SkString fName; 58 const GrContextFactory::GLContextType fContextType; 59 int fSampleCount; 60 }; 61 62 } // namespace DM 63 64 #endif // DMBenchTask_DEFINED 65