Commit b7eb237e authored by pdw's avatar pdw
Browse files

v0.15pre1

Added configurable bars options.
Made log/lin run-time option.
parent 0800558e
...@@ -4,6 +4,11 @@ $Id$ ...@@ -4,6 +4,11 @@ $Id$
Attributions apply to all preceding items up to the next blank line. Attributions apply to all preceding items up to the next blank line.
Unattributed items are by Paul Warren and Chris Lightfoot. Unattributed items are by Paul Warren and Chris Lightfoot.
0.15
* Added linear bar scales (default) ("L")
* Added fixed upper limit for bandwidth
* Choose which average bars display ("B")
* Fixed the search for libpcap in the configure script * Fixed the search for libpcap in the configure script
Thomas Schwinge <tschwinge@gmx.net> Thomas Schwinge <tschwinge@gmx.net>
......
...@@ -21,7 +21,7 @@ AC_CONFIG_AUX_DIR(config) ...@@ -21,7 +21,7 @@ AC_CONFIG_AUX_DIR(config)
AC_CANONICAL_SYSTEM AC_CANONICAL_SYSTEM
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(iftop, "0.14") AM_INIT_AUTOMAKE(iftop, "0.15pre1")
AC_DEFINE_UNQUOTED(IFTOP_VERSION, "$VERSION", [The iftop version number]) AC_DEFINE_UNQUOTED(IFTOP_VERSION, "$VERSION", [The iftop version number])
......
...@@ -113,7 +113,8 @@ static void set_defaults() { ...@@ -113,7 +113,8 @@ static void set_defaults() {
options.screen_offset = 0; options.screen_offset = 0;
options.show_totals = 0; options.show_totals = 0;
options.max_bandwidth = 0; /* auto */ options.max_bandwidth = 0; /* auto */
options.log_scale = 1; /* auto */ options.log_scale = 0;
options.bar_interval = 1;
} }
static void die(char *msg) { static void die(char *msg) {
......
...@@ -57,6 +57,8 @@ typedef struct { ...@@ -57,6 +57,8 @@ typedef struct {
int bandwidth_in_bytes; int bandwidth_in_bytes;
option_sort_t sort; option_sort_t sort;
int bar_interval;
char* screenfilter; char* screenfilter;
int freezeorder; int freezeorder;
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#define HOSTNAME_LENGTH 256 #define HOSTNAME_LENGTH 256
#define HISTORY_DIVISIONS 3 #define HISTORY_DIVISIONS 3
#define BARGRAPH_INTERVAL 1 /* which division used for bars. */
#define HELP_TIME 2 #define HELP_TIME 2
...@@ -38,14 +37,14 @@ ...@@ -38,14 +37,14 @@
" r - toggle DNS host resolution P - pause display\n"\ " r - toggle DNS host resolution P - pause display\n"\
" s - toggle show source host h - toggle this help display\n"\ " s - toggle show source host h - toggle this help display\n"\
" d - toggle show destination host b - toggle bar graph display\n"\ " d - toggle show destination host b - toggle bar graph display\n"\
" t - cycle line display mode T - toggle cummulative line totals\n"\ " t - cycle line display mode B - cycle bar graph average\n"\
" j/k - scroll display\n"\ " T - toggle cummulative line totals\n"\
"Port display: f - edit filter code\n"\ "Port display: j/k - scroll display\n"\
" R - toggle service resolution l - set screen filter\n"\ " R - toggle service resolution f - edit filter code\n"\
" S - toggle show source port ! - shell command\n"\ " S - toggle show source port l - set screen filter\n"\
" D - toggle show destination port q - quit\n"\ " D - toggle show destination port L - lin/log scales\n"\
" p - toggle port display\n"\ " p - toggle port display ! - shell command\n"\
"\n"\ " q - quit\n"\
"Sorting:\n"\ "Sorting:\n"\
" 1/2/3 - sort by 1st/2nd/3rd column\n"\ " 1/2/3 - sort by 1st/2nd/3rd column\n"\
" < - sort by source name\n"\ " < - sort by source name\n"\
...@@ -55,7 +54,7 @@ ...@@ -55,7 +54,7 @@
"iftop, version " IFTOP_VERSION "iftop, version " IFTOP_VERSION
/* 1, 15 and 60 seconds */ /* 2, 10 and 40 seconds */
int history_divs[HISTORY_DIVISIONS] = {1, 5, 20}; int history_divs[HISTORY_DIVISIONS] = {1, 5, 20};
#define UNIT_DIVISIONS 4 #define UNIT_DIVISIONS 4
...@@ -339,17 +338,17 @@ void draw_line_totals(int y, host_pair_line* line, option_linedisplay_t linedisp ...@@ -339,17 +338,17 @@ void draw_line_totals(int y, host_pair_line* line, option_linedisplay_t linedisp
if(options.showbars) { if(options.showbars) {
switch(linedisplay) { switch(linedisplay) {
case OPTION_LINEDISPLAY_TWO_LINE: case OPTION_LINEDISPLAY_TWO_LINE:
draw_bar(line->sent[BARGRAPH_INTERVAL],y); draw_bar(line->sent[options.bar_interval],y);
draw_bar(line->recv[BARGRAPH_INTERVAL],y+1); draw_bar(line->recv[options.bar_interval],y+1);
break; break;
case OPTION_LINEDISPLAY_ONE_LINE_SENT: case OPTION_LINEDISPLAY_ONE_LINE_SENT:
draw_bar(line->sent[BARGRAPH_INTERVAL],y); draw_bar(line->sent[options.bar_interval],y);
break; break;
case OPTION_LINEDISPLAY_ONE_LINE_RECV: case OPTION_LINEDISPLAY_ONE_LINE_RECV:
draw_bar(line->recv[BARGRAPH_INTERVAL],y); draw_bar(line->recv[options.bar_interval],y);
break; break;
case OPTION_LINEDISPLAY_ONE_LINE_BOTH: case OPTION_LINEDISPLAY_ONE_LINE_BOTH:
draw_bar(line->recv[BARGRAPH_INTERVAL] + line->sent[BARGRAPH_INTERVAL],y); draw_bar(line->recv[options.bar_interval] + line->sent[options.bar_interval],y);
break; break;
} }
} }
...@@ -838,7 +837,7 @@ void ui_loop() { ...@@ -838,7 +837,7 @@ void ui_loop() {
tick(1); tick(1);
break; break;
case 'b': case 'b':
if(options.showbars) { if(options.showbars) {
options.showbars = 0; options.showbars = 0;
showhelp("Bars off"); showhelp("Bars off");
...@@ -850,6 +849,19 @@ void ui_loop() { ...@@ -850,6 +849,19 @@ void ui_loop() {
tick(1); tick(1);
break; break;
case 'B':
options.bar_interval = (options.bar_interval + 1) % 3;
if(options.bar_interval == 0) {
showhelp("Bars show 2s average");
}
else if(options.bar_interval == 1) {
showhelp("Bars show 10s average");
}
else {
showhelp("Bars show 40s average");
}
ui_print();
break;
case 's': case 's':
if(options.aggregate_src) { if(options.aggregate_src) {
options.aggregate_src = 0; options.aggregate_src = 0;
...@@ -1064,6 +1076,11 @@ void ui_loop() { ...@@ -1064,6 +1076,11 @@ void ui_loop() {
} }
ui_print(); ui_print();
break; break;
case 'L':
options.log_scale = !options.log_scale;
showhelp(options.log_scale ? "Logarithmic scale" : "Linear scale");
ui_print();
break;
case KEY_CLEAR: case KEY_CLEAR:
case 12: /* ^L */ case 12: /* ^L */
wrefresh(curscr); wrefresh(curscr);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment