#define MSEC (1000)
-#define PARAM_SERVERADDR 1
-#define MAX_SENDENDPOINTS 10
+#define MAX_SENDENDPOINTS 10
unsigned opt_packet_size = 800;
unsigned opt_period_usec = 10*MSEC;
send_timestamp = msg.send_timestamp;
timespec_sub(&trans_time,&recv_timestamp ,&send_timestamp);
- trans_time_usec = (trans_time.tv_sec * 1000000 + \
- trans_time.tv_nsec / 1000) /2;
+ trans_time_usec = (trans_time.tv_sec * SEC_TO_USEC + \
+ trans_time.tv_nsec / USEC_TO_NSEC) /2;
if (trans_time_usec < MAX_DELAY_US)
delay_stats[ac][trans_time_usec/GRANULARITY]++;
if (opt_packet_size) {
packet_size = opt_packet_size;
- period_usec = 1000000LL*packet_size*8/spoint->bandwidth_bps;
+ period_usec = SEC_TO_USEC*packet_size*8/spoint->bandwidth_bps;
} else {
period_usec = spoint->period_usec;
- packet_size = (long long)spoint->bandwidth_bps/8 * period_usec/1000000;
+ packet_size = (long long)spoint->bandwidth_bps/8 * period_usec/SEC_TO_USEC;
}
snprintf(stream_desc, sizeof(stream_desc), "%d: %s %s (%d bytes per %s +-%s, %d packets/s)\n",
spoint-sepoint, ac_to_text[ac], bandwidth_to_text(buf1, spoint->bandwidth_bps),
packet_size, usec_to_text(buf2, period_usec),
- usec_to_text(buf3, opt_jitter*period_usec/100), 1000000/period_usec);
+ usec_to_text(buf3, opt_jitter*period_usec/100), (int) SEC_TO_USEC/period_usec);
printf("%s", stream_desc);
fprintf(logfd, "# Stream %s", stream_desc);
if (packet_size < sizeof(struct msg_t)) {
- fprintf(stderr, "Pakcet size too small (min %d)\n", sizeof(struct msg_t));
+ fprintf(stderr, "Packet size too small (min %d)\n", sizeof(struct msg_t));
exit(1);
}
/* |~~~+~~~| jitter interval (width = 2*opt_jitter percentage from period)*/
/* |-------------| nominal period*/
if (opt_jitter) {
- period.tv_nsec = 1000LL*(period_usec*(100-opt_jitter)/100
+ period.tv_nsec = USEC_TO_NSEC*(period_usec*(100-opt_jitter)/100
+ rand() % (2*period_usec*opt_jitter/100));
} else {
- period.tv_nsec = 1000LL*(period_usec);
+ period.tv_nsec = USEC_TO_NSEC*(period_usec);
}
period.tv_sec = 0;