mirror of
https://mau.dev/maunium/synapse.git
synced 2024-08-31 06:55:25 +02:00
Also record number of unreachable objects
This commit is contained in:
parent
75331c5fca
commit
48e65099b5
1 changed files with 4 additions and 2 deletions
|
@ -154,6 +154,7 @@ tick_time = reactor_metrics.register_distribution("tick_time")
|
|||
pending_calls_metric = reactor_metrics.register_distribution("pending_calls")
|
||||
|
||||
gc_time = reactor_metrics.register_distribution("gc_time", labels=["gen"])
|
||||
gc_unreachable = reactor_metrics.register_counter("gc_unreachable", labels=["gen"])
|
||||
|
||||
|
||||
def runUntilCurrentTimer(func):
|
||||
|
@ -186,15 +187,16 @@ def runUntilCurrentTimer(func):
|
|||
# one if necessary.
|
||||
threshold = gc.get_threshold()
|
||||
counts = gc.get_count()
|
||||
for i in (0, 1, 2):
|
||||
for i in (2, 1, 0):
|
||||
if threshold[i] < counts[i]:
|
||||
logger.info("Collecting gc %d", i)
|
||||
|
||||
start = time.time() * 1000
|
||||
gc.collect(i)
|
||||
unreachable = gc.collect(i)
|
||||
end = time.time() * 1000
|
||||
|
||||
gc_time.inc_by(end - start, i)
|
||||
gc_unreachable.inc_by(unreachable, i)
|
||||
|
||||
return ret
|
||||
|
||||
|
|
Loading…
Reference in a new issue