Changeset cc9c9de for lib/trace.c


Ignore:
Timestamp:
05/18/18 11:39:59 (3 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
cachetimestamps, develop, etsilive, master, rc-4.0.4, ringdecrementfix, ringperformance
Children:
1e0a804
Parents:
e732393
git-author:
Shane Alcock <salcock@…> (04/17/18 16:45:58)
git-committer:
Shane Alcock <salcock@…> (05/18/18 11:39:59)
Message:

Add new config option for trace_event() -- REPLAY_SPEEDUP

This allows users to specify a "speedup factor" when using
trace_event() to replay trace files, i.e. all inter-packet
gaps will be divided by the speedup factor. This allows traces
to be replayed faster, while still preserving the same relative
gaps between packets.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/trace.c

    re732393 rcc9c9de  
    251251        libtrace->format=NULL;
    252252
    253         libtrace->event.tdelta = 0.0;
    254253        libtrace->event.packet = NULL;
    255254        libtrace->event.psize = 0;
    256         libtrace->event.trace_last_ts = 0.0;
     255        libtrace->event.first_ts = 0.0;
     256        libtrace->event.first_now = 0.0;
    257257        libtrace->event.waiting = false;
    258258        libtrace->filter = NULL;
    259259        libtrace->snaplen = 0;
     260        libtrace->replayspeedup = 1;
    260261        libtrace->started=false;
    261262        libtrace->uridata = NULL;
     
    378379        libtrace->format=NULL;
    379380
    380         libtrace->event.tdelta = 0.0;
    381381        libtrace->event.packet = NULL;
    382382        libtrace->event.psize = 0;
    383         libtrace->event.trace_last_ts = 0.0;
     383        libtrace->event.first_ts = 0;
     384        libtrace->event.first_now = 0;
    384385        libtrace->filter = NULL;
    385386        libtrace->snaplen = 0;
     
    595596         * deal with some options itself, so give that a go */
    596597        switch(option) {
     598                case TRACE_OPTION_REPLAY_SPEEDUP:
     599                        /* Clear the error if there was one */
     600                        if (trace_is_err(libtrace)) {
     601                                trace_get_err(libtrace);
     602                        }
     603                        if (*(int*)value<1
     604                                || *(int*)value>LIBTRACE_MAX_REPLAY_SPEEDUP) {
     605                                trace_set_err(libtrace,TRACE_ERR_BAD_STATE,
     606                                        "Invalid replay speed");
     607                        }
     608                        libtrace->replayspeedup=*(int*)value;
     609                        return 0;
     610
    597611                case TRACE_OPTION_SNAPLEN:
    598612                        /* Clear the error if there was one */
Note: See TracChangeset for help on using the changeset viewer.