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/09/22 22:29:54 UTC
svn commit: r1000192 - in /trafficserver/traffic/trunk: ./ iocore/cache/
iocore/eventsystem/ libinktomi++/ proxy/ proxy/api/ts/ proxy/http2/
proxy/mgmt2/
Author: zwoop
Date: Wed Sep 22 20:29:53 2010
New Revision: 1000192
URL: http://svn.apache.org/viewvc?rev=1000192&view=rev
Log:
TS-390: Disable V2 stats by default (for now)
Tested: FC13
This has an unfortunate side effect that the stats for per
hook / plugin is also disabled. We should fix that, and also
rename those stats now that we can integrate them with the
librecords stats system. (E.g. proxy.process.cont. ...).
Moved V2 stats API to <ts/experimental.h>.
Modified:
trafficserver/traffic/trunk/configure.ac
trafficserver/traffic/trunk/iocore/cache/NewCacheVC.cc
trafficserver/traffic/trunk/iocore/eventsystem/I_EThread.h
trafficserver/traffic/trunk/iocore/eventsystem/UnixEThread.cc
trafficserver/traffic/trunk/libinktomi++/ink_config.h.in
trafficserver/traffic/trunk/proxy/InkAPI.cc
trafficserver/traffic/trunk/proxy/Main.cc
trafficserver/traffic/trunk/proxy/Makefile.am
trafficserver/traffic/trunk/proxy/StatAPITypes.cc
trafficserver/traffic/trunk/proxy/StatAPITypes.h
trafficserver/traffic/trunk/proxy/api/ts/InkAPIPrivateIOCore.h
trafficserver/traffic/trunk/proxy/api/ts/experimental.h
trafficserver/traffic/trunk/proxy/api/ts/ts.h
trafficserver/traffic/trunk/proxy/http2/HttpSM.cc
trafficserver/traffic/trunk/proxy/http2/HttpSM.h
trafficserver/traffic/trunk/proxy/mgmt2/RecordsConfig.cc
Modified: trafficserver/traffic/trunk/configure.ac
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/configure.ac?rev=1000192&r1=1000191&r2=1000192&view=diff
==============================================================================
--- trafficserver/traffic/trunk/configure.ac (original)
+++ trafficserver/traffic/trunk/configure.ac Wed Sep 22 20:29:53 2010
@@ -294,6 +294,20 @@ AS_IF([test "x$enable_cli2" = "xyes"],
)
AC_SUBST(has_cli2)
+#
+# Experimental V2 stats APIs (for plugins)
+#
+has_v2stats=0
+AC_MSG_CHECKING([whether to enable the experimental V2 stats subsystem for plugin APIs])
+AC_ARG_ENABLE([v2stats],
+ [AS_HELP_STRING([--enable-v2stats],[enable experimental V2 stats API])],
+ [has_v2stats=1],
+ [enable_v2stats=no]
+)
+AC_MSG_RESULT([$enable_v2stats])
+AC_SUBST(has_v2stats)
+AM_CONDITIONAL([BUILD_V2STATS], [test "x$enable_v2stats" = "xyes"])
+
# Google profiler
AC_MSG_CHECKING([whether to enable profiler])
AC_ARG_WITH([profiler],
Modified: trafficserver/traffic/trunk/iocore/cache/NewCacheVC.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/cache/NewCacheVC.cc?rev=1000192&r1=1000191&r2=1000192&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/cache/NewCacheVC.cc (original)
+++ trafficserver/traffic/trunk/iocore/cache/NewCacheVC.cc Wed Sep 22 20:29:53 2010
@@ -27,7 +27,6 @@
#include "HttpMessageBody.h"
#include "HttpTunnel.h"
#include <iostream>
-#include <string>
using namespace std;
Modified: trafficserver/traffic/trunk/iocore/eventsystem/I_EThread.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/eventsystem/I_EThread.h?rev=1000192&r1=1000191&r2=1000192&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/eventsystem/I_EThread.h (original)
+++ trafficserver/traffic/trunk/iocore/eventsystem/I_EThread.h Wed Sep 22 20:29:53 2010
@@ -30,7 +30,10 @@
#include "I_PriorityEventQueue.h"
#include "I_ProxyAllocator.h"
#include "I_ProtectedQueue.h"
-#include <vector>
+
+#if ATS_HAS_V2STATS
+#include <vector> // TODO: Do we really need to use STL vectors here?
+#endif
// TODO: This would be much nicer to have "run-time" configurable (or something),
// perhaps based on proxy.config.stat_api.max_stats_allowed or other configs. XXX
@@ -351,8 +354,10 @@ public:
Event *oneevent; // For dedicated event thread
ink_sem *eventsem; // For dedicated event thread
- std::vector<long long> thread_stats;
+#if ATS_HAS_V2STATS
+ std::vector<long long> thread_stats; // TODO: Do we need vectors?
ProxyMutex *thread_stats_mutex;
+#endif
};
/**
Modified: trafficserver/traffic/trunk/iocore/eventsystem/UnixEThread.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/eventsystem/UnixEThread.cc?rev=1000192&r1=1000191&r2=1000192&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/eventsystem/UnixEThread.cc (original)
+++ trafficserver/traffic/trunk/iocore/eventsystem/UnixEThread.cc Wed Sep 22 20:29:53 2010
@@ -50,7 +50,9 @@ EThread::EThread()
tt(REGULAR), eventsem(NULL)
{
memset(thread_private, 0, PER_THREAD_DATA);
+#if ATS_HAS_V2STATS
thread_stats_mutex = new_ProxyMutex();
+#endif
}
EThread::EThread(ThreadType att, int anid)
@@ -67,7 +69,9 @@ EThread::EThread(ThreadType att, int ani
ethreads_to_be_signalled = (EThread **) xmalloc(MAX_EVENT_THREADS * sizeof(EThread *));
memset((char *) ethreads_to_be_signalled, 0, MAX_EVENT_THREADS * sizeof(EThread *));
memset(thread_private, 0, PER_THREAD_DATA);
+#if ATS_HAS_V2STATS
thread_stats_mutex = new_ProxyMutex();
+#endif
#if ATS_HAS_EVENTFD
evfd = eventfd(0, O_NONBLOCK | FD_CLOEXEC);
if (evfd < 0) {
@@ -100,7 +104,9 @@ EThread::EThread(ThreadType att, Event *
{
ink_assert(att == DEDICATED);
memset(thread_private, 0, PER_THREAD_DATA);
+#if ATS_HAS_V2STATS
thread_stats_mutex = new_ProxyMutex();
+#endif
}
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=1000192&r1=1000191&r2=1000192&view=diff
==============================================================================
--- trafficserver/traffic/trunk/libinktomi++/ink_config.h.in (original)
+++ trafficserver/traffic/trunk/libinktomi++/ink_config.h.in Wed Sep 22 20:29:53 2010
@@ -126,6 +126,7 @@
#define ATS_HAS_INKAPI @has_inkapi@
#define ATS_HAS_CLI2 @has_cli2@
#define ATS_HAS_WEBUI @has_webui@
+#define ATS_HAS_V2STATS @has_v2stats@
#define ATS_HAS_PURIFY @has_purify@
#define ATS_HAS_DEMANGLE @has_demangle@
Modified: trafficserver/traffic/trunk/proxy/InkAPI.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/InkAPI.cc?rev=1000192&r1=1000191&r2=1000192&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/InkAPI.cc (original)
+++ trafficserver/traffic/trunk/proxy/InkAPI.cc Wed Sep 22 20:29:53 2010
@@ -31,7 +31,6 @@
#include "InkAPIInternal.h"
#include <stdio.h>
-#include <string>
#include "Log.h"
#include "URL.h"
#include "MIME.h"
@@ -59,7 +58,10 @@
#include "HttpAccept.h"
#include "PluginVC.h"
#include "FetchSM.h"
+#if ATS_HAS_V2STATS
+#include <string> // TODO: Do we really need STL strings?
#include "StatSystemV2.h"
+#endif
#include "HttpDebugNames.h"
#include "I_AIO.h"
@@ -1074,30 +1076,35 @@ INKContInternal::handle_event_count(int
}
}
+#if ATS_HAS_V2STATS
void INKContInternal::setName(const char *name) {
- cont_name = name;
+ cont_name = name;
- cont_time_stats.resize((int)(INK_HTTP_LAST_HOOK + 1));
- cont_calls.resize((int)(INK_HTTP_LAST_HOOK + 1));
+ cont_time_stats.resize((int)(INK_HTTP_LAST_HOOK + 1));
+ cont_calls.resize((int)(INK_HTTP_LAST_HOOK + 1));
- for(INKHttpHookID cur_hook_id = INK_HTTP_READ_REQUEST_HDR_HOOK; cur_hook_id <= INK_HTTP_LAST_HOOK; cur_hook_id = INKHttpHookID(cur_hook_id+1)) {
- std::string stat_base = "cont." + cont_name + "." + HttpDebugNames::get_api_hook_name(cur_hook_id);
- cont_time_stats[cur_hook_id].init(stat_base + ".time_spent", 64000);
+ for(INKHttpHookID cur_hook_id = INK_HTTP_READ_REQUEST_HDR_HOOK; cur_hook_id <= INK_HTTP_LAST_HOOK; cur_hook_id = INKHttpHookID(cur_hook_id+1)) {
+ // TODO: Fix the name of these stats to be something appropriate, e.g. proxy.x.y.z or some such (for now at least)
+ // TODO: Get rid of std::string (snprintf anyone?)
+ std::string stat_base = "cont." + cont_name + "." + HttpDebugNames::get_api_hook_name(cur_hook_id);
+ // TODO: This needs to be supported with non-V2 APIs as well.
+ cont_time_stats[cur_hook_id].init(stat_base + ".time_spent", 64000);
- StatSystemV2::registerStat((stat_base + ".calls").c_str(), &cont_calls[cur_hook_id]);
- }
- stats_enabled = true;
+ StatSystemV2::registerStat((stat_base + ".calls").c_str(), &cont_calls[cur_hook_id]);
+ }
+ stats_enabled = true;
}
const char *INKContInternal::getName() {
- return cont_name.c_str();
+ return cont_name.c_str();
}
void INKContInternal::statCallsMade(INKHttpHookID hook_id) {
- if(cont_name == "")
- return;
- StatSystemV2::increment(cont_calls[hook_id]);
+ if(cont_name == "")
+ return;
+ StatSystemV2::increment(cont_calls[hook_id]);
}
+#endif
int
INKContInternal::handle_event(int event, void *edata)
@@ -7347,6 +7354,7 @@ INKStatIncrement(INKStat the_stat)
return INK_SUCCESS;
}
+#if ATS_HAS_V2STATS
INKReturnCode
INKStatCreateV2(
const char *the_name,
@@ -7431,6 +7439,7 @@ INKStatGetByNameV2(
return INK_SUCCESS;
return INK_ERROR;
}
+#endif
INKReturnCode
INKStatIntGet(INKStat the_stat, INK64 * value)
Modified: trafficserver/traffic/trunk/proxy/Main.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/Main.cc?rev=1000192&r1=1000191&r2=1000192&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/Main.cc (original)
+++ trafficserver/traffic/trunk/proxy/Main.cc Wed Sep 22 20:29:53 2010
@@ -107,7 +107,9 @@ extern "C" int plock(int);
#include "XmlUtils.h"
+#if ATS_HAS_V2STATS
#include "StatSystemV2.h"
+#endif
#if ATS_HAS_PROFILER
#include <google/profiler.h>
@@ -1650,6 +1652,7 @@ change_uid_gid(const char *user)
#endif
}
+#if ATS_HAS_V2STATS
void init_stat_collector()
{
static int stat_collection_interval;
@@ -1686,7 +1689,7 @@ void init_stat_collector()
eventProcessor.schedule_every(NEW (new StatCollectorContinuation()),
HRTIME_SECONDS(stat_collection_interval), ET_CALL);
}
-
+#endif
//
// Main
@@ -1899,8 +1902,10 @@ main(int argc, char **argv)
ink_split_dns_init(makeModuleVersion(1, 0, PRIVATE_MODULE_HEADER));
eventProcessor.start(num_of_net_threads);
+#if ATS_HAS_V2STATS
// Must be called after starting event processor
init_stat_collector();
+#endif
int use_separate_thread = 0;
int num_remap_threads = 1;
Modified: trafficserver/traffic/trunk/proxy/Makefile.am
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/Makefile.am?rev=1000192&r1=1000191&r2=1000192&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/Makefile.am (original)
+++ trafficserver/traffic/trunk/proxy/Makefile.am Wed Sep 22 20:29:53 2010
@@ -138,7 +138,6 @@ traffic_server_SOURCES = \
StatPages.h \
StatSystem.cc \
StatSystem.h \
- StatSystemV2.cc \
StatAPITypes.cc \
TestHook.cc \
Transform.cc \
@@ -147,6 +146,11 @@ traffic_server_SOURCES = \
Update.cc \
Update.h
+if BUILD_V2STATS
+ traffic_server_SOURCES += StatSystemV2.cc
+endif
+
+
traffic_server_LDFLAGS = @EXTRA_CXX_LDFLAGS@
traffic_server_LDADD = \
http2/libhttp.a \
@@ -188,7 +192,6 @@ traffic_logcat_LDADD = \
ControlBase.o \
ControlMatcher.o CacheControl.o \
StatSystem.o \
- StatSystemV2.o \
StatAPITypes.o \
CacheInspectorAllow.o \
ReverseProxy.o \
@@ -238,6 +241,10 @@ traffic_logcat_LDADD = \
@LIBEXPAT@ @LIBDEMANGLE@ @LIBMLD@ @LIBEXC@ @LIBICONV@ @LIBM@ @LIBPROFILER@ \
@LIBEXECINFO@
+if BUILD_V2STATS
+ traffic_logcat_LDADD += StatSystemV2.o
+endif
+
traffic_logstats_SOURCES = logstats.cc
traffic_logstats_LDFLAGS = @EXTRA_CXX_LDFLAGS@
traffic_logstats_LDADD = \
@@ -251,7 +258,6 @@ traffic_logstats_LDADD = \
ControlMatcher.o \
CacheControl.o \
StatSystem.o \
- StatSystemV2.o \
StatAPITypes.o \
CacheInspectorAllow.o \
ReverseProxy.o \
@@ -302,6 +308,10 @@ traffic_logstats_LDADD = \
@LIBEXPAT@ @LIBDEMANGLE@ @LIBMLD@ @LIBEXC@ @LIBICONV@ @LIBM@ @LIBPROFILER@ \
@LIBEXECINFO@
+if BUILD_V2STATS
+ traffic_logstats_LDADD += StatSystemV2.o
+endif
+
traffic_sac_SOURCES = sac.cc
traffic_sac_LDFLAGS = @EXTRA_CXX_LDFLAGS@
traffic_sac_LDADD = \
@@ -315,7 +325,6 @@ traffic_sac_LDADD = \
ControlMatcher.o \
CacheControl.o \
StatSystem.o \
- StatSystemV2.o \
StatAPITypes.o \
CacheInspectorAllow.o \
ReverseProxy.o \
@@ -364,6 +373,10 @@ traffic_sac_LDADD = \
@LIBEXPAT@ @LIBDEMANGLE@ @LIBMLD@ @LIBEXC@ @LIBICONV@ @LIBM@ @LIBPROFILER@ \
@LIBEXECINFO@
+if BUILD_V2STATS
+ traffic_sac_LDADD += StatSystemV2.o
+endif
+
traffic_cust_log_fmt_cnvrt_SOURCES = cust_log_fmt_cnvrt.cc
traffic_cust_log_fmt_cnvrt_LDADD = \
$(top_builddir)/iocore/utils/libinkutils.a \
@@ -383,11 +396,15 @@ libTrafficServerStandalone_a_SOURCES = \
DiagsConfig.cc \
StatPages.cc \
StatSystem.cc \
- StatSystemV2.cc \
StatAPITypes.cc \
AbstractBuffer.cc \
Initialize.cc
+if BUILD_V2STATS
+ libTrafficServerStandalone_a_SOURCES += StatSystemV2.cc
+endif
+
+
test_StateEventLogger_SOURCES = StateEventLogger.cc
test_ClusterHashStandalone_SOURCES = test_ClusterHashStandalone.c
Modified: trafficserver/traffic/trunk/proxy/StatAPITypes.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/StatAPITypes.cc?rev=1000192&r1=1000191&r2=1000192&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/StatAPITypes.cc (original)
+++ trafficserver/traffic/trunk/proxy/StatAPITypes.cc Wed Sep 22 20:29:53 2010
@@ -26,7 +26,10 @@
***************************************************************************/
+// TODO: This needs to be supported with non-V2 APIs as well.
#include "ink_config.h"
+#if ATS_HAS_V2STATS
+
#include "api/ts/ts.h"
#include "StatAPITypes.h"
#include "StatSystemV2.h"
@@ -88,3 +91,5 @@ void HistogramStats::inc(long long stat_
StatSystemV2::increment(buckets[bucket]);
}
}
+
+#endif
Modified: trafficserver/traffic/trunk/proxy/StatAPITypes.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/StatAPITypes.h?rev=1000192&r1=1000191&r2=1000192&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/StatAPITypes.h (original)
+++ trafficserver/traffic/trunk/proxy/StatAPITypes.h Wed Sep 22 20:29:53 2010
@@ -26,24 +26,28 @@
***************************************************************************/
-#ifndef STAT_TYPES_V2_H
-#define STAT_TYPES_V2_H
+#ifndef STAT_API_TYPES_H
+#define STAT_API_TYPES_H
-#include <string>
-#include <vector>
+// TODO: This needs to be supported with non-V2 APIs as well.
+#if ATS_HAS_V2STATS
+#include <string> // TODO: Get rid of string here, why do we need it ?
+#include <vector> // TODO: Is the vector really necessary ?
#include "inktomi++.h"
class HistogramStats
{
public:
+ // TODO: Eliminate STL strings ?
HistogramStats() { }
HistogramStats(const std::string &stat_prefix, long long max_stat) { init(stat_prefix, max_stat); }
void init(const std::string &stat_prefix, long long max_stat);
void inc(long long stat_val);
long long get_bucket(long long theNumber);
private:
- std::vector<uint32_t> buckets;
+ std::vector<uint32_t> buckets; // TODO: Do we need a vector here?
};
+#endif
-#endif // STAT_TYPES
+#endif // STAT_API_TYPES_H
Modified: trafficserver/traffic/trunk/proxy/api/ts/InkAPIPrivateIOCore.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/api/ts/InkAPIPrivateIOCore.h?rev=1000192&r1=1000191&r2=1000192&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/api/ts/InkAPIPrivateIOCore.h (original)
+++ trafficserver/traffic/trunk/proxy/api/ts/InkAPIPrivateIOCore.h Wed Sep 22 20:29:53 2010
@@ -34,9 +34,11 @@
#include "P_Net.h"
#endif
-#include <string>
-#include <vector>
+#if ATS_HAS_V2STATS
+#include <string> // TODO: Do we need STL strings really?
+#include <vector> // TODO: Do we need STL vectors really?
#include "StatAPITypes.h"
+#endif
enum INKContInternalMagic_t
{
@@ -55,10 +57,15 @@ public:
void handle_event_count(int event);
int handle_event(int event, void *edata);
+
+#if ATS_HAS_V2STATS
+ // TODO: These have confusing names, what exactly does it mean? Something with "cont" stats I think?
+ // We should give these appropriate names, like contName and isContStatsEnabled() or some such.
void setName(const char *name);
const char *getName();
void statCallsMade(INKHttpHookID hook_id);
bool isStatsEnabled() { return stats_enabled; }
+#endif
public:
void *mdata;
@@ -70,11 +77,14 @@ public:
//INKqa07670: Nokia memory leak bug fix
INKContInternalMagic_t m_free_magic;
+#if ATS_HAS_V2STATS
+ // TODO: Fix names as describe above.
+ // TODO: Eliminate STL strings and containers?
std::string cont_name;
std::vector<HistogramStats> cont_time_stats;
std::vector<uint32_t> cont_calls;
bool stats_enabled;
-
+#endif
};
Modified: trafficserver/traffic/trunk/proxy/api/ts/experimental.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/api/ts/experimental.h?rev=1000192&r1=1000191&r2=1000192&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/api/ts/experimental.h (original)
+++ trafficserver/traffic/trunk/proxy/api/ts/experimental.h Wed Sep 22 20:29:53 2010
@@ -38,17 +38,31 @@ extern "C"
#endif /* __cplusplus */
-/* Cache APIs that are not yet fully supported and/or frozen nor complete. */
-inkapi INKReturnCode INKCacheBufferInfoGet(INKCacheTxn txnp, INKU64 * length, INKU64 * offset);
+ /* Cache APIs that are not yet fully supported and/or frozen nor complete. */
+ inkapi INKReturnCode INKCacheBufferInfoGet(INKCacheTxn txnp, INKU64 * length, INKU64 * offset);
-inkapi INKCacheHttpInfo INKCacheHttpInfoCreate();
-inkapi void INKCacheHttpInfoReqGet(INKCacheHttpInfo infop, INKMBuffer * bufp, INKMLoc * obj);
-inkapi void INKCacheHttpInfoRespGet(INKCacheHttpInfo infop, INKMBuffer * bufp, INKMLoc * obj);
-inkapi void INKCacheHttpInfoReqSet(INKCacheHttpInfo infop, INKMBuffer bufp, INKMLoc obj);
-inkapi void INKCacheHttpInfoRespSet(INKCacheHttpInfo infop, INKMBuffer bufp, INKMLoc obj);
-inkapi void INKCacheHttpInfoKeySet(INKCacheHttpInfo infop, INKCacheKey key);
-inkapi void INKCacheHttpInfoSizeSet(INKCacheHttpInfo infop, INKU64 size);
-inkapi int INKCacheHttpInfoVector(INKCacheHttpInfo infop, void *data, int length);
+ inkapi INKCacheHttpInfo INKCacheHttpInfoCreate();
+ inkapi void INKCacheHttpInfoReqGet(INKCacheHttpInfo infop, INKMBuffer * bufp, INKMLoc * obj);
+ inkapi void INKCacheHttpInfoRespGet(INKCacheHttpInfo infop, INKMBuffer * bufp, INKMLoc * obj);
+ inkapi void INKCacheHttpInfoReqSet(INKCacheHttpInfo infop, INKMBuffer bufp, INKMLoc obj);
+ inkapi void INKCacheHttpInfoRespSet(INKCacheHttpInfo infop, INKMBuffer bufp, INKMLoc obj);
+ inkapi void INKCacheHttpInfoKeySet(INKCacheHttpInfo infop, INKCacheKey key);
+ inkapi void INKCacheHttpInfoSizeSet(INKCacheHttpInfo infop, INKU64 size);
+ inkapi int INKCacheHttpInfoVector(INKCacheHttpInfo infop, void *data, int length);
+
+ /* --------------------------------------------------------------------------
+ This is an experimental stat system, which is not compatible with standard
+ TS stats. It is disabled by default, enable it with --with_v2_stats at
+ configure time. */
+ inkapi INKReturnCode INKStatCreateV2(const char *name, uint32_t *stat_num);
+ inkapi INKReturnCode INKStatIncrementV2(uint32_t stat_num, INK64 inc_by);
+ inkapi INKReturnCode INKStatIncrementByNameV2(const char *stat_name, INK64 inc_by);
+ inkapi INKReturnCode INKStatDecrementV2(uint32_t stat_num, INK64 dec_by);
+ inkapi INKReturnCode INKStatDecrementByNameV2(const char *stat_name, INK64 dec_by);
+ inkapi INKReturnCode INKStatGetCurrentV2(uint32_t stat_num, INK64 *stat_val);
+ inkapi INKReturnCode INKStatGetCurrentByNameV2(const char *stat_name, INK64 *stat_val);
+ inkapi INKReturnCode INKStatGetV2(uint32_t stat_num, INK64 *stat_val);
+ inkapi INKReturnCode INKStatGetByNameV2(const char *stat_name, INK64 *stat_val);
#ifdef __cplusplus
}
Modified: trafficserver/traffic/trunk/proxy/api/ts/ts.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/api/ts/ts.h?rev=1000192&r1=1000191&r2=1000192&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/api/ts/ts.h (original)
+++ trafficserver/traffic/trunk/proxy/api/ts/ts.h Wed Sep 22 20:29:53 2010
@@ -2408,21 +2408,6 @@ extern "C"
/* --------------------------------------------------------------------------
- This is an experimental stat system, which is not compatible with standard
- TS stats. It is disabled by default, enable it with --with_v2_stats at
- configure time. */
- inkapi INKReturnCode INKStatCreateV2(const char *name, uint32_t *stat_num);
- inkapi INKReturnCode INKStatIncrementV2(uint32_t stat_num, INK64 inc_by);
- inkapi INKReturnCode INKStatIncrementByNameV2(const char *stat_name, INK64 inc_by);
- inkapi INKReturnCode INKStatDecrementV2(uint32_t stat_num, INK64 dec_by);
- inkapi INKReturnCode INKStatDecrementByNameV2(const char *stat_name, INK64 dec_by);
- inkapi INKReturnCode INKStatGetCurrentV2(uint32_t stat_num, INK64 *stat_val);
- inkapi INKReturnCode INKStatGetCurrentByNameV2(const char *stat_name, INK64 *stat_val);
- inkapi INKReturnCode INKStatGetV2(uint32_t stat_num, INK64 *stat_val);
- inkapi INKReturnCode INKStatGetByNameV2(const char *stat_name, INK64 *stat_val);
-
-
- /* --------------------------------------------------------------------------
This is the old stats system, it's completely deprecated, and should not
be used. It has serious limitations both in scalability and performance. */
typedef enum
Modified: trafficserver/traffic/trunk/proxy/http2/HttpSM.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http2/HttpSM.cc?rev=1000192&r1=1000191&r2=1000192&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http2/HttpSM.cc (original)
+++ trafficserver/traffic/trunk/proxy/http2/HttpSM.cc Wed Sep 22 20:29:53 2010
@@ -37,7 +37,10 @@
#include "PluginVC.h"
#include "ReverseProxy.h"
#include "RemapProcessor.h"
+
+#if ATS_HAS_V2STATS
#include "StatSystemV2.h"
+#endif
#ifdef USE_NCA
#include "NcaProcessor.h"
@@ -344,7 +347,11 @@ server_response_hdr_bytes(0), server_res
client_response_hdr_bytes(0), client_response_body_bytes(0),
pushed_response_hdr_bytes(0), pushed_response_body_bytes(0),
hooks_set(0), cur_hook_id(INK_HTTP_LAST_HOOK), cur_hook(NULL),
-prev_hook_start_time(0), prev_hook_stats_enabled(false),
+// TODO: This needs to be supported with non-V2 APIs as well.
+#if ATS_HAS_V2STATS
+prev_hook_start_time(0),
+prev_hook_stats_enabled(false),
+#endif
cur_hooks(0), callout_state(HTTP_API_NO_CALLOUT), terminate_sm(false), kill_this_async_done(false)
{
static int scatter_init = 0;
@@ -1452,12 +1459,14 @@ HttpSM::state_api_callout(int event, voi
APIHook *hook = cur_hook;
cur_hook = cur_hook->next();
+#if ATS_HAS_V2STATS
// Do per plugin stats
// Increment calls made to plugin
hook->m_cont->statCallsMade(cur_hook_id);
// Stat time spent in previous plugin
int64 curr_time = INKhrtime();
+ // TODO: This needs to be supported with non-V2 APIs as well.
if(prev_hook_stats_enabled && prev_hook_start_time) {
int64 time_in_plugin_ms = (curr_time - prev_hook_start_time)/1000000;
prev_hook_stats.inc(time_in_plugin_ms);
@@ -1467,9 +1476,12 @@ HttpSM::state_api_callout(int event, voi
// store time and plugin info before invoking it
prev_hook_start_time = curr_time;
+
+ // TODO: This needs to be supported with non-V2 APIs as well.
prev_hook_stats_enabled = hook->m_cont->isStatsEnabled();
if(prev_hook_stats_enabled)
prev_hook_stats = hook->m_cont->cont_time_stats[cur_hook_id];
+#endif
hook->invoke(INK_EVENT_HTTP_READ_REQUEST_HDR + cur_hook_id, this);
@@ -1548,6 +1560,8 @@ HttpSM::state_api_callout(int event, voi
// Do per plugin stats
// Handle last plugin on current state
+ // TODO: This needs to be supported with non-V2 APIs as well.
+#if ATS_HAS_V2STATS
if(prev_hook_stats_enabled && prev_hook_start_time) {
int64 time_in_plugin_ms = (INKhrtime() - prev_hook_start_time)/1000000;
Debug("http", "[%lld] Last plugin : Time spent : %s %lld",
@@ -1556,8 +1570,10 @@ HttpSM::state_api_callout(int event, voi
}
// Get ready for next state
+ // TODO: This needs to be supported with non-V2 APIs as well.
prev_hook_stats_enabled = false;
prev_hook_start_time = 0;
+#endif
handle_api_return();
break;
@@ -3877,6 +3893,7 @@ HttpSM::do_hostdb_lookup()
bool use_srv_records = HttpConfig::m_master.srv_enabled;
if (use_srv_records) {
+ // TODO: Get rid of string?
string s = "_http._tcp.";
s += t_state.server_info.name;
Modified: trafficserver/traffic/trunk/proxy/http2/HttpSM.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http2/HttpSM.h?rev=1000192&r1=1000191&r2=1000192&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http2/HttpSM.h (original)
+++ trafficserver/traffic/trunk/proxy/http2/HttpSM.h Wed Sep 22 20:29:53 2010
@@ -40,7 +40,9 @@
#include "HttpTunnel.h"
#include "InkAPIInternal.h"
#include "StatSystem.h"
+#if ATS_HAS_V2STATS
#include "StatAPITypes.h"
+#endif
#include "HttpClientSession.h"
//#include "AuthHttpAdapter.h"
@@ -501,8 +503,11 @@ protected:
// Continuation time keeper
int64 prev_hook_start_time;
+ // TODO: This needs to be supported with non-V2 APIs as well.
+#if ATS_HAS_V2STATS
bool prev_hook_stats_enabled;
HistogramStats prev_hook_stats;
+#endif
int cur_hooks;
HttpApiState_t callout_state;
Modified: trafficserver/traffic/trunk/proxy/mgmt2/RecordsConfig.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/mgmt2/RecordsConfig.cc?rev=1000192&r1=1000191&r2=1000192&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/mgmt2/RecordsConfig.cc (original)
+++ trafficserver/traffic/trunk/proxy/mgmt2/RecordsConfig.cc Wed Sep 22 20:29:53 2010
@@ -2990,6 +2990,7 @@ RecordElement RecordsConfig[] = {
{CONFIG, "proxy.config.stat_api.max_stats_allowed", "", INK_INT, "512", RU_RESTART_TS, RR_NULL, RC_NULL, "[256-10000]", RA_NULL}
,
+#if ATS_HAS_V2STATS
// StatSystemV2 config
{CONFIG, "proxy.config.stat_collector.interval", "", INK_INT, "600", RU_NULL, RR_NULL, RC_NULL, NULL, RA_NULL}
,
@@ -2999,6 +3000,7 @@ RecordElement RecordsConfig[] = {
,
{CONFIG, "proxy.config.stat_systemV2.num_stats_estimate", "", INK_INT, "0", RU_NULL, RR_NULL, RC_NULL, NULL, RA_NULL}
,
+#endif
//############
//#