You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafficserver.apache.org by James Peach <jp...@apache.org> on 2014/05/22 18:46:44 UTC

Re: git commit: TS-2381 The actual "add SPDY stream counter" patch.

Pretty sure TS-2831 is the bug you're looking for ...

On May 22, 2014, at 9:26 AM, amc@apache.org wrote:

> Repository: trafficserver
> Updated Branches:
>  refs/heads/master f230e610c -> 77dd7d282
> 
> 
> TS-2381 The actual "add SPDY stream counter" patch.
> 
> 
> Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
> Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/77dd7d28
> Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/77dd7d28
> Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/77dd7d28
> 
> Branch: refs/heads/master
> Commit: 77dd7d2828c40eed2baf554b8e75ecc58208f687
> Parents: f230e61
> Author: Alan M. Carroll <am...@network-geographics.com>
> Authored: Wed May 21 17:11:24 2014 -0700
> Committer: Alan M. Carroll <am...@network-geographics.com>
> Committed: Thu May 22 09:26:25 2014 -0700
> 
> ----------------------------------------------------------------------
> proxy/spdy/SpdyCommon.cc        |  8 ++++++++
> proxy/spdy/SpdyCommon.h         | 15 +++++++++++++++
> proxy/spdy/SpdySessionAccept.cc |  1 +
> 3 files changed, 24 insertions(+)
> ----------------------------------------------------------------------
> 
> 
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/77dd7d28/proxy/spdy/SpdyCommon.cc
> ----------------------------------------------------------------------
> diff --git a/proxy/spdy/SpdyCommon.cc b/proxy/spdy/SpdyCommon.cc
> index 775923d..47358c2 100644
> --- a/proxy/spdy/SpdyCommon.cc
> +++ b/proxy/spdy/SpdyCommon.cc
> @@ -26,6 +26,10 @@
> 
> Config SPDY_CFG;
> 
> +// statistic names
> +// Total # of streams created.
> +static char const * const SPDY_STAT_TOTAL_STREAMS_NAME = "proxy.process.spdy.total_streams";
> +
> string
> http_date(time_t t)
> {
> @@ -46,6 +50,10 @@ spdy_config_load()
> 
>   spdy_callbacks_init(&SPDY_CFG.spdy.callbacks);
> 
> +  // Get our statistics up
> +  SPDY_CFG.rsb = RecAllocateRawStatBlock(static_cast<int>(Config::N_STATS));
> +  RecRegisterRawStat(SPDY_CFG.rsb, RECT_PROCESS, SPDY_STAT_TOTAL_STREAMS_NAME, RECD_INT, RECP_NON_PERSISTENT, static_cast<int>(Config::STAT_TOTAL_STREAMS), RecRawStatSyncCount);
> +
>   return 0;
> }
> 
> 
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/77dd7d28/proxy/spdy/SpdyCommon.h
> ----------------------------------------------------------------------
> diff --git a/proxy/spdy/SpdyCommon.h b/proxy/spdy/SpdyCommon.h
> index cb32672..6a701c8 100644
> --- a/proxy/spdy/SpdyCommon.h
> +++ b/proxy/spdy/SpdyCommon.h
> @@ -66,6 +66,14 @@ struct Config {
>   SpdyConfig spdy;
>   int32_t accept_no_activity_timeout;
>   int32_t no_activity_timeout_in;
> +
> +  // Statistics
> +  /// This is the stat slot index for each statistic.
> +  enum StatIndex {
> +    STAT_TOTAL_STREAMS,
> +    N_STATS ///< Terminal counter, NOT A STAT INDEX.
> +  };
> +  RecRawStatBlock* rsb; ///< Container for statistics.
> };
> 
> // Spdy Name/Value pairs
> @@ -89,4 +97,11 @@ string http_date(time_t t);
> int spdy_config_load();
> 
> extern Config SPDY_CFG;
> +
> +// Stat helper functions
> +
> +inline void
> +SpdyStatIncrCount(Config::StatIndex idx, Continuation* contp) {
> +  RecIncrRawStatCount(SPDY_CFG.rsb, contp->mutex->thread_holding, idx, 1);
> +}
> #endif
> 
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/77dd7d28/proxy/spdy/SpdySessionAccept.cc
> ----------------------------------------------------------------------
> diff --git a/proxy/spdy/SpdySessionAccept.cc b/proxy/spdy/SpdySessionAccept.cc
> index 6da5608..452d7c7 100644
> --- a/proxy/spdy/SpdySessionAccept.cc
> +++ b/proxy/spdy/SpdySessionAccept.cc
> @@ -42,6 +42,7 @@ SpdySessionAccept::mainEvent(int event, void * edata)
> 
> #if TS_HAS_SPDY
>     spdy_sm_create(netvc, NULL, NULL);
> +    SpdyStatIncrCount(Config::STAT_TOTAL_STREAMS, this);
> #else
>     Error("accepted a SPDY session, but SPDY support is not available");
>     netvc->do_io_close();
>