commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r8958 - usrp2/branches/features/host-ng/host-ng/apps


From: jcorgan
Subject: [Commit-gnuradio] r8958 - usrp2/branches/features/host-ng/host-ng/apps
Date: Sun, 20 Jul 2008 15:55:40 -0600 (MDT)

Author: jcorgan
Date: 2008-07-20 15:55:40 -0600 (Sun, 20 Jul 2008)
New Revision: 8958

Modified:
   usrp2/branches/features/host-ng/host-ng/apps/test_usrp2.cc
Log:
Tweak on testing USRP2 host code rx throughput.

Modified: usrp2/branches/features/host-ng/host-ng/apps/test_usrp2.cc
===================================================================
--- usrp2/branches/features/host-ng/host-ng/apps/test_usrp2.cc  2008-07-20 
21:21:15 UTC (rev 8957)
+++ usrp2/branches/features/host-ng/host-ng/apps/test_usrp2.cc  2008-07-20 
21:55:40 UTC (rev 8958)
@@ -141,37 +141,49 @@
 
   size_t bufsize = 100e6;
   unsigned char *buf = (unsigned char *)malloc(bufsize);
-  usrp2::copy_handler h(buf, bufsize);
 
-  printf("Receiving data into buffer of length %li bytes.\n\n", bufsize);
+  printf("Receiving data ten times into buffer of length %li bytes.\n\n", 
bufsize);
 
   struct timeval start, end;
   gettimeofday(&start, 0);
 
+  printf("Each '.' is 100 packets:\n");
 
-  printf("Each '.' is 100 packets:\n");
-  bool ok;
-  unsigned int n = 0;
+  int count = 0;
+  unsigned long bytes = 0;
+  unsigned long times = 0;
+  
   do {
-    ok = u2->rx_samples(0, &h);
-    if (h.times() > n) {
-      printf("."); fflush(stdout);
-      n = n+100;
+    usrp2::copy_handler h(buf, bufsize);
+    bool ok;
+    unsigned int n = 0;
+    do {
+      ok = u2->rx_samples(0, &h);
+      if (h.times() > n) {
+        printf("."); fflush(stdout);
+        n = n+100;
+      }
     }
+    while (ok && !h.full());
+    if (!ok)
+      break;
+
+    bytes += h.bytes();
+    times += h.times();
   }
-  while (ok && !h.full());
+  while (++count < 10);    
 
   gettimeofday(&end, 0);
   long n_usecs = end.tv_usec-start.tv_usec;
   long n_secs = end.tv_sec-start.tv_sec;
   double elapsed = (double)n_secs + (double)n_usecs*1e-6;
-  double mbs = h.bytes()/elapsed/1e6;
-  double pps = h.times()/elapsed;
+  double mbs = bytes/elapsed/1e6;
+  double pps = times/elapsed;
   
   u2->stop_rx_streaming();
 
-  printf("\nCopy handler called %li times.\n", h.times());
-  printf("Copy handler called with %li bytes.\n\n", h.bytes());
+  printf("\nCopy handler called %li times.\n", times);
+  printf("Copy handler called with %li bytes.\n\n", bytes);
   printf("Elapsed time was %5.3f seconds.\n", elapsed);
   printf("Packet rate was %1.0f pkts/sec.\n", pps);
   printf("Approximate throughput was %5.2f MB/sec.\n", mbs);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]