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

Side by Side Diff: tools/render_pdfs_main.cpp

Issue 448993003: Process Statistics header, add max RSS to render_pdfs (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: compiles on macos and ios Created 6 years, 4 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 | « tools/ProcStats.cpp ('k') | no next file » | 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 2012 Google Inc. 2 * Copyright 2012 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 "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkCommandLineFlags.h" 9 #include "SkCommandLineFlags.h"
10 #include "SkDevice.h" 10 #include "SkDevice.h"
11 #include "SkForceLinking.h" 11 #include "SkForceLinking.h"
12 #include "SkGraphics.h" 12 #include "SkGraphics.h"
13 #include "SkImageEncoder.h" 13 #include "SkImageEncoder.h"
14 #include "SkOSFile.h" 14 #include "SkOSFile.h"
15 #include "SkPicture.h" 15 #include "SkPicture.h"
16 #include "SkPixelRef.h" 16 #include "SkPixelRef.h"
17 #include "SkStream.h" 17 #include "SkStream.h"
18 #include "SkTArray.h" 18 #include "SkTArray.h"
19 #include "SkTSort.h" 19 #include "SkTSort.h"
20 #include "PdfRenderer.h" 20 #include "PdfRenderer.h"
21 #include "ProcStats.h"
21 #include "picture_utils.h" 22 #include "picture_utils.h"
22 23
23 __SK_FORCE_IMAGE_DECODER_LINKING; 24 __SK_FORCE_IMAGE_DECODER_LINKING;
24 25
25 #ifdef SK_USE_CDB 26 #ifdef SK_USE_CDB
26 #include "win_dbghelp.h" 27 #include "win_dbghelp.h"
27 #endif 28 #endif
28 29
29 /** 30 /**
30 * render_pdfs 31 * render_pdfs
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 files.push_back( 213 files.push_back(
213 SkOSPath::Join(input, inputFilename.c_str())); 214 SkOSPath::Join(input, inputFilename.c_str()));
214 } 215 }
215 } 216 }
216 } else { 217 } else {
217 if (!SkCommandLineFlags::ShouldSkip(FLAGS_match, input)) { 218 if (!SkCommandLineFlags::ShouldSkip(FLAGS_match, input)) {
218 files.push_back(SkString(input)); 219 files.push_back(SkString(input));
219 } 220 }
220 } 221 }
221 } 222 }
222 SkTQSort<SkString>(files.begin(), files.end() - 1); 223 if (files.count() > 0) {
224 SkTQSort<SkString>(files.begin(), files.end() - 1);
225 }
223 int failures = 0; 226 int failures = 0;
224 for (int i = 0; i < files.count(); i ++) { 227 for (int i = 0; i < files.count(); i ++) {
225 if (!render_pdf(files[i], outputDir, renderer)) { 228 if (!render_pdf(files[i], outputDir, renderer)) {
226 ++failures; 229 ++failures;
227 } 230 }
228 } 231 }
229 return failures; 232 return failures;
230 } 233 }
231 234
232 int tool_main_core(int argc, char** argv); 235 int tool_main_core(int argc, char** argv);
233 int tool_main_core(int argc, char** argv) { 236 int tool_main_core(int argc, char** argv) {
234 SkCommandLineFlags::Parse(argc, argv); 237 SkCommandLineFlags::Parse(argc, argv);
235 238
236 SkAutoGraphics ag; 239 SkAutoGraphics ag;
237 240
238 SkAutoTUnref<sk_tools::PdfRenderer> 241 SkAutoTUnref<sk_tools::PdfRenderer>
239 renderer(SkNEW_ARGS(sk_tools::SimplePdfRenderer, (encode_to_dct_data))); 242 renderer(SkNEW_ARGS(sk_tools::SimplePdfRenderer, (encode_to_dct_data)));
240 SkASSERT(renderer.get()); 243 SkASSERT(renderer.get());
241 244
242 SkString outputDir; 245 SkString outputDir;
243 if (FLAGS_outputDir.count() > 0) { 246 if (FLAGS_outputDir.count() > 0) {
244 outputDir = FLAGS_outputDir[0]; 247 outputDir = FLAGS_outputDir[0];
245 } 248 }
246 249
247 int failures = process_input(FLAGS_inputPaths, outputDir, *renderer); 250 int failures = process_input(FLAGS_inputPaths, outputDir, *renderer);
248 251
252 int max_rss_kb = sk_tools::getMaxResidentSetSizeKB();
253 if (max_rss_kb >= 0) {
254 SkDebugf("%4dM peak ResidentSetSize\n", max_rss_kb / 1024);
255 }
256
249 if (failures != 0) { 257 if (failures != 0) {
250 SkDebugf("Failed to render %i PDFs.\n", failures); 258 SkDebugf("Failed to render %i PDFs.\n", failures);
251 return 1; 259 return 1;
252 } 260 }
253 261
254 return 0; 262 return 0;
255 } 263 }
256 264
257 int tool_main(int argc, char** argv); 265 int tool_main(int argc, char** argv);
258 int tool_main(int argc, char** argv) { 266 int tool_main(int argc, char** argv) {
(...skipping 10 matching lines...) Expand all
269 } 277 }
270 #endif 278 #endif
271 return 0; 279 return 0;
272 } 280 }
273 281
274 #if !defined SK_BUILD_FOR_IOS 282 #if !defined SK_BUILD_FOR_IOS
275 int main(int argc, char * const argv[]) { 283 int main(int argc, char * const argv[]) {
276 return tool_main(argc, (char**) argv); 284 return tool_main(argc, (char**) argv);
277 } 285 }
278 #endif 286 #endif
OLDNEW
« no previous file with comments | « tools/ProcStats.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698