fprintf(stderr,"TX RBUF: ri %d wi %d ra %d wa %d\n",tx_rbuf.read_index,tx_rbuf.write_index,rbuf_read_amount(&tx_rbuf),rbuf_write_amount(&tx_rbuf));
fprintf(stderr,"RX RBUF: ri %d wi %d ra %d wa %d\n",rx_rbuf.read_index,rx_rbuf.write_index,rbuf_read_amount(&rx_rbuf),rbuf_write_amount(&rx_rbuf));
fprintf(stderr,"TRXW RBUF: ri %d wi %d ra %d wa %d\n",trxw_rbuf[0].read_index,trxw_rbuf[0].write_index,rbuf_read_amount(&trxw_rbuf[0]),rbuf_write_amount(&trxw_rbuf[0]));
fprintf(stderr,"TRXR RBUF: ri %d wi %d ra %d wa %d\n",trxr_rbuf[0].read_index,trxr_rbuf[0].write_index,rbuf_read_amount(&trxr_rbuf[0]),rbuf_write_amount(&trxr_rbuf[0]));
fprintf(stderr,"TRXW GROUP RBUF: ri %d wi %d ra %d wa %d\n",trxw_group_rbuf.read_index,trxw_group_rbuf.write_index,rbuf_read_amount(&trxw_group_rbuf),rbuf_write_amount(&trxw_group_rbuf));
error(EXIT_FAILURE,errno,"Couldn't open %s\n",stats_file_name);
// Set thread CPU affinity
CPU_ZERO(&mask);
CPU_SET(s->statistic_affinity,&mask);
if(sched_setaffinity(0,sizeof(mask),&mask))
error(EXIT_FAILURE,errno,"Could not set CPU affinity to CPU %d\n",s->statistic_affinity);
clock_gettime(CLOCK_TAI,&initial);
next=initial;
for(int64_ti=0;;i++){
add_ns(&next,STATISTIC_REFRESH_RATE);
#ifdef TRACE
trace_handler(initial,s);
#endif
print_stats(stats_file_desc,(i%50)==0);
#ifdef DEBUG
fprintf(stats_file_desc,
"%d %d %d %d %d %d %d %d\n",
rx_rbuf.write_index,
rx_rbuf.read_index,
trxr_rbuf[0].write_index,
trxr_rbuf[0].read_index,
trxw_rbuf[0].write_index,
trxw_rbuf[0].read_index,
tx_rbuf.write_index,
tx_rbuf.read_index);
fprintf(stats_file_desc,"TRXW RBUF: ri %d wi %d ra %d wa %d\n",trxw_rbuf[0].read_index,trxw_rbuf[0].write_index,rbuf_read_amount(&trxw_rbuf[0]),rbuf_write_amount(&trxw_rbuf[0]));