Changeset 8958

Show
Ignore:
Timestamp:
07/20/08 15:55:40
Author:
jcorgan
Message:

Tweak on testing USRP2 host code rx throughput.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • usrp2/branches/features/host-ng/host-ng/apps/test_usrp2.cc

    r8955 r8958  
    142142  size_t bufsize = 100e6; 
    143143  unsigned char *buf = (unsigned char *)malloc(bufsize); 
    144   usrp2::copy_handler h(buf, bufsize); 
    145144 
    146   printf("Receiving data into buffer of length %li bytes.\n\n", bufsize); 
     145  printf("Receiving data ten times into buffer of length %li bytes.\n\n", bufsize); 
    147146 
    148147  struct timeval start, end; 
    149148  gettimeofday(&start, 0); 
    150149 
     150  printf("Each '.' is 100 packets:\n"); 
    151151 
    152   printf("Each '.' is 100 packets:\n"); 
    153   bool ok; 
    154   unsigned int n = 0; 
     152  int count = 0; 
     153  unsigned long bytes = 0; 
     154  unsigned long times = 0; 
     155   
    155156  do { 
    156     ok = u2->rx_samples(0, &h); 
    157     if (h.times() > n) { 
    158       printf("."); fflush(stdout); 
    159       n = n+100; 
     157    usrp2::copy_handler h(buf, bufsize); 
     158    bool ok; 
     159    unsigned int n = 0; 
     160    do { 
     161      ok = u2->rx_samples(0, &h); 
     162      if (h.times() > n) { 
     163        printf("."); fflush(stdout); 
     164        n = n+100; 
     165      } 
    160166    } 
     167    while (ok && !h.full()); 
     168    if (!ok) 
     169      break; 
     170 
     171    bytes += h.bytes(); 
     172    times += h.times(); 
    161173  } 
    162   while (ok && !h.full()); 
     174  while (++count < 10);     
    163175 
    164176  gettimeofday(&end, 0); 
     
    166178  long n_secs = end.tv_sec-start.tv_sec; 
    167179  double elapsed = (double)n_secs + (double)n_usecs*1e-6; 
    168   double mbs = h.bytes()/elapsed/1e6; 
    169   double pps = h.times()/elapsed; 
     180  double mbs = bytes/elapsed/1e6; 
     181  double pps = times/elapsed; 
    170182   
    171183  u2->stop_rx_streaming(); 
    172184 
    173   printf("\nCopy handler called %li times.\n", h.times()); 
    174   printf("Copy handler called with %li bytes.\n\n", h.bytes()); 
     185  printf("\nCopy handler called %li times.\n", times); 
     186  printf("Copy handler called with %li bytes.\n\n", bytes); 
    175187  printf("Elapsed time was %5.3f seconds.\n", elapsed); 
    176188  printf("Packet rate was %1.0f pkts/sec.\n", pps);