commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 18/50: controlport: improving transport lay


From: git
Subject: [Commit-gnuradio] [gnuradio] 18/50: controlport: improving transport layer throughput.
Date: Wed, 15 Apr 2015 21:07:53 +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 7a8989d21de2f9a121eafe56ce0b557572a498d4
Author: Nate Goergen <address@hidden>
Date:   Sun Mar 1 20:03:35 2015 -0600

    controlport: improving transport layer throughput.
    
    * made a new TbufferedTransportFactory class to create transports with 
buffer sizes different (i.e. greater) than the Thrift default of 512 bytes.
    * note: this should eventually be user configurable as a ControlPort 
setting in the GNU Radio config file
    ** hard-coding a value for now for an assumed Ethernet MTU of 1500 bytes.. 
Not ideal, but better than the Thrift default.
---
 .../include/gnuradio/thrift_server_template.h      | 34 +++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/gnuradio-runtime/include/gnuradio/thrift_server_template.h 
b/gnuradio-runtime/include/gnuradio/thrift_server_template.h
index 3147696..5de0112 100644
--- a/gnuradio-runtime/include/gnuradio/thrift_server_template.h
+++ b/gnuradio-runtime/include/gnuradio/thrift_server_template.h
@@ -37,6 +37,15 @@
 
 using namespace apache;
 
+namespace {
+  static const unsigned int ETHERNET_HEADER_SIZE(14);
+  static const unsigned int IP_HEADER_SIZE(20);
+  static const unsigned int TCP_HEADER_SIZE(32);
+  static const unsigned int ETHERNET_TYPICAL_MTU(1500);
+  static const unsigned int ALRIGHT_DEFAULT_BUFFER_SIZE(
+    ETHERNET_TYPICAL_MTU - ETHERNET_HEADER_SIZE - IP_HEADER_SIZE - 
TCP_HEADER_SIZE);
+}
+
 template<typename TserverBase, typename TserverClass, typename TImplClass, 
typename TThriftClass>
 class thrift_server_template : public thrift_application_base<TserverBase, 
TImplClass>
 {
@@ -52,6 +61,29 @@ protected:
 
   TserverBase* d_server;
   const std::string d_contolPortName, d_endpointName;
+
+private:
+
+  /**
+   * Custom TransportFactory that allows you to override the default Thrift 
buffer size
+   * of 512 bytes.
+   *
+   */
+  class TBufferedTransportFactory : public 
thrift::transport::TTransportFactory {
+    public:
+      TBufferedTransportFactory() : bufferSize(ALRIGHT_DEFAULT_BUFFER_SIZE) {;}
+      TBufferedTransportFactory(const unsigned int _bufferSize) : 
bufferSize(_bufferSize) {;}
+
+      virtual ~TBufferedTransportFactory() {}
+
+      virtual boost::shared_ptr<thrift::transport::TTransport> getTransport(
+        boost::shared_ptr<thrift::transport::TTransport> trans) {
+          return boost::shared_ptr<thrift::transport::TTransport>(
+            new thrift::transport::TBufferedTransport(trans, bufferSize));
+      }
+    private:
+      unsigned int bufferSize;
+  };
 };
 
 template<typename TserverBase, typename TserverClass, typename TImplClass, 
typename TThriftClass>
@@ -72,7 +104,7 @@ thrift_server_template<TserverBase, TserverClass, 
TImplClass, TThriftClass>::thr
     serverTransport(new thrift::transport::TServerSocket(9090));
 
   boost::shared_ptr<thrift::transport::TTransportFactory>
-    transportFactory(new thrift::transport::TBufferedTransportFactory());
+    transportFactory(new thrift_server_template::TBufferedTransportFactory());
 
   boost::shared_ptr<thrift::protocol::TProtocolFactory>
     protocolFactory(new thrift::protocol::TBinaryProtocolFactory());



reply via email to

[Prev in Thread] Current Thread [Next in Thread]