skia2/dm/DMTestTask.cpp
commit-bot@chromium.org 125c6cdefe DM: when 32-bit, disable pathops internal threading by default
Before this change, when limited to 4G, pathops threaded tests were the weak
link RAM-consumption-wise (in thread-local font caches) up until about 12
cores, where other problems begin to pile up too.

Tested by running:
    ulimit -Sv 4194304
    out/Debug/dm --threads N [--pathOpsSingleThread]

After this, we're _probably_ good to go on 32-bit machines with 8 cores.

BUG=skia:2478
R=borenet@google.com, mtklein@google.com

Author: mtklein@chromium.org

Review URL: https://codereview.chromium.org/265593003

git-svn-id: http://skia.googlecode.com/svn/trunk@14463 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-04-30 14:56:29 +00:00

62 lines
1.9 KiB
C++

#include "DMTestTask.h"
#include "DMUtil.h"
#include "SkCommandLineFlags.h"
// When PathOps threaded tests get going, they're briefly a big consumer of lots of RAM.
// We disable the internal threading there by default on 32-bit builds.
static const bool is32Bit = sizeof(void*) == 4;
DEFINE_bool2(pathOpsExtended, x, false, "Run extended pathOps tests.");
DEFINE_bool2(pathOpsSingleThread, z, is32Bit, "Disallow pathOps tests from using threads.");
DEFINE_bool2(pathOpsVerbose, V, false, "Tell pathOps tests to be verbose.");
namespace DM {
bool TestReporter::allowExtendedTest() const { return FLAGS_pathOpsExtended; }
bool TestReporter::allowThreaded() const { return !FLAGS_pathOpsSingleThread; }
bool TestReporter::verbose() const { return FLAGS_pathOpsVerbose; }
static SkString test_name(const char* name) {
SkString result("test ");
result.append(name);
return result;
}
CpuTestTask::CpuTestTask(Reporter* reporter,
TaskRunner* taskRunner,
skiatest::TestRegistry::Factory factory)
: CpuTask(reporter, taskRunner)
, fTest(factory(NULL))
, fName(test_name(fTest->getName())) {}
GpuTestTask::GpuTestTask(Reporter* reporter,
TaskRunner* taskRunner,
skiatest::TestRegistry::Factory factory)
: GpuTask(reporter, taskRunner)
, fTest(factory(NULL))
, fName(test_name(fTest->getName())) {}
void CpuTestTask::draw() {
fTest->setReporter(&fTestReporter);
fTest->run();
if (!fTest->passed()) {
this->fail(fTestReporter.failure());
}
}
void GpuTestTask::draw(GrContextFactory* grFactory) {
fTest->setGrContextFactory(grFactory);
fTest->setReporter(&fTestReporter);
fTest->run();
if (!fTest->passed()) {
this->fail(fTestReporter.failure());
}
}
bool GpuTestTask::shouldSkip() const {
return kGPUDisabled;
}
} // namespace DM