summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpdw <>2011-10-03 20:32:27 +0000
committerpdw <>2011-10-03 20:32:27 +0000
commit06458b6deb40a7012a26f98753778c36378849aa (patch)
tree3e61a5ad9f673098a846c3e0b3e1a6be995d45bc
parent5612fba5e44e4b6542402bbde6354a4ef77109dd (diff)
downloadiftop-06458b6deb40a7012a26f98753778c36378849aa.zip
Patch from Ole Tange <ole@tange.dk> to make rate adjust faster.
-rw-r--r--ui.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/ui.c b/ui.c
index 9de8525..032d557 100644
--- a/ui.c
+++ b/ui.c
@@ -221,6 +221,8 @@ static struct {
};
static int rateidx = 0, wantbiggerrate;
+static int rateidx_init = 0;
+
static int get_bar_interval(float bandwidth) {
int i = 10;
if(bandwidth > 100000000) {
@@ -245,8 +247,14 @@ static int get_bar_length(const int rate) {
float l;
if (rate <= 0)
return 0;
- if (rate > scale[rateidx].max)
- wantbiggerrate = 1;
+ if (rate > scale[rateidx].max) {
+ wantbiggerrate = 1;
+ if(! rateidx_init) {
+ while(rate > scale[rateidx_init++].max) {
+ }
+ rateidx = rateidx_init;
+ }
+ }
if(options.log_scale) {
l = log(rate) / log(get_max_bandwidth());
}
@@ -762,8 +770,8 @@ void ui_print() {
/* Bar chart auto scale */
if (wantbiggerrate && options.max_bandwidth == 0) {
- ++rateidx;
- wantbiggerrate = 0;
+ ++rateidx;
+ wantbiggerrate = 0;
}
}