diff options
Diffstat (limited to 'runtime/base')
-rw-r--r-- | runtime/base/timing_logger.cc | 2 | ||||
-rw-r--r-- | runtime/base/timing_logger.h | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/runtime/base/timing_logger.cc b/runtime/base/timing_logger.cc index 076bc11..fe18f66 100644 --- a/runtime/base/timing_logger.cc +++ b/runtime/base/timing_logger.cc @@ -45,6 +45,7 @@ CumulativeLogger::~CumulativeLogger() { } void CumulativeLogger::SetName(const std::string& name) { + MutexLock mu(Thread::Current(), lock_); name_.assign(name); } @@ -63,6 +64,7 @@ void CumulativeLogger::Reset() { } uint64_t CumulativeLogger::GetTotalNs() const { + MutexLock mu(Thread::Current(), lock_); return GetTotalTime() * kAdjust; } diff --git a/runtime/base/timing_logger.h b/runtime/base/timing_logger.h index c1ff0a3..b0bcf10 100644 --- a/runtime/base/timing_logger.h +++ b/runtime/base/timing_logger.h @@ -31,16 +31,15 @@ class TimingLogger; class CumulativeLogger { public: explicit CumulativeLogger(const std::string& name); - void prepare_stats(); ~CumulativeLogger(); void Start(); - void End(); - void Reset(); + void End() LOCKS_EXCLUDED(lock_); + void Reset() LOCKS_EXCLUDED(lock_); void Dump(std::ostream& os) LOCKS_EXCLUDED(lock_); uint64_t GetTotalNs() const; // Allow the name to be modified, particularly when the cumulative logger is a field within a // parent class that is unable to determine the "name" of a sub-class. - void SetName(const std::string& name); + void SetName(const std::string& name) LOCKS_EXCLUDED(lock_); void AddLogger(const TimingLogger& logger) LOCKS_EXCLUDED(lock_); size_t GetIterations() const; |