summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/console
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-01-13 04:20:33 -0500
committerimarom <imarom@cisco.com>2016-01-13 04:28:34 -0500
commit862ec9b81ef22c860d4fb9fa45f0531f1c238bcc (patch)
treeba7916f8159f3da3f7e8016f72a0a781d290fa31 /scripts/automation/trex_control_plane/console
parentfdc012345f5ab9dc40d5a571855a7d2010d88475 (diff)
TUI now writes to a string buffer and then to screen
(should be faster, like double buffering and switch)
Diffstat (limited to 'scripts/automation/trex_control_plane/console')
-rwxr-xr-xscripts/automation/trex_control_plane/console/trex_console.py2
-rw-r--r--scripts/automation/trex_control_plane/console/trex_tui.py15
2 files changed, 13 insertions, 4 deletions
diff --git a/scripts/automation/trex_control_plane/console/trex_console.py b/scripts/automation/trex_control_plane/console/trex_console.py
index a6090832..fe909c09 100755
--- a/scripts/automation/trex_control_plane/console/trex_console.py
+++ b/scripts/automation/trex_control_plane/console/trex_console.py
@@ -498,7 +498,7 @@ class TRexConsole(TRexGeneralCmd):
exe += './trex-console -t -q -s {0} -p {1}'.format(self.stateless_client.get_server_ip(), self.stateless_client.get_server_port())
- cmd = ['xterm', '-geometry', '111x42', '-title', 'trex_tui', '-e', exe]
+ cmd = ['xterm', '-geometry', '111x42', '-sl', '0', '-title', 'trex_tui', '-e', exe]
subprocess.Popen(cmd)
return
diff --git a/scripts/automation/trex_control_plane/console/trex_tui.py b/scripts/automation/trex_control_plane/console/trex_tui.py
index c2048c9d..dbbac02b 100644
--- a/scripts/automation/trex_control_plane/console/trex_tui.py
+++ b/scripts/automation/trex_control_plane/console/trex_tui.py
@@ -7,6 +7,7 @@ from common import trex_stats
from client_utils import text_tables
from collections import OrderedDict
import datetime
+from cStringIO import StringIO
class SimpleBar(object):
def __init__ (self, desc, pattern):
@@ -322,8 +323,7 @@ class TrexTUIPanelManager():
if self.show_log:
self.log.show()
-
- sys.stdout.flush()
+
def handle_key (self, ch):
# check for the manager registered actions
@@ -459,8 +459,17 @@ class TrexTUI():
def draw_screen (self, force_draw = False):
if (self.draw_policer >= 5) or (force_draw):
- self.clear_screen()
+
+ # capture stdout to a string
+ old_stdout = sys.stdout
+ sys.stdout = mystdout = StringIO()
self.pm.show()
+ sys.stdout = old_stdout
+
+ self.clear_screen()
+ print mystdout.getvalue()
+ sys.stdout.flush()
+
self.draw_policer = 0
else:
self.draw_policer += 1