skia2/dm/DMReporter.h
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

38 lines
845 B
C++

#ifndef DMReporter_DEFINED
#define DMReporter_DEFINED
#include "SkString.h"
#include "SkTArray.h"
#include "SkThread.h"
#include "SkTime.h"
#include "SkTypes.h"
// Used to report status changes including failures. All public methods are threadsafe.
namespace DM {
class Reporter : SkNoncopyable {
public:
Reporter() : fStarted(0), fFinished(0) {}
void start() { sk_atomic_inc(&fStarted); }
void finish(SkString name, SkMSec timeMs);
void fail(SkString msg);
int32_t started() const { return fStarted; }
int32_t finished() const { return fFinished; }
int32_t failed() const;
void getFailures(SkTArray<SkString>*) const;
private:
int32_t fStarted, fFinished;
mutable SkMutex fMutex; // Guards fFailures.
SkTArray<SkString> fFailures;
};
} // namespace DM
#endif // DMReporter_DEFINED