Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: src/api.cc

Issue 1058253003: Adding V8 api to get memory statistics of spaces in V8::Heap. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Made changes. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« include/v8.h ('K') | « include/v8.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 28c84106df4c260cfbd2e96972a12efcd1f10964..5e56a5e0798c744c0b005e49d67dee982e10d564 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -6966,6 +6966,24 @@ void Isolate::GetHeapStatistics(HeapStatistics* heap_statistics) {
heap_statistics->total_physical_size_ = heap->CommittedPhysicalMemory();
heap_statistics->used_heap_size_ = heap->SizeOfObjects();
heap_statistics->heap_size_limit_ = heap->MaxReserved();
+
+ HeapStatistics::SpaceStatistics new_space_stats(
+ heap->new_space()->Size(), heap->new_space()->CommittedMemory(),
+ heap->new_space()->Available());
+ heap_statistics->spaces_statistics().push_back(new_space_stats);
+
+ for (int space = i::AllocationSpace::FIRST_PAGED_SPACE;
+ space < i::AllocationSpace::LAST_PAGED_SPACE; space++) {
+ HeapStatistics::SpaceStatistics space_stats(
+ heap->paged_space(space)->Size(),
rmcilroy 2015/04/13 17:40:08 This should be SizeOfObjects()
ssid 2015/04/14 16:59:16 Done.
+ heap->paged_space(space)->CommittedMemory(),
+ heap->paged_space(space)->Available());
+ heap_statistics->spaces_statistics().push_back(space_stats);
+ }
+ HeapStatistics::SpaceStatistics lo_space_stats(
rmcilroy 2015/04/13 17:40:08 nit - newline above
ssid 2015/04/14 16:59:16 Done.
+ heap->lo_space()->Size(), heap->lo_space()->CommittedMemory(),
+ heap->lo_space()->Available());
+ heap_statistics->spaces_statistics().push_back(lo_space_stats);
}
« include/v8.h ('K') | « include/v8.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698