aboutsummaryrefslogtreecommitdiffhomepage
path: root/dm
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2014-07-16 14:29:53 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-07-16 14:29:53 -0700
commit103ae71cdd6520f3059c3a18545ac18d5d649f91 (patch)
tree6b7db3458eda0c2be75de579e00977c75124da2b /dm
parent0b4cc892cb9edd4167133a465b01baa476ecc244 (diff)
Remove benches from DM.
This idea turned out to be more redundant than useful. BUG=skia: R=mtklein@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/399463003
Diffstat (limited to 'dm')
-rw-r--r--dm/DM.cpp41
-rw-r--r--dm/DMBenchTask.cpp89
-rw-r--r--dm/DMBenchTask.h66
-rw-r--r--dm/DMUtil.h1
4 files changed, 2 insertions, 195 deletions
diff --git a/dm/DM.cpp b/dm/DM.cpp
index afe75734e9..c71450c23f 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -1,7 +1,6 @@
// Main binary for DM.
// For a high-level overview, please see dm/README.
-#include "Benchmark.h"
#include "CrashHandler.h"
#include "SkCommandLineFlags.h"
#include "SkForceLinking.h"
@@ -11,7 +10,6 @@
#include "Test.h"
#include "gm.h"
-#include "DMBenchTask.h"
#include "DMCpuGMTask.h"
#include "DMGpuGMTask.h"
#include "DMGpuSupport.h"
@@ -68,7 +66,6 @@ DEFINE_bool(leaks, false, "Print leaked instance-counted objects at exit?");
DEFINE_string(skps, "", "Directory to read skps from.");
DEFINE_bool(gms, true, "Run GMs?");
-DEFINE_bool(benches, true, "Run benches? Does not run GMs-as-benches.");
DEFINE_bool(tests, true, "Run tests?");
DECLARE_bool(verbose);
@@ -130,34 +127,6 @@ static void kick_off_gms(const SkTDArray<GMRegistry::Factory>& gms,
#undef START
}
-static void kick_off_benches(const SkTDArray<BenchRegistry::Factory>& benches,
- const SkTArray<SkString>& configs,
- GrGLStandard gpuAPI,
- DM::Reporter* reporter,
- DM::TaskRunner* tasks) {
-#define START(name, type, ...) \
- if (lowercase(configs[j]).equals(name)) { \
- tasks->add(SkNEW_ARGS(DM::type, (name, reporter, tasks, benches[i], ## __VA_ARGS__))); \
- }
- for (int i = 0; i < benches.count(); i++) {
- for (int j = 0; j < configs.count(); j++) {
- START("nonrendering", NonRenderingBenchTask);
- START("565", CpuBenchTask, kRGB_565_SkColorType);
- START("8888", CpuBenchTask, kN32_SkColorType);
- START("gpu", GpuBenchTask, native, gpuAPI, 0);
- START("msaa4", GpuBenchTask, native, gpuAPI, 4);
- START("msaa16", GpuBenchTask, native, gpuAPI, 16);
- START("nvprmsaa4", GpuBenchTask, nvpr, gpuAPI, 4);
- START("nvprmsaa16", GpuBenchTask, nvpr, gpuAPI, 16);
- START("gpunull", GpuBenchTask, null, gpuAPI, 0);
- START("gpudebug", GpuBenchTask, debug, gpuAPI, 0);
- START("angle", GpuBenchTask, angle, gpuAPI, 0);
- START("mesa", GpuBenchTask, mesa, gpuAPI, 0);
- }
- }
-#undef START
-}
-
static void kick_off_tests(const SkTDArray<TestRegistry::Factory>& tests,
DM::Reporter* reporter,
DM::TaskRunner* tasks) {
@@ -269,22 +238,16 @@ int tool_main(int argc, char** argv) {
}
}
- SkTDArray<BenchRegistry::Factory> benches;
- if (FLAGS_benches) {
- append_matching_factories<Benchmark>(BenchRegistry::Head(), &benches);
- }
-
SkTDArray<TestRegistry::Factory> tests;
if (FLAGS_tests) {
append_matching_factories<Test>(TestRegistry::Head(), &tests);
}
- SkDebugf("(%d GMs, %d benches) x %d configs, %d tests\n",
- gms.count(), benches.count(), configs.count(), tests.count());
+ SkDebugf("%d GMs x %d configs, %d tests\n",
+ gms.count(), configs.count(), tests.count());
DM::Reporter reporter;
DM::TaskRunner tasks(FLAGS_threads, FLAGS_gpuThreads);
kick_off_gms(gms, configs, gpuAPI, *expectations, &reporter, &tasks);
- kick_off_benches(benches, configs, gpuAPI, &reporter, &tasks);
kick_off_tests(tests, &reporter, &tasks);
kick_off_skps(&reporter, &tasks);
tasks.wait();
diff --git a/dm/DMBenchTask.cpp b/dm/DMBenchTask.cpp
deleted file mode 100644
index 9bdbbf2974..0000000000
--- a/dm/DMBenchTask.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-#include "DMBenchTask.h"
-#include "DMUtil.h"
-#include "SkSurface.h"
-
-namespace DM {
-
-static SkString bench_name(const char* name, const char* config) {
- SkString result("bench ");
- result.appendf("%s_%s", name, config);
- return result;
-}
-
-NonRenderingBenchTask::NonRenderingBenchTask(const char* config,
- Reporter* reporter,
- TaskRunner* tasks,
- BenchRegistry::Factory factory)
- : CpuTask(reporter, tasks)
- , fBench(factory(NULL))
- , fName(bench_name(fBench->getName(), config)) {}
-
-CpuBenchTask::CpuBenchTask(const char* config,
- Reporter* reporter,
- TaskRunner* tasks,
- BenchRegistry::Factory factory,
- SkColorType colorType)
- : CpuTask(reporter, tasks)
- , fBench(factory(NULL))
- , fName(bench_name(fBench->getName(), config))
- , fColorType(colorType) {}
-
-GpuBenchTask::GpuBenchTask(const char* config,
- Reporter* reporter,
- TaskRunner* tasks,
- BenchRegistry::Factory factory,
- GrContextFactory::GLContextType contextType,
- GrGLStandard gpuAPI,
- int sampleCount)
- : GpuTask(reporter, tasks)
- , fBench(factory(NULL))
- , fName(bench_name(fBench->getName(), config))
- , fContextType(contextType)
- , fGpuAPI(gpuAPI)
- , fSampleCount(sampleCount) {}
-
-bool NonRenderingBenchTask::shouldSkip() const {
- return !fBench->isSuitableFor(Benchmark::kNonRendering_Backend);
-}
-
-bool CpuBenchTask::shouldSkip() const {
- return !fBench->isSuitableFor(Benchmark::kRaster_Backend);
-}
-
-bool GpuBenchTask::shouldSkip() const {
- return kGPUDisabled || !fBench->isSuitableFor(Benchmark::kGPU_Backend);
-}
-
-static void draw_raster(Benchmark* bench, SkColorType colorType) {
- SkBitmap bitmap;
- AllocatePixels(colorType, bench->getSize().x(), bench->getSize().y(), &bitmap);
- SkCanvas canvas(bitmap);
-
- bench->preDraw();
- bench->draw(1, &canvas);
-}
-
-void NonRenderingBenchTask::draw() {
- draw_raster(fBench.get(), kN32_SkColorType);
-}
-
-void CpuBenchTask::draw() {
- draw_raster(fBench.get(), fColorType);
-}
-
-void GpuBenchTask::draw(GrContextFactory* grFactory) {
- SkImageInfo info = SkImageInfo::Make(fBench->getSize().x(),
- fBench->getSize().y(),
- kN32_SkColorType,
- kPremul_SkAlphaType);
- SkAutoTUnref<SkSurface> surface(NewGpuSurface(grFactory, fContextType, fGpuAPI, info,
- fSampleCount));
- if (!surface) {
- this->fail("Could not create context for the config and the api.");
- return;
- }
- fBench->preDraw();
- fBench->draw(1, surface->getCanvas());
-}
-
-} // namespace DM
diff --git a/dm/DMBenchTask.h b/dm/DMBenchTask.h
deleted file mode 100644
index d2b58004f9..0000000000
--- a/dm/DMBenchTask.h
+++ /dev/null
@@ -1,66 +0,0 @@
-#ifndef DMBenchTask_DEFINED
-#define DMBenchTask_DEFINED
-
-#include "Benchmark.h"
-#include "DMReporter.h"
-#include "DMTask.h"
-#include "DMTaskRunner.h"
-#include "SkString.h"
-#include "SkTemplates.h"
-
-// Tasks that run an Benchmark once as a check that it doesn't crash.
-
-namespace DM {
-
-class NonRenderingBenchTask : public CpuTask {
-public:
- NonRenderingBenchTask(const char* config, Reporter*, TaskRunner*, BenchRegistry::Factory);
-
- virtual void draw() SK_OVERRIDE;
- virtual bool shouldSkip() const SK_OVERRIDE;
- virtual SkString name() const SK_OVERRIDE { return fName; }
-
-private:
- SkAutoTDelete<Benchmark> fBench;
- const SkString fName;
-};
-
-class CpuBenchTask : public CpuTask {
-public:
- CpuBenchTask(const char* config, Reporter*, TaskRunner*, BenchRegistry::Factory, SkColorType);
-
- virtual void draw() SK_OVERRIDE;
- virtual bool shouldSkip() const SK_OVERRIDE;
- virtual SkString name() const SK_OVERRIDE { return fName; }
-
-private:
- SkAutoTDelete<Benchmark> fBench;
- const SkString fName;
- const SkColorType fColorType;
-};
-
-class GpuBenchTask : public GpuTask {
-public:
- GpuBenchTask(const char* config,
- Reporter*,
- TaskRunner*,
- BenchRegistry::Factory,
- GrContextFactory::GLContextType,
- GrGLStandard gpuAPI,
- int sampleCount);
-
- virtual void draw(GrContextFactory*) SK_OVERRIDE;
- virtual bool shouldSkip() const SK_OVERRIDE;
- virtual SkString name() const SK_OVERRIDE { return fName; }
-
-private:
- SkAutoTDelete<Benchmark> fBench;
- const SkString fName;
- const GrContextFactory::GLContextType fContextType;
- const GrGLStandard fGpuAPI;
- int fSampleCount;
-};
-
-} // namespace DM
-
-#endif // DMBenchTask_DEFINED
diff --git a/dm/DMUtil.h b/dm/DMUtil.h
index c202b048b0..8de767db2b 100644
--- a/dm/DMUtil.h
+++ b/dm/DMUtil.h
@@ -1,7 +1,6 @@
#ifndef DMUtil_DEFINED
#define DMUtil_DEFINED
-#include "Benchmark.h"
#include "SkBitmap.h"
#include "SkString.h"
#include "gm_expectations.h"