diff options
author | Tom Rondeau <trondeau@vt.edu> | 2013-03-14 18:10:27 -0400 |
---|---|---|
committer | Tom Rondeau <trondeau@vt.edu> | 2013-03-14 18:10:27 -0400 |
commit | 0b40b4f4569eb869581bd9dd50fcd536b810f3e2 (patch) | |
tree | 6aeaeb7fa41578a4e7fe5b86907c7fea79008392 /gnuradio-core/src/python | |
parent | 465daa19d2874f57e8fbe2b9c3fd004a3370e79a (diff) |
ctrlport: updated PC plotting tool to keep sorted state when sorting off.
Diffstat (limited to 'gnuradio-core/src/python')
-rwxr-xr-x | gnuradio-core/src/python/gnuradio/ctrlport/gr-perf-monitorx | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/gnuradio-core/src/python/gnuradio/ctrlport/gr-perf-monitorx b/gnuradio-core/src/python/gnuradio/ctrlport/gr-perf-monitorx index f70e7d7cff..a65b0406e4 100755 --- a/gnuradio-core/src/python/gnuradio/ctrlport/gr-perf-monitorx +++ b/gnuradio-core/src/python/gnuradio/ctrlport/gr-perf-monitorx @@ -276,6 +276,8 @@ class DataTable(QtGui.QWidget): self.G = G; self.radio = radio; + self._keymap = None + # Create a combobox to set the type of statistic we want. self._statistic = "Instantaneous" self._statistics_table = {"Instantaneous": "", @@ -374,13 +376,20 @@ class DataTableBuffers(DataTable): if(self._sort): sorted_fullness = sorted(blockport_fullness.iteritems(), key=operator.itemgetter(1)) + self._keymap = map(operator.itemgetter(0), sorted_fullness) else: - sorted_fullness = blockport_fullness.items() + 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() self.sp.clear(); plt.figure(self.f.number) plt.subplot(111); - self.sp.bar( range(0,len(sorted_fullness)), map(lambda x: x[1], sorted_fullness)) + 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)), @@ -413,16 +422,24 @@ class DataTableRuntimes(DataTable): 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() + 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() 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) ) + 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" ) + self.sp.set_xticklabels( map(lambda x: " " + x[0], sorted_work), + rotation="vertical", verticalalignment="bottom" ) self.canvas.draw(); self.canvas.show(); |