You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2010/07/09 19:15:14 UTC
svn commit: r962613 - in /trafficserver/traffic/trunk: configure.ac
iocore/net/I_NetVConnection.h iocore/net/Makefile.am
iocore/net/UnixNetAccept.cc iocore/net/UnixNetVConnection.cc
libinktomi++/ink_config.h.in
Author: zwoop
Date: Fri Jul 9 17:15:14 2010
New Revision: 962613
URL: http://svn.apache.org/viewvc?rev=962613&view=rev
Log:
TS-392 Add configure option to enable detailed logging
Tested: FC13
This also cleans up the code a little, and adding the logging
initialization in a few more places (when this is enabled).
Modified:
trafficserver/traffic/trunk/configure.ac
trafficserver/traffic/trunk/iocore/net/I_NetVConnection.h
trafficserver/traffic/trunk/iocore/net/Makefile.am
trafficserver/traffic/trunk/iocore/net/UnixNetAccept.cc
trafficserver/traffic/trunk/iocore/net/UnixNetVConnection.cc
trafficserver/traffic/trunk/libinktomi++/ink_config.h.in
Modified: trafficserver/traffic/trunk/configure.ac
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/configure.ac?rev=962613&r1=962612&r2=962613&view=diff
==============================================================================
--- trafficserver/traffic/trunk/configure.ac (original)
+++ trafficserver/traffic/trunk/configure.ac Fri Jul 9 17:15:14 2010
@@ -228,7 +228,6 @@ AM_CONDITIONAL([STANDALONE_IOCORE], [tes
#
# Remote Coverity Prevent commit
#
-
AC_MSG_CHECKING([whether to commit cov defects to remote host])
AC_ARG_ENABLE([remote-cov-commit],
[AS_HELP_STRING([--enable-remote-cov-commit[=HOST]], [commit cov defects to remote host [HOST=localhost]])],
@@ -266,6 +265,20 @@ AC_MSG_RESULT([$enable_api])
AC_SUBST(has_inkapi)
#
+# Detailed Logging (for debugging purposes)
+#
+has_detailed_log=0
+AC_MSG_CHECKING([whether to enable detailed logging for debugging purposes])
+AC_ARG_ENABLE([detailed-log],
+ [AS_HELP_STRING([--enable-detailed-log],[enable detailed logging])],
+ [has_detailed_log=1],
+ [enable_detailed_log=no]
+)
+AC_MSG_RESULT([$enable_detailed_log])
+AC_SUBST(has_detailed_log)
+AM_CONDITIONAL([BUILD_DETAILED_LOG], [test "x$enable_detailed_log" = "xyes"])
+
+#
# Cli2
#
has_cli2=1
Modified: trafficserver/traffic/trunk/iocore/net/I_NetVConnection.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/net/I_NetVConnection.h?rev=962613&r1=962612&r2=962613&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/net/I_NetVConnection.h (original)
+++ trafficserver/traffic/trunk/iocore/net/I_NetVConnection.h Fri Jul 9 17:15:14 2010
@@ -32,9 +32,7 @@
#include "I_IOBuffer.h"
#include "I_Socks.h"
-// #define WITH_DETAILED_VCONNECTION_LOGGING 1
-
-#if WITH_DETAILED_VCONNECTION_LOGGING
+#if ATS_USE_DETAILED_LOG
#include "DetailedLog.h"
#endif
@@ -440,7 +438,7 @@ public:
is_internal_request = val;
}
-#if WITH_DETAILED_VCONNECTION_LOGGING
+#if ATS_USE_DETAILED_LOG
void loggingInit()
{
if (logging == NULL) {
@@ -483,13 +481,10 @@ public:
}
DetailedLog *logging;
#else
+ // These are here to simplify the usage of these APIs, i.e. no need to
+ // add the #ifdef ATS_USE_DETAILED_LOG a million times.
void addLogMessage(const char *message) {}
- void loggingInit() {}
bool loggingEnabled() const { return false; }
-
- ink_hrtime getLogsTotalTime() const { return 0; }
- void printLogs() const {}
- void clearLogs() {}
#endif
private:
@@ -511,7 +506,7 @@ NetVConnection::NetVConnection():
VConnection(NULL),
attributes(0),
thread(NULL),
-#if WITH_DETAILED_VCONNECTION_LOGGING
+#if ATS_USE_DETAILED_LOG
logging(NULL),
#endif
got_local_addr(0),
Modified: trafficserver/traffic/trunk/iocore/net/Makefile.am
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/net/Makefile.am?rev=962613&r1=962612&r2=962613&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/net/Makefile.am (original)
+++ trafficserver/traffic/trunk/iocore/net/Makefile.am Fri Jul 9 17:15:14 2010
@@ -38,8 +38,6 @@ noinst_LIBRARIES = libinknet.a
libinknet_a_SOURCES = \
Connection.cc \
- DetailedLog.cc \
- DetailedLog.h \
I_NetConfig.h \
I_NetErrno.h \
I_Net.h \
@@ -95,3 +93,9 @@ libinknet_a_SOURCES = \
UnixUDPNet.cc \
Inline.cc
+# TODO: These two should probably be moved to somewhere else (libintkomi++?)
+if BUILD_DETAILED_LOG
+ libinknet_a_SOURCES += \
+ DetailedLog.cc \
+ DetailedLog.h
+endif
Modified: trafficserver/traffic/trunk/iocore/net/UnixNetAccept.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/net/UnixNetAccept.cc?rev=962613&r1=962612&r2=962613&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/net/UnixNetAccept.cc (original)
+++ trafficserver/traffic/trunk/iocore/net/UnixNetAccept.cc Fri Jul 9 17:15:14 2010
@@ -100,6 +100,9 @@ net_accept(NetAccept * na, void *ep, boo
NET_INCREMENT_DYN_STAT(net_connections_currently_open_stat);
vc->id = net_next_connection_number();
na->alloc_cache = vc;
+#if ATS_USE_DETAILED_LOG
+ vc->loggingInit();
+#endif
}
if ((res = na->server.accept(&vc->con)) < 0) {
if (res == -EAGAIN || res == -ECONNABORTED || res == -EPIPE)
@@ -297,6 +300,9 @@ NetAccept::do_blocking_accept(NetAccept
vc = allocateThread(t);
vc->id = net_next_connection_number();
master_na->alloc_cache = vc;
+#if ATS_USE_DETAILED_LOG
+ vc->loggingInit();
+#endif
}
ink_hrtime now = ink_get_hrtime();
@@ -408,7 +414,9 @@ NetAccept::acceptFastEvent(int event, vo
socklen_t sz = sizeof(vc->con.sa);
int fd = socketManager.accept(server.fd, (struct sockaddr *) &vc->con.sa, &sz);
- vc->loggingInit(); // TODO add a configuration option for this
+#if ATS_USE_DETAILED_LOG
+ vc->loggingInit();
+#endif
if (likely(fd >= 0)) {
vc->addLogMessage("accepting the connection");
Modified: trafficserver/traffic/trunk/iocore/net/UnixNetVConnection.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/net/UnixNetVConnection.cc?rev=962613&r1=962612&r2=962613&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/net/UnixNetVConnection.cc (original)
+++ trafficserver/traffic/trunk/iocore/net/UnixNetVConnection.cc Fri Jul 9 17:15:14 2010
@@ -94,6 +94,7 @@ net_activity(UnixNetVConnection *vc, ETh
void
close_UnixNetVConnection(UnixNetVConnection *vc, EThread *t)
{
+#if ATS_USE_DETAILED_LOG
if (vc->loggingEnabled()) {
vc->addLogMessage("close_UnixNetVConnection");
// display the slow log for the http client session
@@ -101,6 +102,8 @@ close_UnixNetVConnection(UnixNetVConnect
vc->printLogs();
vc->clearLogs();
}
+#endif
+
vc->cancel_OOB();
vc->ep.stop();
vc->con.close();
Modified: trafficserver/traffic/trunk/libinktomi++/ink_config.h.in
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/libinktomi%2B%2B/ink_config.h.in?rev=962613&r1=962612&r2=962613&view=diff
==============================================================================
--- trafficserver/traffic/trunk/libinktomi++/ink_config.h.in (original)
+++ trafficserver/traffic/trunk/libinktomi++/ink_config.h.in Fri Jul 9 17:15:14 2010
@@ -110,6 +110,7 @@
#define ATS_USE_KQUEUE @use_kqueue@
#define ATS_USE_PORT @use_port@
#define ATS_USE_POSIX_CAP @use_posix_cap@
+#define ATS_USE_DETAILED_LOG @has_detailed_log@
/* OS API definitions */
#define GETHOSTBYNAME_R_HOSTENT_DATA @gethostbyname_r_hostent_data@