Changeset 1880
- Timestamp:
- 07/18/07 20:52:55 (16 months ago)
- Location:
- features/performance/src
- Files:
-
- 2 added
- 7 modified
-
common.h (modified) (1 diff)
-
common/Makefile.am (modified) (2 diffs)
-
common/rdtsc.c (added)
-
common/rdtsc.h (added)
-
common/timer.h (modified) (1 diff)
-
send_packets.c (modified) (3 diffs)
-
tcpprep.c (modified) (1 diff)
-
tcpreplay.c (modified) (2 diffs)
-
tcpreplay_opts.def (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
features/performance/src/common.h
r1757 r1880 16 16 #include "common/utils.h" 17 17 #include "common/xX.h" 18 #include "common/rdtsc.h" 18 19 #include "common/tcpdump.h" 19 20 #include "common/timer.h" -
features/performance/src/common/Makefile.am
r1809 r1880 15 15 fakepcap.c fakepcapnav.c fakepoll.c xX.c utils.c \ 16 16 timer.c svn_version.c abort.c sendpacket.c \ 17 dlt_names.c mac.c interface.c 17 dlt_names.c mac.c interface.c rdtsc.c 18 18 19 19 if ENABLE_TCPDUMP … … 28 28 fakepcap.h fakepcapnav.h fakepoll.h xX.h utils.h \ 29 29 tcpdump.h timer.h abort.h pcap_dlt.h sendpacket.h \ 30 dlt_names.h mac.h interface.h 30 dlt_names.h mac.h interface.h rdtsc.h 31 31 32 32 MOSTLYCLEANFILES = *~ -
features/performance/src/common/timer.h
r1854 r1880 122 122 } while(0) 123 123 124 125 /* device tvp by x. store in tvp */126 #define timerdiv2(tvp, x) \127 do { \128 (tvp)->tv_sec = (tvp)->tv_sec / x; \129 (tvp)->tv_usec = (tvp)->tv_usec / x; \130 } while(0)131 132 124 #endif 133 -
features/performance/src/send_packets.c
r1874 r1880 326 326 static u_int32_t send = 0; /* remember # of packets to send btw calls */ 327 327 u_int32_t loop; 328 u_int64_t loop2; 328 329 329 330 /* just return if topspeed */ … … 447 448 } 448 449 449 if (!accurate) { 450 451 if (accurate == 2) { 452 loop2 = rdtsc_sleep(nap); 453 //fprintf(stderr, "rdtsc slept for %llu clicks\n", loop2); 454 dbgx(3, "rdtsc slept for %llu times", loop); 455 } else if (accurate == 1) { 456 /* gettimeofday() loop */ 457 timeradd(&now, &nap, &delta); 458 loop = sleep_loop(delta); 459 dbgx(3, "sleep_loop looped %u times", loop); 460 } else { 450 461 timeradd(&didsleep, &nap, &didsleep); 451 462 … … 465 476 } 466 477 } 467 } else {468 timeradd(&now, &nap, &delta);469 loop = sleep_loop(delta);470 dbgx(3, "sleep_loop looped %u times", loop);471 478 } 472 479 #ifdef DEBUG -
features/performance/src/tcpprep.c
r1846 r1880 421 421 check_dst_port(ip_hdr, (pkthdr.caplen - l2len))); 422 422 break; 423 424 default: 425 errx(1, "Whops! What mode are we in anyways? %d", options.mode); 423 426 } 424 427 #ifdef ENABLE_VERBOSE -
features/performance/src/tcpreplay.c
r1839 r1880 286 286 warn("not configured with --enable-debug. Debugging disabled."); 287 287 #endif 288 288 289 289 options.loop = OPT_VALUE_LOOP; 290 290 … … 328 328 if (HAVE_OPT(ACCURATE)) 329 329 options.accurate = 1; 330 330 331 if (HAVE_OPT(ACCURATE2)) { 332 options.accurate = 2; 333 rdtsc_calibrate(); 334 } 335 331 336 if (HAVE_OPT(PKTLEN)) 332 337 warn("--pktlen may cause problems. Use with caution."); -
features/performance/src/tcpreplay_opts.def
r1876 r1880 131 131 max = 1; 132 132 flags-cant = accurate; 133 arg-type = number;134 133 descrip = "Enable even more accurate packet timing"; 135 134 doc = <<- EOText 136 135 Enables the "even more" accurate timing at the cost of higher CPU 137 utilization by using a tight loop which increments a counter. This method 138 provides the most accurate timing of any option, but requires you to specify 139 a cost for each loop. This cost value is VERY system dependent, so you will 140 need to run --loop-test to get this value. 136 utilization by using the RDTSC counter available on newer CPU's. 137 Only works on more recent x86, x86_64 and PPC 141 138 EOText; 142 139 };
