[Iftop-users] drawing bar scale with bandwidth_in_bytes option

Stephen Hamer stephen.hamer at gmail.com
Sat, 31 Mar 2012 19:00:30 -0400


--f46d042f92887b848b04bc91ecb3
Content-Type: text/plain; charset=ISO-8859-1

The bar scale at the top of the window doesn't change units along with the
bandwidth_in_bytes option. Given that the host bars change to be in bytes
it seems reasonable for the scale to change as well.
I've included the diff to make this change below.

Cheers,
Stephen Hamer


*** ui.c.orig 2012-03-31 18:47:53.460042245 -0400
--- ui.c 2012-03-31 18:47:51.146083037 -0400
***************
*** 263,269 ****
              char s[40], *p;
              int x;
              /* This 1024 vs 1000 stuff is just plain evil */
!             readable_size(i, s, sizeof s, options.log_scale ? 1000 :
1024, 0);
              p = s + strspn(s, " ");
              x = get_bar_length(i * 8);
              mvaddch(*y + 1, x, ACS_BTEE);
--- 263,269 ----
              char s[40], *p;
              int x;
              /* This 1024 vs 1000 stuff is just plain evil */
!             readable_size(i, s, sizeof s, options.log_scale ? 1000 :
1024, options.bandwidth_in_bytes);
              p = s + strspn(s, " ");
              x = get_bar_length(i * 8);
              mvaddch(*y + 1, x, ACS_BTEE);

--f46d042f92887b848b04bc91ecb3
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

The bar scale at the top of the window doesn't change units along with =
the bandwidth_in_bytes option. Given that the host bars change to be in byt=
es it seems reasonable for the scale to change as well.<div>I&#39;ve includ=
ed the diff to make this change below.<div>
<br></div><div>Cheers,
<div>Stephen Hamer</div><div><br></div><div><br></div><div><div>*** ui.c.or=
ig<span class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>2012-03-=
31 18:47:53.460042245 -0400</div><div>--- ui.c<span class=3D"Apple-tab-span=
" style=3D"white-space:pre">	</span>2012-03-31 18:47:51.146083037 -0400</di=
v>
<div>***************</div><div>*** 263,269 ****</div><div>=A0 =A0 =A0 =A0 =
=A0 =A0 =A0 char s[40], *p;</div><div>=A0 =A0 =A0 =A0 =A0 =A0 =A0 int x;</d=
iv><div>=A0 =A0 =A0 =A0 =A0 =A0 =A0 /* This 1024 vs 1000 stuff is just plai=
n evil */</div><div>! =A0 =A0 =A0 =A0 =A0 =A0 readable_size(i, s, sizeof s,=
 options.log_scale ? 1000 : 1024, 0);</div>
<div>=A0 =A0 =A0 =A0 =A0 =A0 =A0 p =3D s + strspn(s, &quot; &quot;);</div><=
div>=A0 =A0 =A0 =A0 =A0 =A0 =A0 x =3D get_bar_length(i * 8);</div><div>=A0 =
=A0 =A0 =A0 =A0 =A0 =A0 mvaddch(*y + 1, x, ACS_BTEE);</div><div>--- 263,269=
 ----</div><div>=A0 =A0 =A0 =A0 =A0 =A0 =A0 char s[40], *p;</div>
<div>=A0 =A0 =A0 =A0 =A0 =A0 =A0 int x;</div><div>=A0 =A0 =A0 =A0 =A0 =A0 =
=A0 /* This 1024 vs 1000 stuff is just plain evil */</div><div>! =A0 =A0 =
=A0 =A0 =A0 =A0 readable_size(i, s, sizeof s, options.log_scale ? 1000 : 10=
24, options.bandwidth_in_bytes);</div><div>
=A0 =A0 =A0 =A0 =A0 =A0 =A0 p =3D s + strspn(s, &quot; &quot;);</div><div>=
=A0 =A0 =A0 =A0 =A0 =A0 =A0 x =3D get_bar_length(i * 8);</div><div>=A0 =A0 =
=A0 =A0 =A0 =A0 =A0 mvaddch(*y + 1, x, ACS_BTEE);</div></div><div><br></div=
></div></div>

--f46d042f92887b848b04bc91ecb3--