skia2/dm/DMReporter.cpp
commit-bot@chromium.org a39874b636 DM: tweak output.
Show task name in verbose mode only, and add task runtime.

BUG=skia:
R=reed@google.com, bsalomon@google.com, mtklein@google.com

Author: mtklein@chromium.org

Review URL: https://codereview.chromium.org/185233004

git-svn-id: http://skia.googlecode.com/svn/trunk@13639 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-03-03 15:44:56 +00:00

48 lines
1.1 KiB
C++

#include "DMReporter.h"
#include "SkCommandLineFlags.h"
#include "OverwriteLine.h"
DEFINE_bool2(quiet, q, false, "If true, don't print status updates.");
DEFINE_bool2(verbose, v, false, "If true, print status updates one-per-line.");
namespace DM {
void Reporter::finish(SkString name, SkMSec timeMs) {
sk_atomic_inc(&fFinished);
if (FLAGS_quiet) {
return;
}
SkString status;
status.printf("%s%d tasks left",
FLAGS_verbose ? "\n" : kSkOverwriteLine,
this->started() - this->finished());
const int failed = this->failed();
if (failed > 0) {
status.appendf(", %d failed", failed);
}
if (FLAGS_verbose) {
status.appendf("\t%5dms %s", timeMs, name.c_str());
}
SkDebugf("%s", status.c_str());
}
int32_t Reporter::failed() const {
SkAutoMutexAcquire reader(&fMutex);
return fFailures.count();
}
void Reporter::fail(SkString msg) {
SkAutoMutexAcquire writer(&fMutex);
fFailures.push_back(msg);
}
void Reporter::getFailures(SkTArray<SkString>* failures) const {
SkAutoMutexAcquire reader(&fMutex);
*failures = fFailures;
}
} // namespace DM