summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim O'Shea <tim.oshea753@gmail.com>2013-03-27 18:16:39 -0400
committerJohnathan Corgan <johnathan@corganlabs.com>2013-04-01 15:46:28 -0700
commit137bfe8eda761bc47d3d6a53c9008d5bbfde8034 (patch)
treef7743755e6fd377ad7e7cfefc2ca3fe74762d93b
parent9d2b92edd0bfd794f0682b25b1f0f1914c7dab5a (diff)
adding a grc block for launch performance monitorx
-rw-r--r--gnuradio-runtime/python/gnuradio/ctrlport/monitor.py19
-rw-r--r--gr-blocks/grc/CMakeLists.txt1
-rw-r--r--gr-blocks/grc/blocks_ctrlport_performance.xml50
3 files changed, 67 insertions, 3 deletions
diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/monitor.py b/gnuradio-runtime/python/gnuradio/ctrlport/monitor.py
index 53a571a698..e067b9b0a6 100644
--- a/gnuradio-runtime/python/gnuradio/ctrlport/monitor.py
+++ b/gnuradio-runtime/python/gnuradio/ctrlport/monitor.py
@@ -24,11 +24,22 @@ import sys, subprocess, re, signal, time, atexit, os
from gnuradio import gr
class monitor:
- def __init__(self):
+ def __init__(self,tool="gr-ctrlport-monitor"):
print "ControlPort Monitor running."
self.started = False
+ self.tool = tool
atexit.register(self.shutdown)
+ try:
+ # setup export prefs
+ gr.prefs().singleton().set_bool("ControlPort","on",True);
+ if(tool == "gr-ctrlport-monitor"):
+ gr.prefs().singleton().set_bool("ControlPort","edges_list",True);
+ gr.prefs().singleton().set_bool("PerfCounters","on",True);
+ gr.prefs().singleton().set_bool("PerfCounters","export",True);
+ except:
+ print "no support for gr.prefs setting"
+
def __del__(self):
if(self.started):
self.stop()
@@ -36,10 +47,12 @@ class monitor:
def start(self):
print "monitor::endpoints() = %s" % (gr.rpcmanager_get().endpoints())
try:
- self.proc = subprocess.Popen(map(lambda a: ["gr-ctrlport-monitor",
+ cmd = map(lambda a: [self.tool,
re.search("\d+\.\d+\.\d+\.\d+",a).group(0),
re.search("-p (\d+)",a).group(1)],
- gr.rpcmanager_get().endpoints())[0])
+ gr.rpcmanager_get().endpoints())[0]
+ print "running: %s"%(str(cmd))
+ self.proc = subprocess.Popen(cmd);
self.started = True
except:
self.proc = None
diff --git a/gr-blocks/grc/CMakeLists.txt b/gr-blocks/grc/CMakeLists.txt
index 48cdd5859a..9d38e3dcd8 100644
--- a/gr-blocks/grc/CMakeLists.txt
+++ b/gr-blocks/grc/CMakeLists.txt
@@ -24,6 +24,7 @@ file(GLOB xml_files "*.xml")
if(NOT ENABLE_GR_CTRLPORT)
list(REMOVE_ITEM xml_files
${CMAKE_CURRENT_SOURCE_DIR}/ctrlport_viewer.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/blocks_ctrlport_performance.xml
${CMAKE_CURRENT_SOURCE_DIR}/ctrlport_probe_c.xml
${CMAKE_CURRENT_SOURCE_DIR}/ctrlport_probe2_c.xml
)
diff --git a/gr-blocks/grc/blocks_ctrlport_performance.xml b/gr-blocks/grc/blocks_ctrlport_performance.xml
new file mode 100644
index 0000000000..cd7f527e3e
--- /dev/null
+++ b/gr-blocks/grc/blocks_ctrlport_performance.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+
+<!--
+ Copyright 2012 Free Software Foundation, Inc.
+
+ This file is part of GNU Radio
+
+ GNU Radio is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ GNU Radio is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Radio; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street,
+ Boston, MA 02110-1301, USA.
+-->
+
+<block>
+ <name>CtrlPort Performance Monitor</name>
+ <key>blocks_ctrlport_perfmonitor</key>
+ <category>Control Port</category>
+ <import>from gnuradio.ctrlport.monitor import *</import>
+ <make>not $en or monitor("gr-perf-monitorx")</make>
+ <param>
+ <name>Enabled</name>
+ <key>en</key>
+ <value></value>
+ <type>enum</type>
+ <option>
+ <name>True</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>False</name>
+ <key>False</key>
+ </option>
+ </param>
+
+ <doc>
+ Place this in a graph to launch a QtPy GR CtrlPort Performance Monitor app.
+ </doc>
+
+</block>
+