Re: Reset Statistics?

Linux Advanced Routing and Traffic Control

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

 



* Sven Anders <41924B7F.3050202@xxxxxxxxxx> 2004-11-10 18:10
> Is it possible to reset the statistics (ip -s link) ??
> 
> If not, why. Maybe there is a trick?

The statistics are stored in the driver but you can
write a kernel module calling get_stats for each netdevice
and set them to 0.

struct net_device *dev;

rtnl_lock();
read_lock(&dev_base_lock);
for (dev = dev_base; dev; dev = dev->next) {
   struct net_device_stats *s = dev->get_stats();
   memset(s, 0, sizeof(*s));
}
read_unlock(&dev_base_lock);
rtnl_unlock();

Both, dev_base and dev_base_lock are exported symbols.
Not tested but might work.
_______________________________________________
LARTC mailing list / LARTC@xxxxxxxxxxxxxxx
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux