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

Side by Side Diff: tools/skpdiff/skpdiff_main.cpp

Issue 27541003: add initial support ofr multi-threaded execution (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
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 #if SK_SUPPORT_OPENCL 8 #if SK_SUPPORT_OPENCL
9 9
10 #define __NO_STD_VECTOR // Uses cl::vectpr instead of std::vectpr 10 #define __NO_STD_VECTOR // Uses cl::vectpr instead of std::vectpr
(...skipping 22 matching lines...) Expand all
33 __SK_FORCE_IMAGE_DECODER_LINKING; 33 __SK_FORCE_IMAGE_DECODER_LINKING;
34 34
35 // Command line argument definitions go here 35 // Command line argument definitions go here
36 DEFINE_bool2(list, l, false, "List out available differs"); 36 DEFINE_bool2(list, l, false, "List out available differs");
37 DEFINE_string2(differs, d, "", "The names of the differs to use or all of them b y default"); 37 DEFINE_string2(differs, d, "", "The names of the differs to use or all of them b y default");
38 DEFINE_string2(folders, f, "", "Compare two folders with identical subfile names : <baseline folder> <test folder>"); 38 DEFINE_string2(folders, f, "", "Compare two folders with identical subfile names : <baseline folder> <test folder>");
39 DEFINE_string2(patterns, p, "", "Use two patterns to compare images: <baseline> <test>"); 39 DEFINE_string2(patterns, p, "", "Use two patterns to compare images: <baseline> <test>");
40 DEFINE_string2(output, o, "", "Writes the output of these diffs to output: <outp ut>"); 40 DEFINE_string2(output, o, "", "Writes the output of these diffs to output: <outp ut>");
41 DEFINE_bool(jsonp, true, "Output JSON with padding"); 41 DEFINE_bool(jsonp, true, "Output JSON with padding");
42 DEFINE_string(csv, "", "Writes the output of these diffs to a csv file"); 42 DEFINE_string(csv, "", "Writes the output of these diffs to a csv file");
43 DEFINE_int32(threads, -1, "run N threads in parallel [default is derived from CP Us available]");
43 44
44 #if SK_SUPPORT_OPENCL 45 #if SK_SUPPORT_OPENCL
45 /// A callback for any OpenCL errors 46 /// A callback for any OpenCL errors
46 static void CL_CALLBACK error_notify(const char* errorInfo, const void* privateI nfoSize, ::size_t cb, void* userData) { 47 static void CL_CALLBACK error_notify(const char* errorInfo, const void* privateI nfoSize, ::size_t cb, void* userData) {
47 SkDebugf("OpenCL error notify: %s\n", errorInfo); 48 SkDebugf("OpenCL error notify: %s\n", errorInfo);
48 exit(1); 49 exit(1);
49 } 50 }
50 51
51 /// Creates a device and context with OpenCL 52 /// Creates a device and context with OpenCL
52 static bool init_device_and_context(cl::Device* device, cl::Context* context) { 53 static bool init_device_and_context(cl::Device* device, cl::Context* context) {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 if (!FLAGS_csv.isEmpty()) { 182 if (!FLAGS_csv.isEmpty()) {
182 if (1 != FLAGS_csv.count()) { 183 if (1 != FLAGS_csv.count()) {
183 SkDebugf("csv flag expects one argument: <csv file>\n"); 184 SkDebugf("csv flag expects one argument: <csv file>\n");
184 return 1; 185 return 1;
185 } 186 }
186 } 187 }
187 188
188 SkDiffContext ctx; 189 SkDiffContext ctx;
189 ctx.setDiffers(chosenDiffers); 190 ctx.setDiffers(chosenDiffers);
190 191
192 if (FLAGS_threads >= 0) {
193 ctx.setThreadCount(FLAGS_threads);
194 }
195
191 // Perform a folder diff if one is requested 196 // Perform a folder diff if one is requested
192 if (!FLAGS_folders.isEmpty()) { 197 if (!FLAGS_folders.isEmpty()) {
193 ctx.diffDirectories(FLAGS_folders[0], FLAGS_folders[1]); 198 ctx.diffDirectories(FLAGS_folders[0], FLAGS_folders[1]);
194 } 199 }
195 200
196 // Perform a pattern diff if one is requested 201 // Perform a pattern diff if one is requested
197 if (!FLAGS_patterns.isEmpty()) { 202 if (!FLAGS_patterns.isEmpty()) {
198 ctx.diffPatterns(FLAGS_patterns[0], FLAGS_patterns[1]); 203 ctx.diffPatterns(FLAGS_patterns[0], FLAGS_patterns[1]);
199 } 204 }
200 205
201 // Output to the file specified 206 // Output to the file specified
202 if (!FLAGS_output.isEmpty()) { 207 if (!FLAGS_output.isEmpty()) {
203 SkFILEWStream outputStream(FLAGS_output[0]); 208 SkFILEWStream outputStream(FLAGS_output[0]);
204 ctx.outputRecords(outputStream, FLAGS_jsonp); 209 ctx.outputRecords(outputStream, FLAGS_jsonp);
205 } 210 }
206 211
207 if (!FLAGS_csv.isEmpty()) { 212 if (!FLAGS_csv.isEmpty()) {
208 SkFILEWStream outputStream(FLAGS_csv[0]); 213 SkFILEWStream outputStream(FLAGS_csv[0]);
209 ctx.outputCsv(outputStream); 214 ctx.outputCsv(outputStream);
210 } 215 }
211 216
212 return 0; 217 return 0;
213 } 218 }
214 219
215 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) 220 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)
216 int main(int argc, char * argv[]) { 221 int main(int argc, char * argv[]) {
217 return tool_main(argc, (char**) argv); 222 return tool_main(argc, (char**) argv);
218 } 223 }
219 #endif 224 #endif
OLDNEW
« tools/skpdiff/SkDiffContext.cpp ('K') | « tools/skpdiff/SkDiffContext.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698