[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [nyx/master] Lessen overhead of idle daemon panels
commit e82ed8c543d732e7b56d6db4852753755ddae9b8
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Thu Sep 28 17:38:41 2017 -0700
Lessen overhead of idle daemon panels
Turns out having a daemon panel reacquire a lock every 0.2 seconds is fairly
taxing, even if the panel isn't doing anything. That, and having the log panel
every 0.3 seconds is kinda silly. This drops the log panel usage when idle by
80% (0.5% to 0.1% on my system).
---
nyx/panel/__init__.py | 2 +-
nyx/panel/log.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/nyx/panel/__init__.py b/nyx/panel/__init__.py
index d575e42..2139634 100644
--- a/nyx/panel/__init__.py
+++ b/nyx/panel/__init__.py
@@ -207,7 +207,7 @@ class DaemonPanel(Panel, threading.Thread):
if nyx_interface().is_paused() or (time.time() - last_ran) < self._update_rate:
with self._pause_condition:
if not self._halt:
- self._pause_condition.wait(0.2)
+ self._pause_condition.wait(max(0.2, self._update_rate - 0.01))
continue # done waiting, try again
diff --git a/nyx/panel/log.py b/nyx/panel/log.py
index 4a6afe3..32cbfef 100644
--- a/nyx/panel/log.py
+++ b/nyx/panel/log.py
@@ -43,7 +43,7 @@ CONFIG = conf.config_dict('nyx', {
'write_logs_to': '',
}, conf_handler)
-UPDATE_RATE = 0.3
+UPDATE_RATE = 0.7
# The height of the drawn content is estimated based on the last time we redrew
# the panel. It's chiefly used for scrolling and the bar indicating its
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits