You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by so...@apache.org on 2013/12/04 06:33:32 UTC

git commit: TS-1815: Add thread number and port to accept thread name

Updated Branches:
  refs/heads/master 0f9305dc6 -> 0022a5467


TS-1815: Add thread number and port to accept thread name


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/0022a546
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/0022a546
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/0022a546

Branch: refs/heads/master
Commit: 0022a5467d2e7fe1ab4e0c42e346ee969cacb1e3
Parents: 0f9305d
Author: Phil Sorber <so...@apache.org>
Authored: Tue Dec 3 22:33:04 2013 -0700
Committer: Phil Sorber <so...@apache.org>
Committed: Tue Dec 3 22:33:04 2013 -0700

----------------------------------------------------------------------
 CHANGES                        | 2 ++
 iocore/net/P_NetAccept.h       | 2 +-
 iocore/net/UnixNetAccept.cc    | 4 ++--
 iocore/net/UnixNetProcessor.cc | 7 +++++--
 4 files changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0022a546/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index bac07c9..e8fdc32 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,8 @@
 Changes with Apache Traffic Server 4.2.0
 
 
+  *) [TS-1815] Add thread number and port to accept thread name
+
   *) [TS-2415] Use standard continuations to release UrlRewrite objects.
 
   *) [TS-2413] Release memory for idle SSL connections.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0022a546/iocore/net/P_NetAccept.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_NetAccept.h b/iocore/net/P_NetAccept.h
index dcb7892..3a82e4b 100644
--- a/iocore/net/P_NetAccept.h
+++ b/iocore/net/P_NetAccept.h
@@ -108,7 +108,7 @@ struct NetAccept:public Continuation
   virtual UnixNetVConnection *allocateGlobal();
   virtual EventType getEtype();
 
-  void init_accept_loop();
+  void init_accept_loop(const char *);
   virtual void init_accept(EThread * t = NULL);
   virtual void init_accept_per_thread();
   // 0 == success

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0022a546/iocore/net/UnixNetAccept.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixNetAccept.cc b/iocore/net/UnixNetAccept.cc
index 5f65535..fb422c6 100644
--- a/iocore/net/UnixNetAccept.cc
+++ b/iocore/net/UnixNetAccept.cc
@@ -172,13 +172,13 @@ EventType NetAccept::getEtype()
 // This should be done for low latency, high connection rate sockets.
 //
 void
-NetAccept::init_accept_loop()
+NetAccept::init_accept_loop(const char *thr_name)
 {
   size_t stacksize;
 
   REC_ReadConfigInteger(stacksize, "proxy.config.thread.default.stacksize");
   SET_CONTINUATION_HANDLER(this, &NetAccept::acceptLoopEvent);
-  eventProcessor.spawn_thread(this, "[ACCEPT]", stacksize);
+  eventProcessor.spawn_thread(this, thr_name, stacksize);
 }
 
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0022a546/iocore/net/UnixNetProcessor.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixNetProcessor.cc b/iocore/net/UnixNetProcessor.cc
index ef8534a..5ff4087 100644
--- a/iocore/net/UnixNetProcessor.cc
+++ b/iocore/net/UnixNetProcessor.cc
@@ -92,6 +92,7 @@ UnixNetProcessor::accept_internal(Continuation *cont, int fd, AcceptOptions cons
   ProxyMutex *mutex = thread->mutex;
   int accept_threads = opt.accept_threads; // might be changed.
   IpEndpoint accept_ip; // local binding address.
+  char thr_name[MAX_THREAD_NAME_LENGTH];
 
   // Potentially upgrade to SSL.
   upgradeEtype(et);
@@ -150,12 +151,14 @@ UnixNetProcessor::accept_internal(Continuation *cont, int fd, AcceptOptions cons
         for (int i=1; i < accept_threads; ++i) {
           a = createNetAccept();
           *a = *na;
-          a->init_accept_loop();
+          snprintf(thr_name, MAX_THREAD_NAME_LENGTH, "[ACCEPT %d:%d]", i-1, ats_ip_port_host_order(&accept_ip));
+          a->init_accept_loop(thr_name);
           Debug("iocore_net_accept", "Created accept thread #%d for port %d", i, ats_ip_port_host_order(&accept_ip));
         }
         // Start the "template" accept thread last.
         Debug("iocore_net_accept", "Created accept thread #%d for port %d", accept_threads, ats_ip_port_host_order(&accept_ip));
-        na->init_accept_loop();
+        snprintf(thr_name, MAX_THREAD_NAME_LENGTH, "[ACCEPT %d:%d]", accept_threads-1, ats_ip_port_host_order(&accept_ip));
+        na->init_accept_loop(thr_name);
       }
     } else {
       na->init_accept_per_thread();