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/format_helper.c

    r633339d rcc9c9de  
    127127        double ts;
    128128        double now;
     129        double sincebeginnow = 0;
     130        double sincebegintrace = 0;
     131
    129132#ifdef WIN32
    130133        struct __timeb64 tstruct;
     
    182185
    183186       
    184         if (fabs(trace->event.tdelta)>1e-9) {
    185                 /* Subtract the tdelta from the walltime to get a suitable
     187        if (fabs(trace->event.first_now)>1e-9) {
     188                /* Subtract the tdelta from the starting times to get a suitable
    186189                 * "relative" time */
    187                 now -= trace->event.tdelta;
     190                sincebeginnow = (now - trace->event.first_now);
     191                sincebegintrace = (ts - trace->event.first_ts);
    188192
    189193                /* If the trace timestamp is still in the future, return a
    190194                 * SLEEP event, otherwise return the packet */
    191                 if (ts > now) {
    192                         event.seconds = ts -
    193                                 trace->event.trace_last_ts;
    194                         trace->event.trace_last_ts = ts;
     195                if (sincebeginnow <= sincebegintrace / trace->replayspeedup) {
     196                        event.seconds = ((sincebegintrace / trace->replayspeedup) - sincebeginnow);
    195197                        event.type = TRACE_EVENT_SLEEP;
    196198                        trace->event.waiting = true;
     
    204206                 * trace file.
    205207                 */
    206                 trace->event.tdelta = now - ts;
     208                trace->event.first_now = now;
     209                trace->event.first_ts = ts;
    207210        }
    208211
     
    219222        event.type = TRACE_EVENT_PACKET;
    220223
    221         trace->event.trace_last_ts = ts;
    222224        trace->event.waiting = false;
    223225
Note: See TracChangeset for help on using the changeset viewer.