diff options
author | Mathieu Chartier <mathieuc@google.com> | 2014-03-27 16:09:46 -0700 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2014-03-28 11:35:02 -0700 |
commit | 4aeec176eaf11fe03f342aadcbb79142230270ed (patch) | |
tree | b2c7abd4b3624dc1f801f6a29893e0f66497f378 /runtime/base | |
parent | a708e32a9f764a48175e705ec4bcd2201c84f492 (diff) | |
download | art-4aeec176eaf11fe03f342aadcbb79142230270ed.zip art-4aeec176eaf11fe03f342aadcbb79142230270ed.tar.gz art-4aeec176eaf11fe03f342aadcbb79142230270ed.tar.bz2 |
Refactor some GC code.
Reduced amount of code in mark sweep / semi space by moving
common logic to garbage_collector.cc. Cleaned up mod union tables
and deleted an unused implementation.
Change-Id: I4bcc6ba41afd96d230cfbaf4d6636f37c52e37ea
Diffstat (limited to 'runtime/base')
-rw-r--r-- | runtime/base/timing_logger.cc | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/runtime/base/timing_logger.cc b/runtime/base/timing_logger.cc index c769f64..a155002 100644 --- a/runtime/base/timing_logger.cc +++ b/runtime/base/timing_logger.cc @@ -54,7 +54,7 @@ void CumulativeLogger::Start() { void CumulativeLogger::End() { MutexLock mu(Thread::Current(), lock_); - iterations_++; + ++iterations_; } void CumulativeLogger::Reset() { @@ -66,13 +66,12 @@ void CumulativeLogger::Reset() { void CumulativeLogger::AddLogger(const TimingLogger &logger) { MutexLock mu(Thread::Current(), lock_); - const TimingLogger::SplitTimings& splits = logger.GetSplits(); - for (auto it = splits.begin(), end = splits.end(); it != end; ++it) { - TimingLogger::SplitTiming split = *it; + for (const TimingLogger::SplitTiming& split : logger.GetSplits()) { uint64_t split_time = split.first; const char* split_name = split.second; AddPair(split_name, split_time); } + ++iterations_; } size_t CumulativeLogger::GetIterations() const { @@ -161,8 +160,7 @@ void TimingLogger::NewSplit(const char* new_split_label) { uint64_t TimingLogger::GetTotalNs() const { uint64_t total_ns = 0; - for (auto it = splits_.begin(), end = splits_.end(); it != end; ++it) { - TimingLogger::SplitTiming split = *it; + for (const TimingLogger::SplitTiming& split : splits_) { total_ns += split.first; } return total_ns; @@ -171,8 +169,7 @@ uint64_t TimingLogger::GetTotalNs() const { void TimingLogger::Dump(std::ostream &os) const { uint64_t longest_split = 0; uint64_t total_ns = 0; - for (auto it = splits_.begin(), end = splits_.end(); it != end; ++it) { - TimingLogger::SplitTiming split = *it; + for (const SplitTiming& split : splits_) { uint64_t split_time = split.first; longest_split = std::max(longest_split, split_time); total_ns += split_time; @@ -181,8 +178,7 @@ void TimingLogger::Dump(std::ostream &os) const { TimeUnit tu = GetAppropriateTimeUnit(longest_split); uint64_t divisor = GetNsToTimeUnitDivisor(tu); // Print formatted splits. - for (auto it = splits_.begin(), end = splits_.end(); it != end; ++it) { - const TimingLogger::SplitTiming& split = *it; + for (const SplitTiming& split : splits_) { uint64_t split_time = split.first; if (!precise_ && divisor >= 1000) { // Make the fractional part 0. @@ -194,7 +190,6 @@ void TimingLogger::Dump(std::ostream &os) const { os << name_ << ": end, " << NsToMs(total_ns) << " ms\n"; } - TimingLogger::ScopedSplit::ScopedSplit(const char* label, TimingLogger* timing_logger) { DCHECK(label != NULL) << "New scoped split (" << label << ") with null label."; CHECK(timing_logger != NULL) << "New scoped split (" << label << ") without TimingLogger."; |