Hi Gleb, -----Original Message-----
From: Gleb Smirnoff <gleb...@freebsd.org> Date: 2016-03-15, Tuesday at 12:12 To: Ravi Pokala <rpok...@mac.com> Cc: <src-committ...@freebsd.org>, <svn-src-...@freebsd.org>, <svn-src-head@freebsd.org> Subject: Re: svn commit: r296880 - in head: share/man/man9 sys/kern sys/sys > Ravi, > >On Mon, Mar 14, 2016 at 05:33:06PM -0700, Ravi Pokala wrote: >R> To make sure I'm reading this correctly: >R> >R> (1) The sysctl operates on an opaque array of (uint64_t)s. The elements of >the array are not individually accessible. > >On array of counter_u64_t. The elements are individually accessible of course, >but not by this sysctl API. Got it. >R> For example, if you have a bunch of device statistics, this interface will >let you get or clear them all in one shot, but they won't have distinct names. >You would have to define an enum to set up names for the array indices. > >Something what you want is already provided by VNET_PCPUSTAT* macros. >The idea is that you declare a struct, whose members all are uint64_t. >This struct becomes an API between userland and kernel. > >The VNET_PCPUSTAT* macros then are used to allocate nameless arrays of >counter(9)s, with number of elements equal to number of members in the API >struct. Each counter array element accumulates statistics for its corresponding >struct member. > >The only problem, is that VIMAGE is mixed into this set of macros. Yeah. I think I looked at that stuff before, and got confused. Between this new change, and other uses of counter(9) which have been introduced since I last looked, I understand this quite a bit better now. >What needs >to be done is separate logic of making correspondence of array of counters to >struct members and VIMAGE, yielding in a more generic and network unaware KPI. >This KPI should be moved from vnet.h into counter.h, and in vnet.h there should >remain macros that summon VIMAGE awareness upon the new macros in counter.h. > >See struct tcpstat as example usage of VNET_PCPUSTAT* macros. The one that clarified it the most for me was SFSTAT_ADD() - the use of offsetof() to map between the name of the stat field in (struct sfstat) and the array index. Thanks! -Ravi (rpokala@) >-- >Totus tuus, Glebius. _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"