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

Unified Diff: src/spaces.cc

Issue 10961042: Implement committed physical memory stats for Linux. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix formatting. Created 8 years, 3 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
« src/heap.cc ('K') | « src/spaces.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/spaces.cc
diff --git a/src/spaces.cc b/src/spaces.cc
index ce62877dfab6d9a97af317430c5e750939046db3..116ba35abcf7a387979a8cbf31590b76660ef62a 100644
--- a/src/spaces.cc
+++ b/src/spaces.cc
@@ -487,6 +487,18 @@ void MemoryChunk::Unlink() {
}
+size_t MemoryChunk::CommittedPhysicalMemory() {
+ size_t physical;
+ size_t size = area_end_ - area_start_;
Michael Starzinger 2012/09/27 09:46:16 Can we use area_size() for this calculation?
alph 2012/09/27 12:51:13 Let's try. Hopefully it won't go beyond 2GB limit.
+ if (VirtualMemory::CommittedPhysicalSizeInRegion(
+ area_start_, size, &physical)) {
+ return physical;
+ } else {
+ return size;
+ }
+}
+
+
MemoryChunk* MemoryAllocator::AllocateChunk(intptr_t body_size,
Executability executable,
Space* owner) {
@@ -819,6 +831,16 @@ void PagedSpace::TearDown() {
}
+size_t PagedSpace::CommittedPhysicalMemory() {
+ size_t size = 0;
+ PageIterator it(this);
+ while (it.has_next()) {
+ size += it.next()->CommittedPhysicalMemory();
+ }
+ return size;
+}
+
+
MaybeObject* PagedSpace::FindObject(Address addr) {
// Note: this function can only be called on precisely swept spaces.
ASSERT(!heap()->mark_compact_collector()->in_use());
@@ -1384,6 +1406,19 @@ bool SemiSpace::Uncommit() {
}
+size_t SemiSpace::CommittedPhysicalMemory() {
+ if (!is_committed()) return 0;
+ size_t size = 0;
+ NewSpacePage* page = anchor_.next_page();
Michael Starzinger 2012/09/27 09:46:16 Can we use NewSpacePageIterator for this iteration
alph 2012/09/27 12:51:13 Done.
+ CHECK(anchor_.semi_space() == this);
+ while (page != &anchor_) {
+ size += page->CommittedPhysicalMemory();
+ page = page->next_page();
+ }
+ return size;
+}
+
+
bool SemiSpace::GrowTo(int new_capacity) {
if (!is_committed()) {
if (!Commit()) return false;
@@ -2690,6 +2725,17 @@ MaybeObject* LargeObjectSpace::AllocateRaw(int object_size,
}
+size_t LargeObjectSpace::CommittedPhysicalMemory() {
+ size_t size = 0;
+ LargePage* current = first_page_;
+ while (current != NULL) {
Michael Starzinger 2012/09/27 09:46:16 Can we use LargeObjectIterator for this iteration?
alph 2012/09/27 12:51:13 I'm not sure. It returns not a page, but a HeapObj
Michael Starzinger 2012/09/27 13:13:28 You are right, my bad.
+ size += current->CommittedPhysicalMemory();
+ current = current->next_page();
+ }
+ return size;
+}
+
+
// GC support
MaybeObject* LargeObjectSpace::FindObject(Address a) {
LargePage* page = FindPage(a);
« src/heap.cc ('K') | « src/spaces.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698