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

Side by Side Diff: dm/DMReporter.cpp

Issue 309483003: DM tweaks (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: note Created 6 years, 6 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 | « dm/DMReporter.h ('k') | dm/DMTask.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "DMReporter.h" 1 #include "DMReporter.h"
2 2
3 #include "SkDynamicAnnotations.h"
3 #include "SkCommandLineFlags.h" 4 #include "SkCommandLineFlags.h"
4 #include "OverwriteLine.h" 5 #include "OverwriteLine.h"
5 6
6 DEFINE_bool2(quiet, q, false, "If true, don't print status updates."); 7 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."); 8 DEFINE_bool2(verbose, v, false, "If true, print status updates one-per-line.");
8 9
9 namespace DM { 10 namespace DM {
10 11
11 void Reporter::finish(SkString name, SkMSec timeMs) { 12 void Reporter::printStatus(SkString name, SkMSec timeMs) const {
12 sk_atomic_inc(&fFinished);
13
14 if (FLAGS_quiet) { 13 if (FLAGS_quiet) {
15 return; 14 return;
16 } 15 }
17 16
17 // It's okay if these are a little off---they're just for show---so we can r ead unprotectedly.
18 const int32_t failed = SK_ANNOTATE_UNPROTECTED_READ(fFailed);
19 const int32_t pending = SK_ANNOTATE_UNPROTECTED_READ(fPending) - 1;
20
18 SkString status; 21 SkString status;
19 status.printf("%s%d tasks left", 22 status.printf("%s%d tasks left", FLAGS_verbose ? "\n" : kSkOverwriteLine, pe nding);
20 FLAGS_verbose ? "\n" : kSkOverwriteLine,
21 this->started() - this->finished());
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 if (FLAGS_verbose) { 26 if (FLAGS_verbose) {
27 status.appendf("\t%5dms %s", timeMs, name.c_str()); 27 status.appendf("\t%5dms %s", timeMs, name.c_str());
28 } 28 }
29 SkDebugf("%s", status.c_str()); 29 SkDebugf("%s", status.c_str());
30 } 30 }
31 31
32 int32_t Reporter::failed() const { 32 void Reporter::fail(SkString msg) {
33 SkAutoMutexAcquire reader(&fMutex); 33 sk_atomic_inc(&fFailed);
34 return fFailures.count();
35 }
36 34
37 void Reporter::fail(SkString msg) {
38 SkAutoMutexAcquire writer(&fMutex); 35 SkAutoMutexAcquire writer(&fMutex);
39 fFailures.push_back(msg); 36 fFailures.push_back(msg);
40 } 37 }
41 38
42 void Reporter::getFailures(SkTArray<SkString>* failures) const { 39 void Reporter::getFailures(SkTArray<SkString>* failures) const {
43 SkAutoMutexAcquire reader(&fMutex); 40 SkAutoMutexAcquire reader(&fMutex);
44 *failures = fFailures; 41 *failures = fFailures;
45 } 42 }
46 43
47 } // namespace DM 44 } // namespace DM
OLDNEW
« no previous file with comments | « dm/DMReporter.h ('k') | dm/DMTask.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698