Apologies, It's a callback.
We probably need some decent literature written for how to consume the various C, C++, Python and Lua APIs If you have a preference for any of those languages I could write a brief client program for you and start work on documenting this stuff. On Sep 26, 2017 6:04 PM, "重新开始" <15803846...@qq.com> wrote: > Hi, > Thank you for your detail information. After reading this, i can > understand. But after calling "want_per_interface_simple_stats" with > enable_disable=1, num=1 and sw_ifs[4], i do not know how to receive this > stats. calling other function or variable? Can you tell me how to receive > stats in my c program? > Thanks! > > > ------------------ 原始邮件 ------------------ > *发件人:* "Keith Burns";<alaga...@gmail.com>; > *发送时间:* 2017年9月27日(星期三) 上午6:39 > *收件人:* "重新开始"<15803846...@qq.com>;"vpp-dev"<vpp-dev@lists.fd.io>; > *主题:* Re: [vpp-dev] How to get interface stats using C api? > > Hi there, > > As of 17.10 you can now register for statistics on a per interface level. > > You need the sw_if_index of the interface you want stats for, but the > calls are in > https://git.fd.io/vpp/tree/src/vpp/stats/stats.api > > but as an example: > Register: > > autoreply define want_per_interface_simple_stats > { > u32 client_index; > u32 context; > u32 enable_disable; > u32 pid; > u32 num; > u32 sw_ifs[num]; > > }; > > > So calling "want_per_interface_simple_stats" with enable_disable=1, num=1 and > sw_ifs[4] will give you > > interface_simple_stats every 10sec for sw_if_index=4. > > > The content of "interface_simple_stats" looks like: > > > /** \brief Simple per interface stats counters structure > @param count - number of elements in message > @param timestamp - u32 vlib timestamp for control plane > @param data[count] - vl_api_vnet_simple_counter_t > > */ > manual_print manual_endian define vnet_per_interface_simple_counters > { > u32 count; > u32 timestamp; > vl_api_vnet_simple_counter_t data[count]; > }; > > > Where each "vnet_simple_counter_t" looks like: > > > https://git.fd.io/vpp/tree/src/vnet/interface.api > > /** \brief Simple interface counter data type for > vnet_interface_simple_counters > @param sw_if_index - interface indexes for counters > @param drop - RX or TX drops due to buffer starvation > @param punt - used with VNET "punt" disposition > @param rx_ip4 - received IP4 packets > @param rx_ip6 - received IP6 packets > @param rx_no_buffer - no RX buffers available > @param rx_miss - receive misses > @param rx_error - receive errors > @param tx_error - transmit errors > @param rx_mpls - received MPLS packet > > */ > typeonly manual_print manual_endian define vnet_simple_counter > { > u32 sw_if_index; > u64 drop; > u64 punt; > u64 rx_ip4; > u64 rx_ip6; > u64 rx_no_buffer; > u64 rx_miss; > u64 rx_error; > u64 tx_error; > u64 rx_mpls; > }; > > > So you will get back an array of counter structs for each sw_if_index you > registered for. > > > At the moment the impl sends on sw_if_index per reply but that is going to > change so that for each client we send as much in one message as possible. > > > > > > On Tue, Sep 26, 2017 at 4:50 AM 重新开始 <15803846...@qq.com> wrote: > >> Hi, everyone! >> How to get interface stats using C api? >> For example, I want to know "GigabitEthernete/0/1" rx packets , what should >> I do? >> >> Thanks >> >> _______________________________________________ >> vpp-dev mailing list >> vpp-dev@lists.fd.io >> https://lists.fd.io/mailman/listinfo/vpp-dev > >
_______________________________________________ vpp-dev mailing list vpp-dev@lists.fd.io https://lists.fd.io/mailman/listinfo/vpp-dev