OLD | NEW |
1 #include "DMReporter.h" | 1 #include "DMReporter.h" |
2 | 2 |
3 #include "SkCommandLineFlags.h" | 3 #include "SkCommandLineFlags.h" |
4 #include "OverwriteLine.h" | 4 #include "OverwriteLine.h" |
5 | 5 |
6 DEFINE_bool2(quiet, q, false, "If true, don't print status updates."); | 6 DEFINE_bool2(quiet, q, false, "If true, don't print status updates."); |
7 DEFINE_bool2(verbose, v, false, "If true, print status updates one-per-line."); | 7 DEFINE_bool2(verbose, v, false, "If true, print status updates one-per-line."); |
8 | 8 |
9 namespace DM { | 9 namespace DM { |
10 | 10 |
11 void Reporter::finish(SkString name) { | 11 void Reporter::finish(SkString name, SkMSec timeMs) { |
12 sk_atomic_inc(&fFinished); | 12 sk_atomic_inc(&fFinished); |
13 | 13 |
14 if (FLAGS_quiet) { | 14 if (FLAGS_quiet) { |
15 return; | 15 return; |
16 } | 16 } |
17 | 17 |
18 SkString status; | 18 SkString status; |
19 status.printf("%s%d tasks left", | 19 status.printf("%s%d tasks left", |
20 FLAGS_verbose ? "\n" : kSkOverwriteLine, | 20 FLAGS_verbose ? "\n" : kSkOverwriteLine, |
21 this->started() - this->finished()); | 21 this->started() - this->finished()); |
22 const int failed = this->failed(); | 22 const int failed = this->failed(); |
23 if (failed > 0) { | 23 if (failed > 0) { |
24 status.appendf(", %d failed", failed); | 24 status.appendf(", %d failed", failed); |
25 } | 25 } |
26 status.appendf("\t[%s done]", name.c_str()); | 26 if (FLAGS_verbose) { |
| 27 status.appendf("\t%5dms %s", timeMs, name.c_str()); |
| 28 } |
27 SkDebugf("%s", status.c_str()); | 29 SkDebugf("%s", status.c_str()); |
28 } | 30 } |
29 | 31 |
30 int32_t Reporter::failed() const { | 32 int32_t Reporter::failed() const { |
31 SkAutoMutexAcquire reader(&fMutex); | 33 SkAutoMutexAcquire reader(&fMutex); |
32 return fFailures.count(); | 34 return fFailures.count(); |
33 } | 35 } |
34 | 36 |
35 void Reporter::fail(SkString msg) { | 37 void Reporter::fail(SkString msg) { |
36 SkAutoMutexAcquire writer(&fMutex); | 38 SkAutoMutexAcquire writer(&fMutex); |
37 fFailures.push_back(msg); | 39 fFailures.push_back(msg); |
38 } | 40 } |
39 | 41 |
40 void Reporter::getFailures(SkTArray<SkString>* failures) const { | 42 void Reporter::getFailures(SkTArray<SkString>* failures) const { |
41 SkAutoMutexAcquire reader(&fMutex); | 43 SkAutoMutexAcquire reader(&fMutex); |
42 *failures = fFailures; | 44 *failures = fFailures; |
43 } | 45 } |
44 | 46 |
45 } // namespace DM | 47 } // namespace DM |
OLD | NEW |