mirror of
https://mau.dev/maunium/synapse.git
synced 2024-08-31 15:05:22 +02:00
Merge pull request #847 from matrix-org/erikj/gc_tick
Change the way we do stats for GC
This commit is contained in:
commit
188f8d63e2
1 changed files with 6 additions and 8 deletions
|
@ -153,11 +153,8 @@ reactor_metrics = get_metrics_for("reactor")
|
||||||
tick_time = reactor_metrics.register_distribution("tick_time")
|
tick_time = reactor_metrics.register_distribution("tick_time")
|
||||||
pending_calls_metric = reactor_metrics.register_distribution("pending_calls")
|
pending_calls_metric = reactor_metrics.register_distribution("pending_calls")
|
||||||
|
|
||||||
gc_time = (
|
gc_time = reactor_metrics.register_distribution("gc_time", labels=["gen"])
|
||||||
reactor_metrics.register_distribution("gc_time_gen0"),
|
gc_unreachable = reactor_metrics.register_counter("gc_unreachable", labels=["gen"])
|
||||||
reactor_metrics.register_distribution("gc_time_gen2"),
|
|
||||||
reactor_metrics.register_distribution("gc_time_gen2"),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def runUntilCurrentTimer(func):
|
def runUntilCurrentTimer(func):
|
||||||
|
@ -190,15 +187,16 @@ def runUntilCurrentTimer(func):
|
||||||
# one if necessary.
|
# one if necessary.
|
||||||
threshold = gc.get_threshold()
|
threshold = gc.get_threshold()
|
||||||
counts = gc.get_count()
|
counts = gc.get_count()
|
||||||
for i in [2, 1, 0]:
|
for i in (2, 1, 0):
|
||||||
if threshold[i] < counts[i]:
|
if threshold[i] < counts[i]:
|
||||||
logger.info("Collecting gc %d", i)
|
logger.info("Collecting gc %d", i)
|
||||||
|
|
||||||
start = time.time() * 1000
|
start = time.time() * 1000
|
||||||
gc.collect(i)
|
unreachable = gc.collect(i)
|
||||||
end = time.time() * 1000
|
end = time.time() * 1000
|
||||||
|
|
||||||
gc_time[i].inc_by(end - start)
|
gc_time.inc_by(end - start, i)
|
||||||
|
gc_unreachable.inc_by(unreachable, i)
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue