Changeset 1973
- Timestamp:
- 04/11/08 15:00:08 (8 months ago)
- Location:
- features/performance/src
- Files:
-
- 3 modified
-
common/timer.h (modified) (2 diffs)
-
send_packets.c (modified) (4 diffs)
-
sleep.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
features/performance/src/common/timer.h
r1971 r1973 60 60 tvp->tv_sec = time; \ 61 61 tvp->tv_usec = (time - tvp->tv_sec) * 100000; \ 62 } while (0) ;62 } while (0) 63 63 #endif 64 64 … … 75 75 (tv)->tv_usec = (ts)->tv_nsec / 1000; } 76 76 #endif 77 78 #ifndef ROUND_TIMESPEC_TO_MICROSEC(ts) 79 #define ROUND_TIMESPEC_TO_MICROSEC(ts) \ 80 do { \ 81 (ts)->tv_nsec = (lroundf((float)(ts)->tv_nsec / 1000) * 1000); \ 82 } while (0) 83 #endif 84 85 77 86 78 87 /* zero out a timer */ -
features/performance/src/send_packets.c
r1971 r1973 385 385 timesclear(&nap); 386 386 } 387 388 /* round up/down as necessary */ 389 if (accurate != ACCURATE_ABS_TIME) 390 ROUND_TIMESPEC_TO_MICROSEC(&nap); 391 387 392 break; 388 393 … … 396 401 nap.tv_sec = n; 397 402 nap.tv_nsec = (n - nap.tv_sec) * 1000000000; 403 404 /* round up/down as necessary */ 405 if (accurate != ACCURATE_ABS_TIME) 406 ROUND_TIMESPEC_TO_MICROSEC(&nap); 407 398 408 dbgx(3, "packet size %d\t\tequals %f bps\t\tnap " TIMEVAL_FORMAT, len, n, 399 409 nap.tv_sec, nap.tv_nsec); … … 458 468 459 469 470 /* 471 * Depending on the accurate method & packet rate computation method 472 460 473 /* 461 474 * We have multiple methods of sleeping, pick the right one... … … 492 505 case ACCURATE_NANOSLEEP: 493 506 nanosleep_sleep(nap_this_time); 494 495 507 break; 496 508 /* -
features/performance/src/sleep.h
r1972 r1973 114 114 * sleep for some time using the select() call timeout method. This is 115 115 * highly portable for sub-second sleeping, but only for about 1msec 116 * resolution. 116 * resolution which is pretty much useless for our needs. Keeping it here 117 * for furture reference 117 118 */ 118 119 static inline void
