From 9bec71619a76d35f6b64f88a1371a37da245f859 Mon Sep 17 00:00:00 2001 From: Vadim Kochan Date: Thu, 21 Apr 2016 21:47:42 +0300 Subject: flowtop: Get rid of clear() & refresh() calls Don't use refresh() & clear() as we draw entire screen and flows table will be filled with empty rows. Signed-off-by: Vadim Kochan Signed-off-by: Tobias Klauser --- flowtop.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'flowtop.c') diff --git a/flowtop.c b/flowtop.c index 32459aa..3628d39 100644 --- a/flowtop.c +++ b/flowtop.c @@ -1093,9 +1093,6 @@ static void draw_flows(WINDOW *screen, struct flow_list *fl, int skip = skip_lines; struct flow_entry *n; - wclear(screen); - clear(); - rcu_read_lock(); n = rcu_dereference(fl->head); @@ -1124,6 +1121,7 @@ static void draw_flows(WINDOW *screen, struct flow_list *fl, line += row_width; } + mvwprintw(screen, 1, 0, "%*s", COLS - 1, " "); mvwprintw(screen, 1, 2, "Kernel netfilter flows(%u) for ", flows); if (what & INCLUDE_IPV4) @@ -1254,6 +1252,7 @@ static void flows_table_init(struct ui_table *tbl) ui_table_init(tbl); ui_table_pos_set(tbl, 3, 0); + ui_table_height_set(tbl, LINES - 3); ui_table_col_add(tbl, TBL_FLOW_PROCESS, "PROCESS", 13); ui_table_col_add(tbl, TBL_FLOW_PID, "PID", 7); @@ -1287,7 +1286,9 @@ static void presenter(void) lookup_init(LT_PORTS_TCP); lookup_init(LT_PORTS_UDP); + screen = screen_init(false); + wclear(screen); start_color(); INIT_COLOR(RED, BLACK); @@ -1356,6 +1357,8 @@ static void presenter(void) break; } + draw_header(screen); + if (!redraw_flows) redraw_flows = time_passed_us >= 1 * USEC_PER_SEC; @@ -1369,15 +1372,11 @@ static void presenter(void) time_passed_us += time_sleep_us; } - draw_header(screen); - if (show_help) draw_help(screen); draw_footer(screen); - wrefresh(screen); - refresh(); usleep(time_sleep_us); } rcu_unregister_thread(); -- cgit v1.2.3-54-g00ecf