2013-10-16 13:02:15 +00:00
|
|
|
#include "DMReporter.h"
|
|
|
|
|
2013-10-29 15:02:17 +00:00
|
|
|
#include "SkCommandLineFlags.h"
|
2014-01-02 16:19:53 +00:00
|
|
|
#include "OverwriteLine.h"
|
2013-10-29 15:02:17 +00:00
|
|
|
|
|
|
|
DEFINE_bool(quiet, false, "If true, don't print status updates.");
|
|
|
|
|
2013-10-16 13:02:15 +00:00
|
|
|
namespace DM {
|
|
|
|
|
|
|
|
void Reporter::updateStatusLine() const {
|
2013-10-29 15:02:17 +00:00
|
|
|
if (FLAGS_quiet) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-10-18 20:52:44 +00:00
|
|
|
SkString status;
|
2014-01-02 16:19:53 +00:00
|
|
|
status.printf("%s%d tasks left", kSkOverwriteLine, this->started() - this->finished());
|
2013-10-18 20:52:44 +00:00
|
|
|
const int failed = this->failed();
|
|
|
|
if (failed > 0) {
|
|
|
|
status.appendf(", %d failed", failed);
|
|
|
|
}
|
|
|
|
SkDebugf(status.c_str());
|
2013-10-16 13:02:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int32_t Reporter::failed() const {
|
|
|
|
SkAutoMutexAcquire reader(&fMutex);
|
|
|
|
return fFailures.count();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Reporter::fail(SkString name) {
|
|
|
|
SkAutoMutexAcquire writer(&fMutex);
|
|
|
|
fFailures.push_back(name);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Reporter::getFailures(SkTArray<SkString>* failures) const {
|
|
|
|
SkAutoMutexAcquire reader(&fMutex);
|
|
|
|
*failures = fFailures;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace DM
|