optimalization of screen-output of ntpmon

folkert folkert at vanheusden.com
Mon Sep 23 10:01:13 UTC 2019


Hi,

Tried to create a pull-request via gitlab but that failed in mysterious
ways. So that's why I'm also sending it via the mailinglist (I talked
about it on irc as well).


>From a7288a0692f2862590e9b1eea1f05ae8d87a1ff1 Mon Sep 17 00:00:00 2001
From: Folkert van Heusden <folkert.mobiel at gmail.com>
Date: Mon, 23 Sep 2019 09:14:10 +0000
Subject: [PATCH] Use stdscr.erase() instead of clear: erase is more efficient
 while effectively doing the same. https://linux.die.net/man/3/werase says:
 "The clear and wclear routines are like erase and werase, but they also call
 clearok, so that the screen is cleared completely on the next call to
 wrefresh for that window and repainted from scratch."

---
 ntpclients/ntpmon.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ntpclients/ntpmon.py b/ntpclients/ntpmon.py
index d286f6795..fb36391d9 100644
--- a/ntpclients/ntpmon.py
+++ b/ntpclients/ntpmon.py
@@ -284,7 +284,7 @@ if __name__ == '__main__':
         sysvars = session.readvar(raw=True)
         with OutputContext() as ctx:
             while True:
-                stdscr.clear()
+                stdscr.erase()
                 stdscr.addstr(0, 0, u"".encode('UTF-8'))
                 if helpmode:
                     stdscr.addstr(__doc__.encode('UTF-8'))
-- 
2.22.0



Folkert van Heusden


More information about the devel mailing list