Changeset 243bfd1


Ignore:
Timestamp:
03/04/19 13:57:16 (21 months ago)
Author:
Shane Alcock <salcock@…>
Branches:
develop
Parents:
450d198
git-author:
Shane Alcock <salcock@…> (03/04/19 13:42:54)
git-committer:
Shane Alcock <salcock@…> (03/04/19 13:57:16)
Message:

Improve parallel performance by skipping needless sanity checks

Normally, the sanity checking that we do here would be a good idea,
just in case something has corrupted one of our packets.

BUT, these checks happen every single time we attempt to read a
batch of packets (even for members of the packet array that are
not filled in by the read operation) and even though the checks
themselves are pretty simple, the CPU cycles used to perform them
really start to add up at high packet rates.

Instead, we're going to trust that a) we don't invalidate the
packets ourselves with some broken internal code and b) the user
doesn't go around touching raw packet structure contents
because we have an API for all necessary interactions. Sanity
checks can also be added at the point where the packet array element
is about to be updated by the read, if necessary. At least at that
point, we're sanity-checking something that we're about to use
instead of the current case where we waste time checking something
that we may or may not use.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/trace_parallel.c

    rfc85f33 r243bfd1  
    14121412        if (libtrace->format->pread_packets) {
    14131413                int ret;
     1414#if 0
    14141415                for (i = 0; i < (int) nb_packets; ++i) {
    14151416                        if (!i[packets]) {
     
    14241425                                return -1;
    14251426                        }
    1426                         packets[i]->which_trace_start = libtrace->startcount;
    1427                 }
     1427                }
     1428#endif
    14281429                do {
    14291430                        ret=libtrace->format->pread_packets(libtrace, t,
     
    14511452                                        trace_set_capture_length(packets[i],
    14521453                                                        libtrace->snaplen);
     1454                                packets[i]->which_trace_start = libtrace->startcount;
    14531455                        }
    14541456                } while(ret == 0);
Note: See TracChangeset for help on using the changeset viewer.