summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Kochan <vadim4j@gmail.com>2016-04-21 21:47:43 +0300
committerTobias Klauser <tklauser@distanz.ch>2016-04-22 15:30:09 +0200
commitcbce1528138339e6dc1a6f51f915641b7840d685 (patch)
tree98b20b49440bf2f86f980e48e128a79a495ee455
parent9bec71619a76d35f6b64f88a1371a37da245f859 (diff)
flowtop: Simplify flows refresh delay
Simplify screen refresh logic by removing tricky delay logic which freezes a little key pressing. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
-rw-r--r--flowtop.c21
1 files changed, 3 insertions, 18 deletions
diff --git a/flowtop.c b/flowtop.c
index 3628d39..20b3c25 100644
--- a/flowtop.c
+++ b/flowtop.c
@@ -1278,8 +1278,6 @@ static void flows_table_init(struct ui_table *tbl)
static void presenter(void)
{
- int time_sleep_us = 200000;
- int time_passed_us = 0;
bool show_help = false;
int skip_lines = 0;
WINDOW *screen;
@@ -1301,7 +1299,6 @@ static void presenter(void)
rcu_register_thread();
while (!sigint) {
- bool redraw_flows = true;
int ch;
curs_set(0);
@@ -1353,31 +1350,19 @@ static void presenter(void)
break;
default:
fflush(stdin);
- redraw_flows = false;
break;
}
draw_header(screen);
- if (!redraw_flows)
- redraw_flows = time_passed_us >= 1 * USEC_PER_SEC;
-
- if (show_help)
- redraw_flows = false;
-
- if (redraw_flows) {
- draw_flows(screen, &flow_list, skip_lines);
- time_passed_us = 0;
- } else {
- time_passed_us += time_sleep_us;
- }
-
if (show_help)
draw_help(screen);
+ else
+ draw_flows(screen, &flow_list, skip_lines);
draw_footer(screen);
- usleep(time_sleep_us);
+ usleep(80000);
}
rcu_unregister_thread();