From 7c1a92274c720f125e8c5bb96b85f05734a58943 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Mon, 8 Aug 2016 11:12:21 +0100 Subject: Make psutil optional --- synapse/metrics/metric.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'synapse/metrics/metric.py') diff --git a/synapse/metrics/metric.py b/synapse/metrics/metric.py index 7becbe0491..e81af29895 100644 --- a/synapse/metrics/metric.py +++ b/synapse/metrics/metric.py @@ -16,8 +16,6 @@ from itertools import chain -import psutil - # TODO(paul): I can't believe Python doesn't have one of these def map_concat(func, items): @@ -167,9 +165,10 @@ class MemoryUsageMetric(object): UPDATE_HZ = 2 # number of times to get memory per second WINDOW_SIZE_SEC = 30 # the size of the window in seconds - def __init__(self, hs): + def __init__(self, hs, psutil): clock = hs.get_clock() self.memory_snapshots = [] + self.process = psutil.Process() clock.looping_call(self._update_curr_values, 1000 / self.UPDATE_HZ) -- cgit 1.4.1