Ignore:
Timestamp:
02/18/15 17:41:48 (7 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/trace_parallel.c

    r8bcc925 r5ab626a  
    19061906
    19071907        /* Cache values before we pause */
    1908         libtrace->dropped_packets = trace_get_dropped_packets(libtrace);
    1909         libtrace->received_packets = trace_get_received_packets(libtrace);
    1910         uint64_t tmp_stats;
    1911         if (libtrace->format->get_filtered_packets) {
    1912                 if ((tmp_stats = libtrace->format->get_filtered_packets(libtrace)) != UINT64_MAX) {
    1913                         libtrace->filtered_packets += tmp_stats;
    1914                 }
    1915         }
     1908        if (libtrace->stats == NULL)
     1909                libtrace->stats = trace_create_statistics();
     1910        // Save the statistics against the trace
     1911        trace_get_statistics(libtrace, NULL);
    19161912        if (trace_supports_parallel(libtrace) && !trace_has_dedicated_hasher(libtrace) && libtrace->perpkt_thread_count > 1) {
    19171913                libtrace->started = false;
Note: See TracChangeset for help on using the changeset viewer.