aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason McCarver <slam@parasite.cc>2012-10-26 16:40:38 +0100
committerJason McCarver <slam@parasite.cc>2012-10-26 16:40:38 +0100
commit2d246bfea1aa9acc59ca493777d408292a4247f5 (patch)
tree7208b844ce8cd3b3e50ba6367a56d84758392028
parent055f5673c633c38753eec9abd454c7adaaba9587 (diff)
downloadxen-2d246bfea1aa9acc59ca493777d408292a4247f5.tar.gz
xen-2d246bfea1aa9acc59ca493777d408292a4247f5.tar.bz2
xen-2d246bfea1aa9acc59ca493777d408292a4247f5.zip
xentop.c: Change curses painting behavior to avoid flicker
Currently, xentop calls clear() before drawing the screen and calling refresh(). This causes the entire screen to be repainted from scratch on each call to refresh(). It is inefficient and causes visible flicker when using xentop. This patch fixes this by calling erase() instead of clear() which overwrites the current screen with blanks instead. The screen is then drawn as usual in the top() function and refresh() is called. This method allows curses to only repaint the characters that have changed since the last call to refresh(), thus avoiding the flicker and sending fewer characters to the terminal. In the event the screen becomes corrupted, this patch accepts a CTRL-L keystroke from the user which will call clear() and force a repaint of the entire screen. Signed-off-by: Jason McCarver <slam@parasite.cc> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com> xen-unstable changeset: 25899:116f5c34354b Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
-rw-r--r--tools/xenstat/xentop/xentop.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/xenstat/xentop/xentop.c b/tools/xenstat/xentop/xentop.c
index db9990f50b..dd11927dc2 100644
--- a/tools/xenstat/xentop/xentop.c
+++ b/tools/xenstat/xentop/xentop.c
@@ -57,6 +57,7 @@
#endif
#define KEY_ESCAPE '\x1B'
+#define KEY_REPAINT '\x0C'
#ifdef HOST_SunOS
/* Old curses library on Solaris takes non-const strings. Also, ERR interferes
@@ -383,6 +384,9 @@ static int handle_key(int ch)
case 'd': case 'D':
set_prompt("Delay(sec)", set_delay);
break;
+ case KEY_REPAINT:
+ clear();
+ break;
case 'q': case 'Q': case KEY_ESCAPE:
return 0;
}
@@ -1201,7 +1205,7 @@ int main(int argc, char **argv)
do {
gettimeofday(&curtime, NULL);
if(ch != ERR || (curtime.tv_sec - oldtime.tv_sec) >= delay) {
- clear();
+ erase();
top();
oldtime = curtime;
refresh();