OLD | NEW |
1 #include "CrashHandler.h" | 1 #include "CrashHandler.h" |
2 #include "DMJsonWriter.h" | 2 #include "DMJsonWriter.h" |
3 #include "DMSrcSink.h" | 3 #include "DMSrcSink.h" |
4 #include "OverwriteLine.h" | 4 #include "OverwriteLine.h" |
5 #include "ProcStats.h" | 5 #include "ProcStats.h" |
6 #include "SkBBHFactory.h" | 6 #include "SkBBHFactory.h" |
7 #include "SkCommonFlags.h" | 7 #include "SkCommonFlags.h" |
8 #include "SkForceLinking.h" | 8 #include "SkForceLinking.h" |
9 #include "SkGraphics.h" | 9 #include "SkGraphics.h" |
10 #include "SkMD5.h" | 10 #include "SkMD5.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 static void fail(ImplicitString err) { | 39 static void fail(ImplicitString err) { |
40 SkAutoMutexAcquire lock(gFailuresMutex); | 40 SkAutoMutexAcquire lock(gFailuresMutex); |
41 SkDebugf("\n\nFAILURE: %s\n\n", err.c_str()); | 41 SkDebugf("\n\nFAILURE: %s\n\n", err.c_str()); |
42 gFailures.push_back(err); | 42 gFailures.push_back(err); |
43 } | 43 } |
44 | 44 |
45 static int32_t gPending = 0; // Atomic. | 45 static int32_t gPending = 0; // Atomic. |
46 | 46 |
47 static void done(double ms, ImplicitString config, ImplicitString src, ImplicitS
tring name) { | 47 static void done(double ms, ImplicitString config, ImplicitString src, ImplicitS
tring name) { |
| 48 int32_t pending = sk_atomic_dec(&gPending)-1; |
48 SkDebugf("%s(%4dMB %5d) %s\t%s %s %s ", FLAGS_verbose ? "\n" : kSkOverwrite
Line | 49 SkDebugf("%s(%4dMB %5d) %s\t%s %s %s ", FLAGS_verbose ? "\n" : kSkOverwrite
Line |
49 , sk_tools::getMaxResidentSetSizeMB() | 50 , sk_tools::getMaxResidentSetSizeMB() |
50 , sk_atomic_dec(&gPending)-1 | 51 , pending |
51 , HumanizeMs(ms).c_str() | 52 , HumanizeMs(ms).c_str() |
52 , config.c_str() | 53 , config.c_str() |
53 , src.c_str() | 54 , src.c_str() |
54 , name.c_str()); | 55 , name.c_str()); |
| 56 // We write our dm.json file every once in a while in case we crash. |
| 57 // Notice this also handles the final dm.json when pending == 0. |
| 58 if (pending % 500 == 0) { |
| 59 JsonWriter::DumpJson(); |
| 60 } |
55 } | 61 } |
56 | 62 |
57 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ | 63 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ |
58 | 64 |
59 template <typename T> | 65 template <typename T> |
60 struct Tagged : public SkAutoTDelete<T> { const char* tag; }; | 66 struct Tagged : public SkAutoTDelete<T> { const char* tag; }; |
61 | 67 |
62 static const bool kMemcpyOK = true; | 68 static const bool kMemcpyOK = true; |
63 | 69 |
64 static SkTArray<Tagged<Src>, kMemcpyOK> gSrcs; | 70 static SkTArray<Tagged<Src>, kMemcpyOK> gSrcs; |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 break; | 449 break; |
444 default: | 450 default: |
445 tg.add(run_enclave, &enclaves[i]); | 451 tg.add(run_enclave, &enclaves[i]); |
446 break; | 452 break; |
447 } | 453 } |
448 } | 454 } |
449 tg.wait(); | 455 tg.wait(); |
450 // At this point we're back in single-threaded land. | 456 // At this point we're back in single-threaded land. |
451 | 457 |
452 SkDebugf("\n"); | 458 SkDebugf("\n"); |
453 JsonWriter::DumpJson(); | |
454 | |
455 if (gFailures.count() > 0) { | 459 if (gFailures.count() > 0) { |
456 SkDebugf("Failures:\n"); | 460 SkDebugf("Failures:\n"); |
457 for (int i = 0; i < gFailures.count(); i++) { | 461 for (int i = 0; i < gFailures.count(); i++) { |
458 SkDebugf("\t%s\n", gFailures[i].c_str()); | 462 SkDebugf("\t%s\n", gFailures[i].c_str()); |
459 } | 463 } |
460 SkDebugf("%d failures\n", gFailures.count()); | 464 SkDebugf("%d failures\n", gFailures.count()); |
461 return 1; | 465 return 1; |
462 } | 466 } |
463 if (gPending > 0) { | 467 if (gPending > 0) { |
464 SkDebugf("Hrm, we didn't seem to run everything we intended to! Please
file a bug.\n"); | 468 SkDebugf("Hrm, we didn't seem to run everything we intended to! Please
file a bug.\n"); |
465 return 1; | 469 return 1; |
466 } | 470 } |
467 return 0; | 471 return 0; |
468 } | 472 } |
469 | 473 |
470 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 474 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
471 int main(int argc, char** argv) { | 475 int main(int argc, char** argv) { |
472 SkCommandLineFlags::Parse(argc, argv); | 476 SkCommandLineFlags::Parse(argc, argv); |
473 return dm_main(); | 477 return dm_main(); |
474 } | 478 } |
475 #endif | 479 #endif |
OLD | NEW |