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

Side by Side Diff: dm/DM.cpp

Issue 1059363002: Add --uninterestingHashesFile to DM (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix TYPO_TYPO 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 unified diff | Download patch
« no previous file with comments | « no previous file | tools/get_uploaded_hashes.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "CrashHandler.h" 8 #include "CrashHandler.h"
9 #include "DMJsonWriter.h" 9 #include "DMJsonWriter.h"
10 #include "DMSrcSink.h" 10 #include "DMSrcSink.h"
(...skipping 24 matching lines...) Expand all
35 "'matrix' or 'upright' in config."); 35 "'matrix' or 'upright' in config.");
36 DEFINE_bool(gpu_threading, false, "Allow GPU work to run on multiple threads?"); 36 DEFINE_bool(gpu_threading, false, "Allow GPU work to run on multiple threads?");
37 37
38 DEFINE_string(blacklist, "", 38 DEFINE_string(blacklist, "",
39 "Space-separated config/src/srcOptions/name quadruples to blacklist. '_ ' matches anything. E.g. \n" 39 "Space-separated config/src/srcOptions/name quadruples to blacklist. '_ ' matches anything. E.g. \n"
40 "'--blacklist gpu skp _ _' will blacklist all SKPs drawn into the gpu co nfig.\n" 40 "'--blacklist gpu skp _ _' will blacklist all SKPs drawn into the gpu co nfig.\n"
41 "'--blacklist gpu skp _ _ 8888 gm _ aarects' will also blacklist the aar ects GM on 8888."); 41 "'--blacklist gpu skp _ _ 8888 gm _ aarects' will also blacklist the aar ects GM on 8888.");
42 42
43 DEFINE_string2(readPath, r, "", "If set check for equality with golden results i n this directory."); 43 DEFINE_string2(readPath, r, "", "If set check for equality with golden results i n this directory.");
44 44
45 DEFINE_string(uninterestingHashesFile, "",
46 "File containing a list of uninteresting hashes. If a result hashes to s omething in "
47 "this list, no image is written for that result.");
48
45 __SK_FORCE_IMAGE_DECODER_LINKING; 49 __SK_FORCE_IMAGE_DECODER_LINKING;
46 using namespace DM; 50 using namespace DM;
47 51
48 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/ 52 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/
49 53
50 SK_DECLARE_STATIC_MUTEX(gFailuresMutex); 54 SK_DECLARE_STATIC_MUTEX(gFailuresMutex);
51 static SkTArray<SkString> gFailures; 55 static SkTArray<SkString> gFailures;
52 56
53 static void fail(ImplicitString err) { 57 static void fail(ImplicitString err) {
54 SkAutoMutexAcquire lock(gFailuresMutex); 58 SkAutoMutexAcquire lock(gFailuresMutex);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 SkString path(FLAGS_readPath[0]); 134 SkString path(FLAGS_readPath[0]);
131 path.append("/dm.json"); 135 path.append("/dm.json");
132 if (!JsonWriter::ReadJson(path.c_str(), add_gold)) { 136 if (!JsonWriter::ReadJson(path.c_str(), add_gold)) {
133 fail(SkStringPrintf("Couldn't read %s for golden results.", path.c_s tr())); 137 fail(SkStringPrintf("Couldn't read %s for golden results.", path.c_s tr()));
134 } 138 }
135 } 139 }
136 } 140 }
137 141
138 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/ 142 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/
139 143
144 static SkTHashSet<SkString> gUninterestingHashes;
145
146 static void gather_uninteresting_hashes() {
147 if (!FLAGS_uninterestingHashesFile.isEmpty()) {
148 SkAutoTUnref<SkData> data(SkData::NewFromFileName(FLAGS_uninterestingHas hesFile[0]));
149 SkTArray<SkString> hashes;
150 SkStrSplit((const char*)data->data(), "\n", &hashes);
151 for (const SkString& hash : hashes) {
152 gUninterestingHashes.add(hash);
153 }
154 }
155 }
156
157 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/
158
140 template <typename T> 159 template <typename T>
141 struct Tagged : public SkAutoTDelete<T> { 160 struct Tagged : public SkAutoTDelete<T> {
142 const char* tag; 161 const char* tag;
143 const char* options; 162 const char* options;
144 }; 163 };
145 164
146 static const bool kMemcpyOK = true; 165 static const bool kMemcpyOK = true;
147 166
148 static SkTArray<Tagged<Src>, kMemcpyOK> gSrcs; 167 static SkTArray<Tagged<Src>, kMemcpyOK> gSrcs;
149 static SkTArray<Tagged<Sink>, kMemcpyOK> gSinks; 168 static SkTArray<Tagged<Sink>, kMemcpyOK> gSinks;
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 task->src.options, name, md5))) { 447 task->src.options, name, md5))) {
429 fail(SkStringPrintf("%s not found for %s %s %s %s in %s", 448 fail(SkStringPrintf("%s not found for %s %s %s %s in %s",
430 md5.c_str(), 449 md5.c_str(),
431 task->sink.tag, 450 task->sink.tag,
432 task->src.tag, 451 task->src.tag,
433 task->src.options, 452 task->src.options,
434 name.c_str(), 453 name.c_str(),
435 FLAGS_readPath[0])); 454 FLAGS_readPath[0]));
436 } 455 }
437 456
438 if (!FLAGS_writePath.isEmpty()) { 457 if (!FLAGS_writePath.isEmpty() && !gUninterestingHashes.contains(md5 )) {
439 const char* ext = task->sink->fileExtension(); 458 const char* ext = task->sink->fileExtension();
440 if (data->getLength()) { 459 if (data->getLength()) {
441 WriteToDisk(*task, md5, ext, data, data->getLength(), NULL); 460 WriteToDisk(*task, md5, ext, data, data->getLength(), NULL);
442 SkASSERT(bitmap.drawsNothing()); 461 SkASSERT(bitmap.drawsNothing());
443 } else if (!bitmap.drawsNothing()) { 462 } else if (!bitmap.drawsNothing()) {
444 WriteToDisk(*task, md5, ext, NULL, 0, &bitmap); 463 WriteToDisk(*task, md5, ext, NULL, 0, &bitmap);
445 } 464 }
446 } 465 }
447 } 466 }
448 timer.end(); 467 timer.end();
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 SetupCrashHandler(); 637 SetupCrashHandler();
619 SkAutoGraphics ag; 638 SkAutoGraphics ag;
620 SkTaskGroup::Enabler enabled(FLAGS_threads); 639 SkTaskGroup::Enabler enabled(FLAGS_threads);
621 if (FLAGS_leaks) { 640 if (FLAGS_leaks) {
622 SkInstCountPrintLeaksOnExit(); 641 SkInstCountPrintLeaksOnExit();
623 } 642 }
624 643
625 start_keepalive(); 644 start_keepalive();
626 645
627 gather_gold(); 646 gather_gold();
647 gather_uninteresting_hashes();
628 648
629 gather_srcs(); 649 gather_srcs();
630 gather_sinks(); 650 gather_sinks();
631 gather_tests(); 651 gather_tests();
632 652
633 gPending = gSrcs.count() * gSinks.count() + gThreadedTests.count() + gGPUTes ts.count(); 653 gPending = gSrcs.count() * gSinks.count() + gThreadedTests.count() + gGPUTes ts.count();
634 SkDebugf("%d srcs * %d sinks + %d tests == %d tasks\n", 654 SkDebugf("%d srcs * %d sinks + %d tests == %d tasks\n",
635 gSrcs.count(), gSinks.count(), gThreadedTests.count() + gGPUTests.c ount(), gPending); 655 gSrcs.count(), gSinks.count(), gThreadedTests.count() + gGPUTests.c ount(), gPending);
636 656
637 // We try to exploit as much parallelism as is safe. Most Src/Sink pairs ru n on any thread, 657 // We try to exploit as much parallelism as is safe. Most Src/Sink pairs ru n on any thread,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 } 698 }
679 return 0; 699 return 0;
680 } 700 }
681 701
682 #if !defined(SK_BUILD_FOR_IOS) 702 #if !defined(SK_BUILD_FOR_IOS)
683 int main(int argc, char** argv) { 703 int main(int argc, char** argv) {
684 SkCommandLineFlags::Parse(argc, argv); 704 SkCommandLineFlags::Parse(argc, argv);
685 return dm_main(); 705 return dm_main();
686 } 706 }
687 #endif 707 #endif
OLDNEW
« no previous file with comments | « no previous file | tools/get_uploaded_hashes.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698