[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 02/16: controlport: fixed up performance mo
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 02/16: controlport: fixed up performance monitor. |
Date: |
Sun, 26 Apr 2015 23:18:02 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit 3b41bb4dec9b6ce89e4909d20fbc7ffd764a80f3
Author: Tom Rondeau <address@hidden>
Date: Tue Apr 14 19:51:12 2015 -0400
controlport: fixed up performance monitor.
Fixed a problem with display runtime or buffer graphs by not clearing
and redrawing the entire graph, just updating the height of the bars.
Only update table or graph when they are the visible elements.
Shuts down timer when the graphs are closed.
---
.../python/gnuradio/ctrlport/gr-perf-monitorx | 135 ++++++++++++---------
1 file changed, 77 insertions(+), 58 deletions(-)
diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/gr-perf-monitorx
b/gnuradio-runtime/python/gnuradio/ctrlport/gr-perf-monitorx
index 23e11d4..c871ae9 100644
--- a/gnuradio-runtime/python/gnuradio/ctrlport/gr-perf-monitorx
+++ b/gnuradio-runtime/python/gnuradio/ctrlport/gr-perf-monitorx
@@ -254,18 +254,23 @@ class DataTable(QtGui.QWidget):
def update(self):
print "update"
+ def closeEvent(self, event):
+ self.timer = None
+
def __init__(self, radioclient, G):
QtGui.QWidget.__init__( self)
- self.layout = QtGui.QVBoxLayout(self);
- self.hlayout = QtGui.QHBoxLayout();
- self.layout.addLayout(self.hlayout);
+ self.layout = QtGui.QVBoxLayout(self)
+ self.hlayout = QtGui.QHBoxLayout()
+ self.layout.addLayout(self.hlayout)
- self.G = G;
- self.radioclient = radioclient;
+ self.G = G
+ self.radioclient = radioclient
self._keymap = None
+ self.disp = None
+
# Create a combobox to set the type of statistic we want.
self._statistic = "Instantaneous"
self._statistics_table = {"Instantaneous": "",
@@ -276,7 +281,7 @@ class DataTable(QtGui.QWidget):
self.stattype.addItem("Average")
self.stattype.addItem("Variance")
self.stattype.setMaximumWidth(200)
- self.hlayout.addWidget(self.stattype);
+ self.hlayout.addWidget(self.stattype)
self.stattype.currentIndexChanged.connect(self.stat_changed)
# Create a checkbox to toggle sorting of graphs
@@ -287,18 +292,18 @@ class DataTable(QtGui.QWidget):
self.checksort.stateChanged.connect(self.checksort_changed)
# set up table
- self.perfTable = Qt.QTableWidget();
+ self.perfTable = Qt.QTableWidget()
self.perfTable.setColumnCount(2)
- self.perfTable.verticalHeader().hide();
- self.perfTable.setHorizontalHeaderLabels( ["Block Name", "Percent
Runtime"] );
- self.perfTable.horizontalHeader().setStretchLastSection(True);
+ self.perfTable.verticalHeader().hide()
+ self.perfTable.setHorizontalHeaderLabels( ["Block Name", "Percent
Runtime"] )
+ self.perfTable.horizontalHeader().setStretchLastSection(True)
self.perfTable.setSortingEnabled(True)
nodes = self.G.nodes(data=True)
# set up plot
self.f = plt.figure(figsize=(10,8), dpi=90)
- self.sp = self.f.add_subplot(111);
- self.sp.autoscale_view(True,True,True);
+ self.sp = self.f.add_subplot(111)
+ self.sp.autoscale_view(True,True,True)
self.sp.set_autoscale_on(True)
self.canvas = FigureCanvas(self.f)
@@ -339,63 +344,71 @@ class DataTable(QtGui.QWidget):
class DataTableBuffers(DataTable):
def __init__(self, radioclient, G):
super(DataTableBuffers, self).__init__(radioclient, G)
- self.perfTable.setHorizontalHeaderLabels( ["Block Name", "Percent
Buffer Full"] );
+ self.perfTable.setHorizontalHeaderLabels( ["Block Name", "Percent
Buffer Full"] )
def update(self):
nodes = self.G.nodes();
# get buffer fullness for all blocks
kl = map(lambda x: "%s::%soutput %% full" % \
- (x, self._statistics_table[self._statistic]),
+ (x, self._statistics_table[self._statistic]),
nodes);
buf_knobs = self.radioclient.getKnobs(kl)
# strip values out of ctrlport response
buffer_fullness = dict(zip(
- map(lambda x: x.split("::")[0], buf_knobs.keys()),
- map(lambda x: x.value, buf_knobs.values())))
+ map(lambda x: x.split("::")[0], buf_knobs.keys()),
+ map(lambda x: x.value, buf_knobs.values())))
blockport_fullness = {}
for blk in buffer_fullness:
bdata = buffer_fullness[blk]
if bdata:
for port in range(0,len(bdata)):
- blockport_fullness["%s:%d"%(blk,port)] = bdata[port];
+ blockport_fullness["%s:%d"%(blk,port)] = bdata[port]
- self.table_update(blockport_fullness);
+ if(self.perfTable.isVisible()):
+ self.table_update(blockport_fullness);
- if(self._sort):
- sorted_fullness = sorted(blockport_fullness.iteritems(),
key=operator.itemgetter(1))
- self._keymap = map(operator.itemgetter(0), sorted_fullness)
else:
- if self._keymap:
- sorted_fullness = len(self._keymap)*['',]
- for b in blockport_fullness:
- sorted_fullness[self._keymap.index(b)] = (b,
blockport_fullness[b])
+ if(self._sort):
+ sorted_fullness = sorted(blockport_fullness.iteritems(),
+ key=operator.itemgetter(1))
+ self._keymap = map(operator.itemgetter(0), sorted_fullness)
+ else:
+ if self._keymap:
+ sorted_fullness = len(self._keymap)*['',]
+ for b in blockport_fullness:
+ sorted_fullness[self._keymap.index(b)] = (b,
blockport_fullness[b])
+ else:
+ sorted_fullness = blockport_fullness.items()
+
+ if(not self.disp):
+ self.disp = self.sp.bar(range(0,len(sorted_fullness)),
+ map(lambda x: x[1], sorted_fullness),
+ alpha=0.5)
+ self.sp.set_ylabel("% Buffers Full");
+ self.sp.set_xticks( map(lambda x: x+0.5,
range(0,len(sorted_fullness))))
+ self.sp.set_xticklabels(map(lambda x: " " + x, map(lambda x:
x[0], sorted_fullness)),
+ rotation="vertical",
verticalalignment="bottom")
else:
- sorted_fullness = blockport_fullness.items()
+ self.sp.set_xticklabels(map(lambda x: " " + x, map(lambda x:
x[0], sorted_fullness)),
+ rotation="vertical",
verticalalignment="bottom")
+ for r,w in zip(self.disp, sorted_fullness):
+ r.set_height(w[1])
- self.sp.clear();
- self.sp.bar(range(0,len(sorted_fullness)), map(lambda x: x[1],
sorted_fullness),
- alpha=0.5)
- self.sp.set_ylabel("% Buffers Full");
- self.sp.set_xticks( map(lambda x: x+0.5,
range(0,len(sorted_fullness))))
- self.sp.set_xticklabels( map(lambda x: " " + x, map(lambda x: x[0],
sorted_fullness)),
- rotation="vertical",
verticalalignment="bottom" )
- self.canvas.draw()
- self.canvas.show()
+ self.canvas.draw()
class DataTableRuntimes(DataTable):
def __init__(self, radioclient, G):
super(DataTableRuntimes, self).__init__( radioclient, G)
- #self.perfTable.setRowCount(len( self.G.nodes() ))
def update(self):
nodes = self.G.nodes();
# get work time for all blocks
kl = map(lambda x: "%s::%swork time" % \
- (x, self._statistics_table[self._statistic]),
+ (x, self._statistics_table[self._statistic]),
nodes);
wrk_knobs = self.radioclient.getKnobs(kl)
@@ -408,31 +421,37 @@ class DataTableRuntimes(DataTable):
map(lambda x: x.value/total_work, wrk_knobs.values())))
# update table view
- self.table_update(work_times)
+ if(self.perfTable.isVisible()):
+ self.table_update(work_times)
- if(self._sort):
- sorted_work = sorted(work_times.iteritems(),
key=operator.itemgetter(1))
- self._keymap = map(operator.itemgetter(0), sorted_work)
else:
- if self._keymap:
- sorted_work = len(self._keymap)*['',]
- for b in work_times:
- sorted_work[self._keymap.index(b)] = (b, work_times[b])
+ if(self._sort):
+ sorted_work = sorted(work_times.iteritems(),
key=operator.itemgetter(1))
+ self._keymap = map(operator.itemgetter(0), sorted_work)
else:
- sorted_work = work_times.items()
-
- self.sp.clear();
- plt.figure(self.f.number)
- plt.subplot(111);
- self.sp.bar(range(0,len(sorted_work)), map(lambda x: x[1],
sorted_work),
- alpha=0.5)
- self.sp.set_ylabel("% Runtime");
- self.sp.set_xticks( map(lambda x: x+0.5, range(0,len(sorted_work))))
- self.sp.set_xticklabels( map(lambda x: " " + x[0], sorted_work),
- rotation="vertical",
verticalalignment="bottom" )
+ if self._keymap:
+ sorted_work = len(self._keymap)*['',]
+ for b in work_times:
+ sorted_work[self._keymap.index(b)] = (b, work_times[b])
+ else:
+ sorted_work = work_times.items()
+
+ f = plt.figure(self.f.number)
+ if(not self.disp):
+ self.disp = self.sp.bar(range(0,len(sorted_work)),
+ map(lambda x: x[1], sorted_work),
+ alpha=0.5)
+ self.sp.set_ylabel("% Runtime");
+ self.sp.set_xticks( map(lambda x: x+0.5,
range(0,len(sorted_work))))
+ self.sp.set_xticklabels( map(lambda x: " " + x[0],
sorted_work),
+ rotation="vertical",
verticalalignment="bottom" )
+ else:
+ self.sp.set_xticklabels( map(lambda x: " " + x[0],
sorted_work),
+ rotation="vertical",
verticalalignment="bottom" )
+ for r,w in zip(self.disp, sorted_work):
+ r.set_height(w[1])
- self.canvas.draw();
- self.canvas.show();
+ self.canvas.draw()
class MForm(QtGui.QWidget):
def update(self):
- [Commit-gnuradio] [gnuradio] branch master updated (c0a88be -> 327f070), git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 16/16: Merge remote-tracking branch 'gnuradio-wg-grc/master_grcwg', git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 14/16: Merge remote-tracking branch 'tom/qtgui/range_type', git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 15/16: Merge remote-tracking branch 'nowls/burst_shaping', git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 04/16: grc: Add check for GTK initialization, git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 13/16: Merge remote-tracking branch 'mmueller/pwr_squelch_add_tags', git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 12/16: Merge remote-tracking branch 'tom/ctrlport/fixes1', git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 06/16: controlport: use proper default return value from prefs get_bool., git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 08/16: digital: fix skipped sample handling in burst_shaper, git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 05/16: qtgui: improved type checking for range block and simplifies python., git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 02/16: controlport: fixed up performance monitor.,
git <=
- [Commit-gnuradio] [gnuradio] 03/16: qtgui: adds Type setting for Range widget., git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 01/16: controlport: fixed controlport probes., git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 07/16: analog: Power Squelch now emit tags on start/end of bursts, git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 09/16: digital: added tag propagation to burst_shaper blocks, git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 10/16: blocks: better implementation of peak_detector2. Address #783., git, 2015/04/26
- [Commit-gnuradio] [gnuradio] 11/16: blocks: more fixups to peak_detector2., git, 2015/04/26