Changeset cc9c9de
- Timestamp:
- 05/18/18 11:39:59 (3 years ago)
- 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)
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/format_dag25.c
ra857389 rcc9c9de 608 608 return -1; 609 609 case TRACE_OPTION_EVENT_REALTIME: 610 case TRACE_OPTION_REPLAY_SPEEDUP: 610 611 /* Live capture is always going to be realtime */ 611 612 return -1; -
lib/format_helper.c
r633339d rcc9c9de 127 127 double ts; 128 128 double now; 129 double sincebeginnow = 0; 130 double sincebegintrace = 0; 131 129 132 #ifdef WIN32 130 133 struct __timeb64 tstruct; … … 182 185 183 186 184 if (fabs(trace->event. tdelta)>1e-9) {185 /* Subtract the tdelta from the walltimeto get a suitable187 if (fabs(trace->event.first_now)>1e-9) { 188 /* Subtract the tdelta from the starting times to get a suitable 186 189 * "relative" time */ 187 now -= trace->event.tdelta; 190 sincebeginnow = (now - trace->event.first_now); 191 sincebegintrace = (ts - trace->event.first_ts); 188 192 189 193 /* If the trace timestamp is still in the future, return a 190 194 * 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); 195 197 event.type = TRACE_EVENT_SLEEP; 196 198 trace->event.waiting = true; … … 204 206 * trace file. 205 207 */ 206 trace->event.tdelta = now - ts; 208 trace->event.first_now = now; 209 trace->event.first_ts = ts; 207 210 } 208 211 … … 219 222 event.type = TRACE_EVENT_PACKET; 220 223 221 trace->event.trace_last_ts = ts;222 224 trace->event.waiting = false; 223 225 -
lib/format_linux_common.c
rd47ca18 rcc9c9de 164 164 /* Live captures are always going to be in trace time */ 165 165 break; 166 case TRACE_OPTION_REPLAY_SPEEDUP: 167 break; 166 168 /* Avoid default: so that future options will cause a warning 167 169 * here to remind us to implement it, or flag it as -
lib/format_pcapfile.c
r5a70a80 rcc9c9de 257 257 case TRACE_OPTION_FILTER: 258 258 case TRACE_OPTION_HASHER: 259 case TRACE_OPTION_REPLAY_SPEEDUP: 259 260 /* All these are either unsupported or handled 260 261 * by trace_config */ -
lib/format_pcapng.c
r2c457ec rcc9c9de 260 260 case TRACE_OPTION_FILTER: 261 261 case TRACE_OPTION_HASHER: 262 case TRACE_OPTION_REPLAY_SPEEDUP: 262 263 break; 263 264 } -
lib/libtrace.h.in
r991ff43 rcc9c9de 1320 1320 /** The hasher function for a parallel libtrace. It is recommended to 1321 1321 * access this option via trace_set_hasher(). */ 1322 TRACE_OPTION_HASHER 1322 TRACE_OPTION_HASHER, 1323 1324 /** Speed up trace file replays (via trace_event()) by this factor */ 1325 TRACE_OPTION_REPLAY_SPEEDUP, 1323 1326 } trace_option_t; 1324 1327 -
lib/libtrace_int.h
rdf87f00 rcc9c9de 152 152 //#define RP_BUFSIZE 65536U 153 153 154 #define LIBTRACE_MAX_REPLAY_SPEEDUP 1000 155 154 156 /** Data about the most recent event from a trace file */ 155 157 struct libtrace_event_status_t { 156 158 /** A libtrace packet to store the packet when a PACKET event occurs */ 157 159 libtrace_packet_t *packet; 158 /** Time between the timestamp for the current packet and the current 159 * walltime */ 160 double tdelta; 161 /** The timestamp of the previous PACKET event */ 162 double trace_last_ts; 160 161 /* The walltime when we processed the first packet from the trace */ 162 double first_now; 163 164 /* The tracetime of the first packet in the trace */ 165 double first_ts; 166 163 167 /** The size of the current PACKET event */ 164 168 int psize; … … 313 317 * used only if the capture format does not support snapping natively */ 314 318 size_t snaplen; 319 /** Speed up the packet rate when using trace_event() to process trace 320 * files by this factor. */ 321 int replayspeedup; 315 322 /** Count of the number of packets returned to the libtrace user */ 316 323 uint64_t accepted_packets; -
lib/trace.c
re732393 rcc9c9de 251 251 libtrace->format=NULL; 252 252 253 libtrace->event.tdelta = 0.0;254 253 libtrace->event.packet = NULL; 255 254 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; 257 257 libtrace->event.waiting = false; 258 258 libtrace->filter = NULL; 259 259 libtrace->snaplen = 0; 260 libtrace->replayspeedup = 1; 260 261 libtrace->started=false; 261 262 libtrace->uridata = NULL; … … 378 379 libtrace->format=NULL; 379 380 380 libtrace->event.tdelta = 0.0;381 381 libtrace->event.packet = NULL; 382 382 libtrace->event.psize = 0; 383 libtrace->event.trace_last_ts = 0.0; 383 libtrace->event.first_ts = 0; 384 libtrace->event.first_now = 0; 384 385 libtrace->filter = NULL; 385 386 libtrace->snaplen = 0; … … 595 596 * deal with some options itself, so give that a go */ 596 597 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 597 611 case TRACE_OPTION_SNAPLEN: 598 612 /* Clear the error if there was one */ -
tools/tracereplay/tracereplay.c
r044d8bc rcc9c9de 209 209 libtrace_packet_t * new; 210 210 int snaplen = 0; 211 int speedup = 1; 211 212 212 213
Note: See TracChangeset
for help on using the changeset viewer.