diff options
author | Tom Rondeau <tom@trondeau.com> | 2015-03-02 19:29:37 -0500 |
---|---|---|
committer | Tom Rondeau <tom@trondeau.com> | 2015-04-02 15:38:57 -0700 |
commit | 636c1557936ca004dce4c905eb7f337ad5677c60 (patch) | |
tree | 1ae2f79fb8012d7ceb00fe5a1c7e0a5b37c9a581 | |
parent | f32872a97c290778f7f3eec037df9fe0d03be792 (diff) |
controlport: adding performance and controlport monitor GRC blocks.
Updated thrift server conf to set an endpoint
-- need to get host address instead of hardcoding to 127.0.0.1.
-rw-r--r-- | gnuradio-runtime/include/gnuradio/thrift_server_template.h | 14 | ||||
-rw-r--r-- | gnuradio-runtime/python/gnuradio/ctrlport/monitor.py | 6 | ||||
-rw-r--r-- | gr-blocks/grc/blocks_block_tree.xml | 2 | ||||
-rw-r--r-- | gr-blocks/grc/blocks_ctrlport_performance.xml | 48 | ||||
-rw-r--r-- | gr-blocks/grc/blocks_ctrlport_viewer.xml | 48 |
5 files changed, 111 insertions, 7 deletions
diff --git a/gnuradio-runtime/include/gnuradio/thrift_server_template.h b/gnuradio-runtime/include/gnuradio/thrift_server_template.h index 06768266e4..5b97b0a0ce 100644 --- a/gnuradio-runtime/include/gnuradio/thrift_server_template.h +++ b/gnuradio-runtime/include/gnuradio/thrift_server_template.h @@ -100,8 +100,6 @@ thrift_server_template<TserverBase, TserverClass, TImplClass, TThriftClass>::thr gr::logger_ptr logger, debug_logger; gr::configure_default_loggers(logger, debug_logger, "controlport"); - //GR_LOG_DEBUG(debug_logger, "thrift_server_template: ctor"); - unsigned int port, nthreads, buffersize; std::string thrift_config_file = gr::prefs::singleton()->get_string("ControlPort", "config", ""); @@ -156,9 +154,9 @@ thrift_server_template<TserverBase, TserverClass, TImplClass, TThriftClass>::thr threadManager); } - // Define the endpoint int used_port = ((thrift::transport::TServerSocket*)serverTransport.get())->getPort(); - GR_LOG_INFO(logger, boost::format("Apache Thrift Endpoint on port %1%") % used_port); + std::string endpoint = boost::str(boost::format("%1% -p %2%") % "127.0.0.1" % used_port); + GR_LOG_INFO(logger, "Apache Thrift: " + endpoint); d_server = handler.get(); } @@ -172,6 +170,14 @@ template<typename TserverBase, typename TserverClass, typename TImplClass, typen TserverBase* thrift_server_template<TserverBase, TserverClass, TImplClass, TThriftClass>::i_impl() { //std::cerr << "thrift_server_template: i_impl" << std::endl; + + // Define the endpoint + thrift::transport::TServerTransport *thetransport = + thrift_application_base<TserverBase, TImplClass>::d_thriftserver->getServerTransport().get(); + int used_port = ((thrift::transport::TServerSocket*)thetransport)->getPort(); + std::string endpoint = boost::str(boost::format("%1% -p %2%") % "127.0.0.1" % used_port); + thrift_application_base<TserverBase, TImplClass>::d_this->set_endpoint(endpoint); + return d_server; } diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/monitor.py b/gnuradio-runtime/python/gnuradio/ctrlport/monitor.py index 8bb26d93a1..712137fe8a 100644 --- a/gnuradio-runtime/python/gnuradio/ctrlport/monitor.py +++ b/gnuradio-runtime/python/gnuradio/ctrlport/monitor.py @@ -48,9 +48,9 @@ class monitor: print "monitor::endpoints() = %s" % (gr.rpcmanager_get().endpoints()) try: 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] + re.search("\d+\.\d+\.\d+\.\d+",a).group(0), + re.search("-p (\d+)",a).group(1)], + gr.rpcmanager_get().endpoints())[0] print "running: %s"%(str(cmd)) self.proc = subprocess.Popen(cmd); self.started = True diff --git a/gr-blocks/grc/blocks_block_tree.xml b/gr-blocks/grc/blocks_block_tree.xml index 383ec876e4..0aab2eae9f 100644 --- a/gr-blocks/grc/blocks_block_tree.xml +++ b/gr-blocks/grc/blocks_block_tree.xml @@ -51,6 +51,8 @@ </cat> <cat> <name>Control Port</name> + <block>blocks_ctrlport_monitor</block> + <block>blocks_ctrlport_monitor_performance</block> <block>blocks_ctrlport_probe2_x</block> <block>blocks_ctrlport_probe2_c</block> <block>blocks_ctrlport_probe_c</block> diff --git a/gr-blocks/grc/blocks_ctrlport_performance.xml b/gr-blocks/grc/blocks_ctrlport_performance.xml new file mode 100644 index 0000000000..ab17c9e263 --- /dev/null +++ b/gr-blocks/grc/blocks_ctrlport_performance.xml @@ -0,0 +1,48 @@ +<?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_monitor_performance</key> + <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> diff --git a/gr-blocks/grc/blocks_ctrlport_viewer.xml b/gr-blocks/grc/blocks_ctrlport_viewer.xml new file mode 100644 index 0000000000..1d5a2e5931 --- /dev/null +++ b/gr-blocks/grc/blocks_ctrlport_viewer.xml @@ -0,0 +1,48 @@ +<?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 Monitor</name> + <key>blocks_ctrlport_monitor</key> + <import>from gnuradio.ctrlport.monitor import *</import> + <make>not $en or monitor()</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 Monitor app. + </doc> + +</block> |