Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Unified Diff: dm/DM.cpp

Issue 1109813002: Add sharding to DM. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: in_shard() Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DM.cpp
diff --git a/dm/DM.cpp b/dm/DM.cpp
index c0fccaaa2c7bfcee54624fb32f02af5f4771161a..57de4c1d7f234748b2fd0884fb116731a349f054 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -46,6 +46,9 @@ DEFINE_string(uninterestingHashesFile, "",
"File containing a list of uninteresting hashes. If a result hashes to something in "
"this list, no image is written for that result.");
+DEFINE_int32(shards, 1, "We're splitting source data into this many shards.");
+DEFINE_int32(shard, 0, "Which shard do I run?");
+
__SK_FORCE_IMAGE_DECODER_LINKING;
using namespace DM;
@@ -167,9 +170,15 @@ static const bool kMemcpyOK = true;
static SkTArray<Tagged<Src>, kMemcpyOK> gSrcs;
static SkTArray<Tagged<Sink>, kMemcpyOK> gSinks;
+static bool in_shard() {
+ static int N = 0;
+ return N++ % FLAGS_shards == FLAGS_shard;
+}
+
static void push_src(const char* tag, const char* options, Src* s) {
SkAutoTDelete<Src> src(s);
- if (FLAGS_src.contains(tag) &&
+ if (in_shard() &&
+ FLAGS_src.contains(tag) &&
!SkCommandLineFlags::ShouldSkip(FLAGS_match, src->name().c_str())) {
Tagged<Src>& s = gSrcs.push_back();
s.reset(src.detach());
@@ -603,8 +612,10 @@ static void gather_tests() {
if (!FLAGS_src.contains("tests")) {
return;
}
- for (const skiatest::TestRegistry* r = skiatest::TestRegistry::Head(); r;
- r = r->next()) {
+ for (const skiatest::TestRegistry* r = skiatest::TestRegistry::Head(); r; r = r->next()) {
+ if (!in_shard()) {
+ continue;
+ }
// Despite its name, factory() is returning a reference to
// link-time static const POD data.
const skiatest::Test& test = r->factory();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698