[Iftop-users] iftop : HISTORY_DIVISIONS set to 1 means : no more sent bar....

franck villaume fvillaume at ipnotic-telecom.fr
Tue, 18 Apr 2006 10:06:46 +0200


Hello,

I finally found sometime to look at the code.
Here are two patchs I made to get one HISTORY_DIVISIONS column only.

diff -Naur ui.c ui.c.new
--- ui.c        2005-10-26 22:12:33.000000000 +0200
+++ ui.c.new    2006-03-23 13:40:42.000000000 +0100
@@ -28,7 +28,7 @@

  #define HOSTNAME_LENGTH 256

-#define HISTORY_DIVISIONS   3
+#define HISTORY_DIVISIONS   1

  #define HELP_TIME 2

@@ -55,7 +55,7 @@


  /* 2, 10 and 40 seconds */
-int history_divs[HISTORY_DIVISIONS] = {1, 5, 20};
+int history_divs[HISTORY_DIVISIONS] = {1};

  #define UNIT_DIVISIONS 4
  char* unit_bits[UNIT_DIVISIONS] =  { "b", "Kb", "Mb", "Gb"};


diff -Naur options.c options.c.new
--- options.c        2006-02-08 03:57:44.000000000 +0100
+++ options.c.new    2006-04-10 15:57:34.000000000 +0200
@@ -118,8 +118,8 @@
      options.netfilter = 0;
      inet_aton("10.0.1.0", &options.netfilternet);
      inet_aton("255.255.255.0", &options.netfiltermask);
-    options.dnsresolution = 1;
-    options.portresolution = 1;
+    options.dnsresolution = 0;
+    options.portresolution = 0;
  #ifdef NEED_PROMISCUOUS_FOR_OUTGOING
      options.promiscuous = 1;
      options.promiscuous_but_choosy = 1;
@@ -128,13 +128,13 @@
      options.promiscuous_but_choosy = 0;
  #endif
      options.showbars = 1;
-    options.showports = OPTION_PORTS_OFF;
+    options.showports = OPTION_PORTS_ON;
      options.aggregate_src = 0;
      options.aggregate_dest = 0;
      options.paused = 0;
      options.showhelp = 0;
      options.bandwidth_in_bytes = 0;
-    options.sort = OPTION_SORT_DIV2;
+    options.sort = OPTION_SORT_DIV1;
      options.screenfilter = NULL;
      options.freezeorder = 0;
      options.linedisplay = OPTION_LINEDISPLAY_TWO_LINE;
@@ -142,7 +142,7 @@
      options.show_totals = 0;
      options.max_bandwidth = 0; /* auto */
      options.log_scale = 0;
-    options.bar_interval = 1;
+    options.bar_interval = 0;

      /* Figure out the name for the config file */
      s = getenv("HOME");

The important changes are :
- options.bar_interval : It has to be set to 0
- options.sort : set to OPTION_SORT_DIV1

The other changes are just for my own use.

Paul Warren wrote:
> Without looking at the code, I'd guess it's due to the fact that it
> sorts on the second column.  I suspect that if you find the bit of code
> that chooses which column to sort on and change that to 1, it'll start
> working.
> 
> Paul
> 
> On Fri, Mar 24, 2006 at 05:42:52PM +0100, franck villaume wrote:
>> Hi,
>>
>> I was playing around a little bit with iftop when I decided to modify it 
>> as I wished to see only one HISTORY_DIVISIONS column : 2s column.
>>
>> I modified the ui.c file like this :
>>
>> ---------------------------------------------------
>> diff -Naur ui.c ui.c.new
>> --- ui.c        2005-10-26 22:12:33.000000000 +0200
>> +++ ui.c.new    2006-03-23 13:40:42.000000000 +0100
>> @@ -28,7 +28,7 @@
>>
>>   #define HOSTNAME_LENGTH 256
>>
>> -#define HISTORY_DIVISIONS   3
>> +#define HISTORY_DIVISIONS   1
>>
>>   #define HELP_TIME 2
>>
>> @@ -55,7 +55,7 @@
>>
>>
>>   /* 2, 10 and 40 seconds */
>> -int history_divs[HISTORY_DIVISIONS] = {1, 5, 20};
>> +int history_divs[HISTORY_DIVISIONS] = {1};
>>
>>   #define UNIT_DIVISIONS 4
>>   char* unit_bits[UNIT_DIVISIONS] =  { "b", "Kb", "Mb", "Gb"};
>> -----------------------------------------------------
>>
>> Then the sent bar is no more visible.
>> I have one screenshot available.
>>
>> If I set HISTORY_DIVISIONS to 2 and
>> history_divs[HISTORY_DIVISIONS] = {1, 5}
>> then sent bar is back.
>>
>> Any ideas what I made wrong ?
>>
>>
>> -- 
>> Franck VILLAUME
>> fvillaume@ipnotic-telecom.fr
>> ****************************
>>
>> _______________________________________________
>> iftop-users mailing list
>> iftop-users@lists.beasts.org
>> http://lists.beasts.org/mailman/listinfo/iftop-users
> 
> _______________________________________________
> iftop-users mailing list
> iftop-users@lists.beasts.org
> http://lists.beasts.org/mailman/listinfo/iftop-users
> 


-- 
Franck VILLAUME
IPNOTIC Telecom
90 rue d'aguesseau
92100 Boulogne-Billancourt
Tel/Fax: +33 1 72 29 05 04
fvillaume@ipnotic-telecom.fr
www.ipnotic-telecom.fr

****************************