aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorBalint Seeber <balint@ettus.com>2014-11-03 17:35:00 -0800
committerMartin Braun <martin.braun@ettus.com>2014-11-04 08:52:04 +0100
commit18df93165fae23cbb1cf63f1a26ae9022dc5c3c6 (patch)
treec814723b769d4c56d48c78d4df7a78f9f075d642 /host
parentcdafa9bf22f64962df1d122a0cdc277de7bbb116 (diff)
downloaduhd-18df93165fae23cbb1cf63f1a26ae9022dc5c3c6.tar.gz
uhd-18df93165fae23cbb1cf63f1a26ae9022dc5c3c6.tar.bz2
uhd-18df93165fae23cbb1cf63f1a26ae9022dc5c3c6.zip
latency: fixed bugs in test running and grapher
Diffstat (limited to 'host')
-rwxr-xr-xhost/utils/latency/graph.py14
-rwxr-xr-xhost/utils/latency/run_tests.py10
2 files changed, 17 insertions, 7 deletions
diff --git a/host/utils/latency/graph.py b/host/utils/latency/graph.py
index 6aa2ba4e5..229134ef5 100755
--- a/host/utils/latency/graph.py
+++ b/host/utils/latency/graph.py
@@ -23,7 +23,10 @@ import matplotlib.pyplot as plt
import matplotlib.font_manager
import numpy as np
-from gnuradio.eng_option import eng_option
+try:
+ from gnuradio.eng_option import eng_option
+except:
+ eng_option = None
_units = [
(3, "k"),
@@ -31,7 +34,6 @@ _units = [
(9, "G")
]
-
def _format_rate(rate):
for (u1, s1), (u2, s2) in zip(_units, _units[1:]):
n = pow(10, u1)
@@ -79,7 +81,9 @@ def _order(series, sort_list):
def get_option_parser():
usage = "%prog: [options]"
- parser = OptionParser(option_class=eng_option, usage=usage)
+ opt_kwds = {}
+ if eng_option: opt_kwds['option_class'] = eng_option
+ parser = OptionParser(usage=usage, **opt_kwds)
parser.add_option("", "--id", type="string", help="device ID [default: %default]", default=None)
parser.add_option("", "--sort", type="string", help="sort order [default: %default]", default="rate -spb -spp")
@@ -189,6 +193,7 @@ def main():
def read_series_data(series):
+ if series is None: return []
result = []
for s in series:
data = {}
@@ -301,6 +306,7 @@ def get_plt_props(options):
plt_props['output'] = plt_out
+ if not options.id: options.id = "no data"
plt_title = "Latency (" + options.id + ")"
if options.title is not None and len(options.title) > 0:
plt_title += " - " + options.title
@@ -366,7 +372,7 @@ def mpl_plot(data, props):
def get_legend_str(meta):
lt = ""
- if meta['diff']:
+ if meta.has_key('diff') and meta['diff']:
lt += meta['diff'] + " "
lt += "%ssps, SPB %d, SPP %d" % (_format_rate(meta['rate']), meta['spb'], meta['spp'])
return lt
diff --git a/host/utils/latency/run_tests.py b/host/utils/latency/run_tests.py
index f0cb31ffb..da3b702b6 100755
--- a/host/utils/latency/run_tests.py
+++ b/host/utils/latency/run_tests.py
@@ -22,8 +22,10 @@ from string import split
import sys
import os
-from gnuradio.eng_option import eng_option
-
+try:
+ from gnuradio.eng_option import eng_option
+except:
+ eng_option = None
def launch_test(args="", rate=None, spb=None, spp=0, prefix="", suffix="", extra=[], verbose=False, title=None):
real = os.path.realpath(__file__)
@@ -78,7 +80,9 @@ class ReturnCode:
def get_initialized_OptionParser():
def_rates = ".25 1 4 8 25"
usage = "%prog: [options] -- [extra arguments]"
- parser = OptionParser(option_class=eng_option, usage=usage)
+ opt_kwds = {}
+ if eng_option: opt_kwds['option_class'] = eng_option
+ parser = OptionParser(usage=usage, **opt_kwds)
parser.add_option("", "--rates", type="string", help="sample rates (Msps) [default: %default]", default=def_rates)
parser.add_option("", "--spbs", type="string", help="samples per block [default: %default]",