Changeset 5ab626a for lib/format_dpdk.c


Ignore:
Timestamp:
02/18/15 17:41:48 (6 years ago)
Author:
Richard Sanger <rsangerarj@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
e4f27d1
Parents:
8bcc925
Message:

Deprecate trace_get_filtered/accepted/recevied/dropped() in favour of a single function

Adds the single trace_get_statistics function. This allows the structure to be filled
at a point in time, rather than making multiple calls to the library during which state
might have changed.

This has been designed such that the structure can be added to in the future without
breaking old code.

The old internal get_captured_packets was removed from the formats as it was never used.
Eventually we should completely remove get_filtered and received from the formats and replace
them with get_statistics.

In additon some extra fields have added, such as error and captured and the pre-existing
fields are better defined.

The linux formats have been updated to use this new API, which combined with reading
/proc/net/dev returns a full set of statistics.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_dpdk.c

    r4631115 r5ab626a  
    21662166    /* Get the drop counter */
    21672167    return (uint64_t) stats.ierrors;
    2168 }
    2169 
    2170 static uint64_t dpdk_get_captured_packets (libtrace_t *trace) {
    2171     struct rte_eth_stats stats = {0};
    2172 
    2173     if (trace->format_data == NULL || FORMAT(trace)->port == 0xFF)
    2174         return UINT64_MAX;
    2175     /* Grab the current stats */
    2176     rte_eth_stats_get(FORMAT(trace)->port, &stats);
    2177 
    2178     /* Get the drop counter */
    2179     return (uint64_t) stats.ipackets;
    21802168}
    21812169
     
    23152303        dpdk_get_filtered_packets,/* get_filtered_packets */
    23162304        dpdk_get_dropped_packets,/* get_dropped_packets */
    2317     dpdk_get_captured_packets,/* get_captured_packets */
     2305        NULL,                   /* get_statistics */
    23182306        NULL,                       /* get_fd */
    23192307        dpdk_trace_event,               /* trace_event */
    2320     dpdk_help,              /* help */
    2321     NULL,                   /* next pointer */
    2322     {true, 8},              /* Live, NICs typically have 8 threads */
    2323     dpdk_pstart_input, /* pstart_input */
     2308        dpdk_help,              /* help */
     2309        NULL,                   /* next pointer */
     2310        {true, 8},              /* Live, NICs typically have 8 threads */
     2311        dpdk_pstart_input, /* pstart_input */
    23242312        dpdk_pread_packets, /* pread_packets */
    23252313        dpdk_pause_input, /* ppause */
    23262314        dpdk_fin_input, /* p_fin */
    23272315        dpdk_pconfig_input, /* pconfig_input */
    2328     dpdk_pregister_thread, /* pregister_thread */
    2329     dpdk_punregister_thread /* unpregister_thread */
     2316        dpdk_pregister_thread, /* pregister_thread */
     2317        dpdk_punregister_thread, /* punregister_thread */
     2318        NULL                            /* get thread stats */
    23302319};
    23312320
Note: See TracChangeset for help on using the changeset viewer.