diff options
author | 2011-12-13 17:24:52 -0800 | |
---|---|---|
committer | 2011-12-13 17:24:52 -0800 | |
commit | b87f73ea7524f6eb9da6da1af931a3d3fbb833ff (patch) | |
tree | 9158c8b7e6f56f133d19f0745b089143d7c1b82f | |
parent | 573db4a2077380d81fa74ee2309162530db87a98 (diff) | |
parent | 5d78d39273f4a2576093a35cc6a085f5c8604a5e (diff) |
Merge "Improve consistency of units in logging." into dalvik-dev
-rw-r--r-- | src/heap.cc | 20 | ||||
-rw-r--r-- | src/hprof/hprof.cc | 3 | ||||
-rw-r--r-- | src/object.cc | 3 |
3 files changed, 12 insertions, 14 deletions
diff --git a/src/heap.cc b/src/heap.cc index 07ed14f934..129c6f4649 100644 --- a/src/heap.cc +++ b/src/heap.cc @@ -220,7 +220,7 @@ void Heap::VerifyObjectLocked(const Object* obj) { Object::ClassOffset().Int32Value(); const Class* c = *reinterpret_cast<Class* const *>(raw_addr); if (c == NULL) { - LOG(FATAL) << "Null class" << " in object: " << obj; + LOG(FATAL) << "Null class in object: " << obj; } else if (!IsAligned<kObjectAlignment>(c)) { LOG(FATAL) << "Class isn't aligned: " << c << " in object: " << obj; } else if (!live_bitmap_->Test(c)) { @@ -257,7 +257,7 @@ void Heap::RecordAllocationLocked(Space* space, const Object* obj) { } #endif size_t size = space->AllocationSize(obj); - DCHECK_NE(size, 0u); + DCHECK_GT(size, 0u); num_bytes_allocated_ += size; num_objects_allocated_ += 1; @@ -378,8 +378,8 @@ Object* Heap::AllocateLocked(Space* space, size_t size) { // OLD-TODO: may want to grow a little bit more so that the amount of // free space is equal to the old free space + the // utilization slop for the new allocation. - VLOG(gc) << "Grow heap (frag case) to " << new_footprint / MB - << " for " << size << "-byte allocation"; + VLOG(gc) << "Grow heap (frag case) to " << (new_footprint/KB) << "KiB " + << "for a " << size << "-byte allocation"; return ptr; } @@ -397,7 +397,7 @@ Object* Heap::AllocateLocked(Space* space, size_t size) { return ptr; } - LOG(ERROR) << "Out of memory on a " << size << " byte allocation"; + LOG(ERROR) << "Out of memory on a " << size << "-byte allocation"; // TODO: tell the HeapSource to dump its state // TODO: dump stack traces for all threads @@ -524,7 +524,7 @@ void Heap::CollectGarbageInternal() { // TODO: somehow make the specific GC implementation (here MarkSweep) responsible for logging. size_t bytes_freed = initial_size - num_bytes_allocated_; bool is_small = (bytes_freed > 0 && bytes_freed < 1024); - size_t kib_freed = (bytes_freed > 0 ? std::max(bytes_freed/1024, 1U) : 0); + size_t kib_freed = (bytes_freed > 0 ? std::max(bytes_freed/KB, 1U) : 0); size_t total = GetTotalMemory(); size_t percentFree = 100 - static_cast<size_t>(100.0f * float(num_bytes_allocated_) / total); @@ -534,7 +534,7 @@ void Heap::CollectGarbageInternal() { if (VLOG_IS_ON(gc) || gc_was_particularly_slow) { LOG(INFO) << "GC freed " << (is_small ? "<" : "") << kib_freed << "KiB, " << percentFree << "% free " - << (num_bytes_allocated_/1024) << "KiB/" << (total/1024) << "KiB, " + << (num_bytes_allocated_/KB) << "KiB/" << (total/KB) << "KiB, " << "paused " << duration << "ms"; } Dbg::GcDidFinish(); @@ -577,8 +577,8 @@ void Heap::WalkHeap(void(*callback)(const void*, size_t, const void*, size_t, vo // void Heap::SetIdealFootprint(size_t max_allowed_footprint) { if (max_allowed_footprint > Heap::growth_size_) { - VLOG(gc) << "Clamp target GC heap from " << max_allowed_footprint - << " to " << Heap::growth_size_; + VLOG(gc) << "Clamp target GC heap from " << (max_allowed_footprint/KB) << "KiB" + << " to " << (Heap::growth_size_/KB) << "KiB"; max_allowed_footprint = Heap::growth_size_; } @@ -586,7 +586,7 @@ void Heap::SetIdealFootprint(size_t max_allowed_footprint) { } // kHeapIdealFree is the ideal maximum free size, when we grow the heap for -// utlization. +// utilization. static const size_t kHeapIdealFree = 2 * MB; // kHeapMinFree guarantees that you always have at least 512 KB free, when // you grow for utilization, regardless of target utilization ratio. diff --git a/src/hprof/hprof.cc b/src/hprof/hprof.cc index 8dadfdf14a..64cd7dbf51 100644 --- a/src/hprof/hprof.cc +++ b/src/hprof/hprof.cc @@ -594,8 +594,7 @@ bool Hprof::Finish() { } // throw out a log message for the benefit of "runhat" - LOG(INFO) << StringPrintf("hprof: heap dump completed (%dKB)", - (headCtx.file_data_size_ + file_data_size_ + 1023) / 1024); + LOG(INFO) << "hprof: heap dump completed (" << ((headCtx.file_data_size_ + file_data_size_ + 1023) / KB) << "KiB)"; return true; } diff --git a/src/object.cc b/src/object.cc index c08e1228c0..9e843279a4 100644 --- a/src/object.cc +++ b/src/object.cc @@ -1175,8 +1175,7 @@ bool String::Equals(const String* that) const { } } -bool String::Equals(const uint16_t* that_chars, int32_t that_offset, - int32_t that_length) const { +bool String::Equals(const uint16_t* that_chars, int32_t that_offset, int32_t that_length) const { if (this->GetLength() != that_length) { return false; } else { |