[pypy-commit] pypy memory-accounting: add one more data point
fijal
pypy.commits at gmail.com
Tue Oct 31 12:06:19 EDT 2017
Author: fijal
Branch: memory-accounting
Changeset: r92887:3c6f624e8ed0
Date: 2017-10-31 17:05 +0100
http://bitbucket.org/pypy/pypy/changeset/3c6f624e8ed0/
Log: add one more data point
diff --git a/pypy/module/gc/referents.py b/pypy/module/gc/referents.py
--- a/pypy/module/gc/referents.py
+++ b/pypy/module/gc/referents.py
@@ -174,10 +174,13 @@
class W_GcStats(W_Root):
def __init__(self):
self.total_memory_pressure = rgc.get_stats(rgc.TOTAL_MEMORY_PRESSURE)
+ self.total_gc_memory = rgc.get_stats(rgc.TOTAL_MEMORY)
W_GcStats.typedef = TypeDef("GcStats",
total_memory_pressure=interp_attrproperty("total_memory_pressure",
cls=W_GcStats, wrapfn="newint"),
+ total_gc_memory=interp_attrproperty("total_gc_memory",
+ cls=W_GcStats, wrapfn="newint")
)
def get_stats(space):
diff --git a/rpython/memory/gc/incminimark.py b/rpython/memory/gc/incminimark.py
--- a/rpython/memory/gc/incminimark.py
+++ b/rpython/memory/gc/incminimark.py
@@ -2923,6 +2923,8 @@
from rpython.memory.gc import inspector
if stats_no == rgc.TOTAL_MEMORY:
+ return intmask(self.get_total_memory_used() + self.nursery_size)
+ elif stats_no == rgc.TOTAL_ALLOCATED_MEMORY:
return 0
elif stats_no == rgc.TOTAL_MEMORY_PRESSURE:
return inspector.count_memory_pressure(self)
diff --git a/rpython/memory/gc/minimarkpage.py b/rpython/memory/gc/minimarkpage.py
--- a/rpython/memory/gc/minimarkpage.py
+++ b/rpython/memory/gc/minimarkpage.py
@@ -140,6 +140,7 @@
# the total memory used, counting every block in use, without
# the additional bookkeeping stuff.
self.total_memory_used = r_uint(0)
+ self.total_memory_alloced = r_uint(0)
def _new_page_ptr_list(self, length):
diff --git a/rpython/rlib/rgc.py b/rpython/rlib/rgc.py
--- a/rpython/rlib/rgc.py
+++ b/rpython/rlib/rgc.py
@@ -650,7 +650,7 @@
else:
return id(gcref._x)
-TOTAL_MEMORY, TOTAL_MEMORY_PRESSURE = range(2)
+TOTAL_MEMORY, TOTAL_ALLOCATED_MEMORY, TOTAL_MEMORY_PRESSURE = range(3)
@not_rpython
def get_stats(stat_no):
More information about the pypy-commit
mailing list