2013-10-16 13:02:15 +00:00
|
|
|
#include "DMReporter.h"
|
|
|
|
|
2014-05-29 20:14:48 +00:00
|
|
|
#include "SkDynamicAnnotations.h"
|
2014-07-22 17:15:34 +00:00
|
|
|
#include "SkCommonFlags.h"
|
2014-01-02 16:19:53 +00:00
|
|
|
#include "OverwriteLine.h"
|
2014-08-11 18:33:51 +00:00
|
|
|
#include "ProcStats.h"
|
2014-08-04 21:10:19 +00:00
|
|
|
|
2013-10-16 13:02:15 +00:00
|
|
|
namespace DM {
|
|
|
|
|
2014-05-29 20:14:48 +00:00
|
|
|
void Reporter::printStatus(SkString name, SkMSec timeMs) const {
|
2013-10-29 15:02:17 +00:00
|
|
|
if (FLAGS_quiet) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-05-29 20:14:48 +00:00
|
|
|
// It's okay if these are a little off---they're just for show---so we can read unprotectedly.
|
|
|
|
const int32_t failed = SK_ANNOTATE_UNPROTECTED_READ(fFailed);
|
|
|
|
const int32_t pending = SK_ANNOTATE_UNPROTECTED_READ(fPending) - 1;
|
|
|
|
|
2013-10-18 20:52:44 +00:00
|
|
|
SkString status;
|
2014-05-29 20:14:48 +00:00
|
|
|
status.printf("%s%d tasks left", FLAGS_verbose ? "\n" : kSkOverwriteLine, pending);
|
2013-10-18 20:52:44 +00:00
|
|
|
if (failed > 0) {
|
|
|
|
status.appendf(", %d failed", failed);
|
|
|
|
}
|
2014-03-03 15:44:56 +00:00
|
|
|
if (FLAGS_verbose) {
|
2014-08-19 22:55:55 +00:00
|
|
|
int max_rss_mb = sk_tools::getMaxResidentSetSizeMB();
|
|
|
|
if (max_rss_mb >= 0) {
|
|
|
|
status.appendf("\t%4dM peak", max_rss_mb);
|
2014-08-04 21:10:19 +00:00
|
|
|
}
|
|
|
|
status.appendf("\t%5dms\t%s", timeMs, name.c_str());
|
2014-03-03 15:44:56 +00:00
|
|
|
}
|
2014-02-28 20:28:59 +00:00
|
|
|
SkDebugf("%s", status.c_str());
|
2013-10-16 13:02:15 +00:00
|
|
|
}
|
|
|
|
|
2014-02-26 16:31:22 +00:00
|
|
|
void Reporter::fail(SkString msg) {
|
2014-05-29 20:14:48 +00:00
|
|
|
sk_atomic_inc(&fFailed);
|
|
|
|
|
2013-10-16 13:02:15 +00:00
|
|
|
SkAutoMutexAcquire writer(&fMutex);
|
2014-02-26 16:31:22 +00:00
|
|
|
fFailures.push_back(msg);
|
2013-10-16 13:02:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Reporter::getFailures(SkTArray<SkString>* failures) const {
|
|
|
|
SkAutoMutexAcquire reader(&fMutex);
|
|
|
|
*failures = fFailures;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace DM
|