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

Unified Diff: src/spaces.h

Issue 11066118: Implement committed physical memory stats for Linux. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressing comments Created 8 years, 2 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
« no previous file with comments | « src/platform-win32.cc ('k') | src/spaces.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/spaces.h
diff --git a/src/spaces.h b/src/spaces.h
index effe06b031ac960f2cf5fc58904ca7bd573ced8c..f29233f10236926ae9e937144cd5172c53a4469d 100644
--- a/src/spaces.h
+++ b/src/spaces.h
@@ -507,7 +507,8 @@ class MemoryChunk {
static const size_t kWriteBarrierCounterOffset =
kSlotsBufferOffset + kPointerSize + kPointerSize;
- static const size_t kHeaderSize = kWriteBarrierCounterOffset + kPointerSize;
+ static const size_t kHeaderSize =
+ kWriteBarrierCounterOffset + kPointerSize + kPointerSize;
static const int kBodyOffset =
CODE_POINTER_ALIGN(MAP_POINTER_ALIGN(kHeaderSize + Bitmap::kSize));
@@ -619,6 +620,13 @@ class MemoryChunk {
return static_cast<int>(area_end() - area_start());
}
+ // Approximate amount of physical memory committed for this chunk.
+ size_t CommittedPhysicalMemory() {
+ return high_water_mark_;
+ }
+
+ static inline void UpdateHighWaterMark(Address mark);
+
protected:
MemoryChunk* next_chunk_;
MemoryChunk* prev_chunk_;
@@ -644,6 +652,9 @@ class MemoryChunk {
SlotsBuffer* slots_buffer_;
SkipList* skip_list_;
intptr_t write_barrier_counter_;
+ // Assuming the initial allocation on a page is sequential,
+ // count highest number of bytes ever allocated on the page.
+ int high_water_mark_;
static MemoryChunk* Initialize(Heap* heap,
Address base,
@@ -1493,6 +1504,9 @@ class PagedSpace : public Space {
// spaces this equals the capacity.
intptr_t CommittedMemory() { return Capacity(); }
+ // Approximate amount of physical memory committed for this space.
+ size_t CommittedPhysicalMemory();
+
// Sets the capacity, the available space and the wasted space to zero.
// The stats are rebuilt during sweeping by adding each page to the
// capacity and the size when it is encountered. As free spaces are
@@ -1553,6 +1567,7 @@ class PagedSpace : public Space {
void SetTop(Address top, Address limit) {
ASSERT(top == limit ||
Page::FromAddress(top) == Page::FromAddress(limit - 1));
+ MemoryChunk::UpdateHighWaterMark(allocation_info_.top);
allocation_info_.top = top;
allocation_info_.limit = limit;
}
@@ -1959,6 +1974,9 @@ class SemiSpace : public Space {
static void Swap(SemiSpace* from, SemiSpace* to);
+ // Approximate amount of physical memory committed for this space.
+ size_t CommittedPhysicalMemory();
+
private:
// Flips the semispace between being from-space and to-space.
// Copies the flags into the masked positions on all pages in the space.
@@ -2156,6 +2174,9 @@ class NewSpace : public Space {
return Capacity();
}
+ // Approximate amount of physical memory committed for this space.
+ size_t CommittedPhysicalMemory();
+
// Return the available bytes without growing.
intptr_t Available() {
return Capacity() - Size();
@@ -2523,6 +2544,9 @@ class LargeObjectSpace : public Space {
return Size();
}
+ // Approximate amount of physical memory committed for this space.
+ size_t CommittedPhysicalMemory();
+
int PageCount() {
return page_count_;
}
« no previous file with comments | « src/platform-win32.cc ('k') | src/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698