summaryrefslogtreecommitdiffstats
path: root/host/apps
diff options
context:
space:
mode:
authorPhilip Balister <philip@opensdr.com>2010-05-19 22:26:14 +0000
committerPhilip Balister <philip@opensdr.com>2010-05-19 22:26:14 +0000
commit090d066570993f068f2e3b3a6c6bd25986fc92b7 (patch)
tree8cafe4e2ec499499812a8c246e67cc3c85428f3d /host/apps
parentfe753af7e62e55668cb331b7b74ea14d6e45a0ec (diff)
downloaduhd-090d066570993f068f2e3b3a6c6bd25986fc92b7.tar.gz
uhd-090d066570993f068f2e3b3a6c6bd25986fc92b7.tar.bz2
uhd-090d066570993f068f2e3b3a6c6bd25986fc92b7.zip
Calculate received sample rate for loopback test.
Diffstat (limited to 'host/apps')
-rw-r--r--host/apps/omap_debug/usrp-e-rw.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/host/apps/omap_debug/usrp-e-rw.c b/host/apps/omap_debug/usrp-e-rw.c
index 1b12fa889..f96e4e25b 100644
--- a/host/apps/omap_debug/usrp-e-rw.c
+++ b/host/apps/omap_debug/usrp-e-rw.c
@@ -38,9 +38,14 @@ static void *read_thread(void *threadid)
int cnt, prev_seq_num, pkt_count;
struct usrp_transfer_frame *rx_data;
struct pkt *p;
+ unsigned long bytes_transfered, elapsed_seconds;
+ struct timeval start_time, finish_time;
printf("Greetings from the reading thread!\n");
+ bytes_transfered = 0;
+ gettimeofday(&start_time, NULL);
+
// IMPORTANT: must assume max length packet from fpga
rx_data = malloc(sizeof(struct usrp_transfer_frame) + sizeof(struct pkt) + (1016 * 2));
p = (struct pkt *) ((void *)rx_data + offsetof(struct usrp_transfer_frame, buf));
@@ -73,8 +78,24 @@ static void *read_thread(void *threadid)
printf("Checksum fail packet = %X, expected = %X, pkt_count = %d\n",
calc_checksum(p), p->checksum, pkt_count);
- printf(".");
- fflush(stdout);
+
+ bytes_transfered += rx_data->len;
+
+ if (bytes_transfered > (100 * 1000000)) {
+ gettimeofday(&finish_time, NULL);
+ elapsed_seconds = finish_time.tv_sec - start_time.tv_sec;
+
+ printf("RX data transfer rate = %f K Samples/second\n",
+ (float) bytes_transfered / (float) elapsed_seconds / 250);
+
+
+ start_time = finish_time;
+ bytes_transfered = 0;
+ }
+
+
+// printf(".");
+// fflush(stdout);
// printf("\n");
}
@@ -112,7 +133,7 @@ static void *write_thread(void *threadid)
cnt = write(fp, tx_data, 2048);
if (cnt < 0)
printf("Error returned from write: %d\n", cnt);
- sleep(1);
+// sleep(1);
}
}