Re: [PATCH] iproute2 stat commands only show last cpu

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Stephen Hemminger a écrit :
It seems rtstat has a problem, at least on my dual cpu (x86) machine :

The 'entries' column seems ok, not the following ones (rt_cache in_hit, rt_cache in_slow_tot)

It seems only the last line from /proc/net/stat/rt_cache is taken into account, instead of summing all the lines (one line per cpu)

(only the first column 'entries' is not to be summed)


Thanks, try this patch. (it's going in next version).


Sorry but the first column should not be summed (entries)

So it should be something like :
  		for (j = 0; j < lf->num_fields; j++)
 			if (j) lf->fields[j].values[i] += strtoul(ptr, &ptr, 16);
 			else lf->fields[j].values[i] = strtoul(ptr, &ptr, 16);
  	}

Well... I dont know if all the proc files parsed by this function has the same property (1st column duplicated for all cpus)

diff -Nru a/misc/lnstat_util.c b/misc/lnstat_util.c
--- a/misc/lnstat_util.c 2005-03-16 15:29:26 -08:00
+++ b/misc/lnstat_util.c 2005-03-16 15:29:26 -08:00
@@ -53,7 +53,7 @@
gettimeofday(&lf->last_read, NULL);
for (j = 0; j < lf->num_fields; j++)
- lf->fields[j].values[i] = strtoul(ptr, &ptr, 16);
+ lf->fields[j].values[i] += strtoul(ptr, &ptr, 16);
}
return num_lines;
}




- : send the line "unsubscribe linux-net" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux