Changeset f27e335 for lib


Ignore:
Timestamp:
08/16/18 11:22:15 (2 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
cachetimestamps, develop, master, ringdecrementfix, ringperformance
Children:
c862ad1
Parents:
eeabc19b
Message:

Don't decode the ETSI timestamp repeatedly.

In fact, we already decode the timestamp when we read the packet
and store it in ERF timestamp format within the "order" field.
Next time someone wants the packet's timestamp, just return that
ERF timestamp and everything will be nice and quick.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_etsilive.c

    r1f184fd rf27e335  
    528528        packet->wire_length = esock->cached.length;
    529529        packet->capture_length = esock->cached.length;
    530 
    531530        /*
    532531        for (j = 0; j < packet->wire_length; j++) {
     
    616615}
    617616
    618 static struct timeval etsilive_get_timeval(const libtrace_packet_t *packet) {
    619         /* TODO add cached timestamps to libtrace so we don't have to look
    620          * this up again. */
    621         struct timeval tv;
    622 
    623         tv.tv_sec = 0;
    624         tv.tv_usec = 0;
    625 
    626         libtrace_t *libtrace = packet->trace;
    627 
    628         assert(libtrace);
    629         assert(FORMAT_DATA->shareddec);
    630         wandder_attach_etsili_buffer(FORMAT_DATA->shareddec, packet->buffer,
    631                         0, false);
    632         tv = wandder_etsili_get_header_timestamp(FORMAT_DATA->shareddec);
    633         return tv;
     617static uint64_t etsilive_get_erf_timestamp(const libtrace_packet_t *packet) {
     618        return packet->order;
    634619}
    635620
     
    662647        NULL,                           /* get_direction */
    663648        NULL,                           /* set_direction */
    664         NULL,                           /* get_erf_timestamp */
    665         etsilive_get_timeval,           /* get_timeval */
     649        etsilive_get_erf_timestamp,     /* get_erf_timestamp */
     650        NULL,                           /* get_timeval */
    666651        NULL,                           /* get_timespec */
    667652        NULL,                           /* get_seconds */
Note: See TracChangeset for help on using the changeset viewer.