summaryrefslogtreecommitdiff
path: root/flowtop.c
diff options
context:
space:
mode:
authorVadim Kochan <vadim4j@gmail.com>2016-04-21 21:47:42 +0300
committerTobias Klauser <tklauser@distanz.ch>2016-04-22 15:30:04 +0200
commit9bec71619a76d35f6b64f88a1371a37da245f859 (patch)
treebef1b0c19fae5a217d60c858b5ec0eca2dbd9375 /flowtop.c
parent0dd9388efcd966197bda65c131d176cf0ac63c60 (diff)
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 <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'flowtop.c')
-rw-r--r--flowtop.c13
1 files changed, 6 insertions, 7 deletions
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();