Ignore:
Timestamp:
02/28/17 13:49:40 (4 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, master, ndag_format, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
6fb691b, 9d29d1e
Parents:
dea08f1
Message:

Ensure packet->order is always strictly incrementing

We cannot equate timestamp with packet->order, as some timestamp
methods are not strictly monotonic (ring: and int:).

Each format is now responsible for determining packet->order
during pread, so that the format can detect and correct such
inaccuracies.

More specifically, ring: and int: will cache the last reported
timestamp per thread and if time goes backwards, the order will
be set to last+1, otherwise the timestamp will be used.

DAG and DPDK still use the timestamp for ordering, since there
have been no issues with the timestamp ordering for these formats
(thus far!).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_linux_int.c

    r5e3f16c rdb84bb2  
    286286        }
    287287
     288
    288289        /* Buffer contains all of our packet (including our custom header) so
    289290         * we just need to get prepare_packet to set all our packet pointers
     
    294295                return -1;
    295296       
     297        if (hdr->timestamptype == TS_TIMEVAL) {
     298                packet->order = (((uint64_t)hdr->tv.tv_sec) << 32)
     299                            + ((((uint64_t)hdr->tv.tv_usec) << 32) /1000000);
     300        } else if (hdr->timestamptype == TS_TIMESPEC) {
     301                packet->order = (((uint64_t)hdr->ts.tv_sec) << 32)
     302                            + ((((uint64_t)hdr->ts.tv_nsec) << 32) /1000000000);
     303        } else {
     304                packet->order = 0;
     305        }
     306
     307        if (packet->order <= stream->last_timestamp) {
     308                packet->order = stream->last_timestamp + 1;
     309        }
     310
     311        stream->last_timestamp = packet->order;
     312
    296313        return hdr->wirelen+sizeof(*hdr);
    297314}
Note: See TracChangeset for help on using the changeset viewer.