diff options
| author | 2016-01-28 15:08:01 +0000 | |
|---|---|---|
| committer | 2016-02-15 11:49:08 +0000 | |
| commit | dd9473b94c15c8cbdfcce702fdc7a50acdfbfd8b (patch) | |
| tree | 055dfa192732d8a2f246b314c66230e145355c14 | |
| parent | 88f4bc504c1be353e95e9d215d68c7d58eb0717f (diff) | |
dex2oat: Show memory usage values in bytes
Memory usage values are rounded down to an integer and shown in the
unit that would be most appropriate (refer to art::PrettySize());
e.g. if the value is at least 1 MB, but less than 1 GB, then it will
be shown in MB. However, that can introduce a very large error; for
example, a value that is close to, but less than 2 MB, will be
displayed as 1 MB.
This change forces dex2oat to print the raw value in bytes as well,
which may make memory usage analysis more accurate.
Change-Id: Id86a9fe21e8af0f02e77fac21cad51d35d941294
| -rw-r--r-- | compiler/driver/compiled_method_storage.cc | 3 | ||||
| -rw-r--r-- | compiler/driver/compiler_driver.cc | 16 |
2 files changed, 11 insertions, 8 deletions
diff --git a/compiler/driver/compiled_method_storage.cc b/compiler/driver/compiled_method_storage.cc index bc5c6cab87..510613ecf4 100644 --- a/compiler/driver/compiled_method_storage.cc +++ b/compiler/driver/compiled_method_storage.cc @@ -190,7 +190,8 @@ CompiledMethodStorage::~CompiledMethodStorage() { void CompiledMethodStorage::DumpMemoryUsage(std::ostream& os, bool extended) const { if (swap_space_.get() != nullptr) { - os << " swap=" << PrettySize(swap_space_->GetSize()); + const size_t swap_size = swap_space_->GetSize(); + os << " swap=" << PrettySize(swap_size) << " (" << swap_size << "B)"; } if (extended) { Thread* self = Thread::Current(); diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc index f078bf6507..670fe94988 100644 --- a/compiler/driver/compiler_driver.cc +++ b/compiler/driver/compiler_driver.cc @@ -2732,16 +2732,18 @@ bool CompilerDriver::RequiresConstructorBarrier(Thread* self, const DexFile* dex std::string CompilerDriver::GetMemoryUsageString(bool extended) const { std::ostringstream oss; Runtime* const runtime = Runtime::Current(); - const ArenaPool* arena_pool = runtime->GetArenaPool(); - gc::Heap* const heap = runtime->GetHeap(); - oss << "arena alloc=" << PrettySize(arena_pool->GetBytesAllocated()); - oss << " java alloc=" << PrettySize(heap->GetBytesAllocated()); + const ArenaPool* const arena_pool = runtime->GetArenaPool(); + const gc::Heap* const heap = runtime->GetHeap(); + const size_t arena_alloc = arena_pool->GetBytesAllocated(); + const size_t java_alloc = heap->GetBytesAllocated(); + oss << "arena alloc=" << PrettySize(arena_alloc) << " (" << arena_alloc << "B)"; + oss << " java alloc=" << PrettySize(java_alloc) << " (" << java_alloc << "B)"; #if defined(__BIONIC__) || defined(__GLIBC__) - struct mallinfo info = mallinfo(); + const struct mallinfo info = mallinfo(); const size_t allocated_space = static_cast<size_t>(info.uordblks); const size_t free_space = static_cast<size_t>(info.fordblks); - oss << " native alloc=" << PrettySize(allocated_space) << " free=" - << PrettySize(free_space); + oss << " native alloc=" << PrettySize(allocated_space) << " (" << allocated_space << "B)" + << " free=" << PrettySize(free_space) << " (" << free_space << "B)"; #endif compiled_method_storage_.DumpMemoryUsage(oss, extended); return oss.str(); |