want to add per-socket stats, what is best way to extract data?

Chris Friesen
2002-06-05T19:07:18Z

I'm considering adding per-socket statistics, starting with number of skbuffs
received and number of skbuffs dropped due to no memory.

The actual accounting is fairly straightforward (just add entries to struct sock
and increment as appropriate in sock_queue_rcv_skb() and sock_queue_err_skb()),
but I'm trying to figure out the best way to make the stats available.

I had considered two possibilities, and it may make sense to use both.

The first would be to expand sock_ioctl() to first check for generic socket
commands before calling the protocol specific ioctl() routines. This allows for
easy usage from within userspace binaries. The second would be to have socket
statistics shown under /proc/<pid>/fd/<fd number>. This would allow for easy
script/human access.

Does anyone have any comments about either of these, or about the desirability
of this in general?

Chris

--
Chris Friesen | MailStop: 043/33/F10
Nortel Networks | work: (613) 765-0557
3500 Carling Avenue | fax: (613) 765-2986
Nepean, ON K2H 8E9 Canada | email: cfriesen@nortelnetworks.com