OLD | NEW |
1 #include "DMReporter.h" | 1 #include "DMReporter.h" |
2 | 2 |
3 #include "SkDynamicAnnotations.h" | 3 #include "SkDynamicAnnotations.h" |
4 #include "SkCommonFlags.h" | 4 #include "SkCommonFlags.h" |
5 #include "OverwriteLine.h" | 5 #include "OverwriteLine.h" |
6 #include "ProcStats.h" | 6 #include "ProcStats.h" |
7 | 7 |
8 namespace DM { | 8 namespace DM { |
9 | 9 |
10 void Reporter::printStatus(SkString name, SkMSec timeMs) const { | 10 void Reporter::printStatus(SkString name, SkMSec timeMs) const { |
11 if (FLAGS_quiet) { | 11 if (FLAGS_quiet) { |
12 return; | 12 return; |
13 } | 13 } |
14 | 14 |
15 // It's okay if these are a little off---they're just for show---so we can r
ead unprotectedly. | 15 // It's okay if these are a little off---they're just for show---so we can r
ead unprotectedly. |
16 const int32_t failed = SK_ANNOTATE_UNPROTECTED_READ(fFailed); | 16 const int32_t failed = SK_ANNOTATE_UNPROTECTED_READ(fFailed); |
17 const int32_t pending = SK_ANNOTATE_UNPROTECTED_READ(fPending) - 1; | 17 const int32_t pending = SK_ANNOTATE_UNPROTECTED_READ(fPending) - 1; |
18 | 18 |
19 SkString status; | 19 SkString status; |
20 status.printf("%s%d tasks left", FLAGS_verbose ? "\n" : kSkOverwriteLine, pe
nding); | 20 status.printf("%s%d tasks left", FLAGS_verbose ? "\n" : kSkOverwriteLine, pe
nding); |
21 if (failed > 0) { | 21 if (failed > 0) { |
22 status.appendf(", %d failed", failed); | 22 status.appendf(", %d failed", failed); |
23 } | 23 } |
24 if (FLAGS_verbose) { | 24 if (FLAGS_verbose) { |
25 int max_rss_kb = sk_tools::getMaxResidentSetSizeKB(); | 25 int max_rss_mb = sk_tools::getMaxResidentSetSizeMB(); |
26 if (max_rss_kb >= 0) { | 26 if (max_rss_mb >= 0) { |
27 status.appendf("\t%4dM peak", max_rss_kb / 1024); | 27 status.appendf("\t%4dM peak", max_rss_mb); |
28 } | 28 } |
29 status.appendf("\t%5dms\t%s", timeMs, name.c_str()); | 29 status.appendf("\t%5dms\t%s", timeMs, name.c_str()); |
30 } | 30 } |
31 SkDebugf("%s", status.c_str()); | 31 SkDebugf("%s", status.c_str()); |
32 } | 32 } |
33 | 33 |
34 void Reporter::fail(SkString msg) { | 34 void Reporter::fail(SkString msg) { |
35 sk_atomic_inc(&fFailed); | 35 sk_atomic_inc(&fFailed); |
36 | 36 |
37 SkAutoMutexAcquire writer(&fMutex); | 37 SkAutoMutexAcquire writer(&fMutex); |
38 fFailures.push_back(msg); | 38 fFailures.push_back(msg); |
39 } | 39 } |
40 | 40 |
41 void Reporter::getFailures(SkTArray<SkString>* failures) const { | 41 void Reporter::getFailures(SkTArray<SkString>* failures) const { |
42 SkAutoMutexAcquire reader(&fMutex); | 42 SkAutoMutexAcquire reader(&fMutex); |
43 *failures = fFailures; | 43 *failures = fFailures; |
44 } | 44 } |
45 | 45 |
46 } // namespace DM | 46 } // namespace DM |
OLD | NEW |