summaryrefslogtreecommitdiffstats
path: root/runtime/base
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/base')
-rw-r--r--runtime/base/timing_logger.cc2
-rw-r--r--runtime/base/timing_logger.h7
2 files changed, 5 insertions, 4 deletions
diff --git a/runtime/base/timing_logger.cc b/runtime/base/timing_logger.cc
index c8dee6d..bb32b2d 100644
--- a/runtime/base/timing_logger.cc
+++ b/runtime/base/timing_logger.cc
@@ -43,6 +43,7 @@ CumulativeLogger::~CumulativeLogger() {
}
void CumulativeLogger::SetName(const std::string& name) {
+ MutexLock mu(Thread::Current(), lock_);
name_.assign(name);
}
@@ -61,6 +62,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;