summaryrefslogtreecommitdiffstats
path: root/gin
diff options
context:
space:
mode:
authorssid <ssid@chromium.org>2015-05-29 06:03:59 -0700
committerCommit bot <commit-bot@chromium.org>2015-05-29 13:04:37 +0000
commit49aa14c71e5ba321bed15de07a2a09819b63bce6 (patch)
treebda4ec93850b66187ce4b5d2735172e305651fbf /gin
parent18f72c9613a63c7a1878d34ccd62af0cb89da3c8 (diff)
downloadchromium_src-49aa14c71e5ba321bed15de07a2a09819b63bce6.zip
chromium_src-49aa14c71e5ba321bed15de07a2a09819b63bce6.tar.gz
chromium_src-49aa14c71e5ba321bed15de07a2a09819b63bce6.tar.bz2
Reland of Adding total available size of heap in v8 isolate memory dump provider.
Reason: Now the API for available sizes is fixed and returns correct value now (crrev.com/1141693003). So, this CL can land now. Original issue's description (crrev.com/1129403003): > Adding total available size of heap in v8 isolate memory dump provider. > > The total available size is now returned by GetHeapStatistics api. > This CL uses the value in the dump provider to show the value in > other_spaces segment of the memory dump. > > BUG=481504 Review URL: https://codereview.chromium.org/1158373002 Cr-Commit-Position: refs/heads/master@{#331952}
Diffstat (limited to 'gin')
-rw-r--r--gin/v8_isolate_memory_dump_provider.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/gin/v8_isolate_memory_dump_provider.cc b/gin/v8_isolate_memory_dump_provider.cc
index 4530879..8e21e74f 100644
--- a/gin/v8_isolate_memory_dump_provider.cc
+++ b/gin/v8_isolate_memory_dump_provider.cc
@@ -53,6 +53,7 @@ void V8IsolateMemoryDumpProvider::DumpMemoryStatistics(
size_t known_spaces_used_size = 0;
size_t known_spaces_size = 0;
+ size_t known_spaces_available_size = 0;
size_t number_of_spaces = isolate_holder_->isolate()->NumberOfHeapSpaces();
for (size_t space = 0; space < number_of_spaces; space++) {
v8::HeapSpaceStatistics space_statistics;
@@ -60,9 +61,11 @@ void V8IsolateMemoryDumpProvider::DumpMemoryStatistics(
space);
const size_t space_size = space_statistics.space_size();
const size_t space_used_size = space_statistics.space_used_size();
+ const size_t space_available_size = space_statistics.space_available_size();
known_spaces_size += space_size;
known_spaces_used_size += space_used_size;
+ known_spaces_available_size += space_available_size;
std::string allocator_name =
base::StringPrintf("%s/%s_%p/%s/%s", kRootDumpName, kIsolateDumpName,
@@ -81,7 +84,7 @@ void V8IsolateMemoryDumpProvider::DumpMemoryStatistics(
base::trace_event::MemoryAllocatorDump::kUnitsBytes, space_used_size);
space_dump->AddScalar(kAvailableSizeAttribute,
base::trace_event::MemoryAllocatorDump::kUnitsBytes,
- space_statistics.space_available_size());
+ space_available_size);
}
// Compute the rest of the memory, not accounted by the spaces above.
std::string allocator_name = base::StringPrintf(
@@ -98,11 +101,10 @@ void V8IsolateMemoryDumpProvider::DumpMemoryStatistics(
base::trace_event::MemoryAllocatorDump::kUnitsBytes,
heap_statistics.used_heap_size() - known_spaces_used_size);
- // TODO(ssid): Fix crbug.com/481504 to get the total available size of the
- // heap.
other_spaces_dump->AddScalar(
kAvailableSizeAttribute,
- base::trace_event::MemoryAllocatorDump::kUnitsBytes, 0);
+ base::trace_event::MemoryAllocatorDump::kUnitsBytes,
+ heap_statistics.total_available_size() - known_spaces_available_size);
}
} // namespace gin