You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ma...@apache.org on 2018/01/16 16:14:11 UTC

[trafficserver] branch quic-latest updated: Prepare for adding stats

This is an automated email from the ASF dual-hosted git repository.

maskit pushed a commit to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/quic-latest by this push:
     new 24b104f  Prepare for adding stats
24b104f is described below

commit 24b104f01261c6ac8dd5b7c5d1885fe066a4d315
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Wed Jan 17 01:11:36 2018 +0900

    Prepare for adding stats
    
    Currently proxy.process.quic.total_packets_sent is the only stat.
---
 iocore/net/QUICNetVConnection.cc |  3 +++
 iocore/net/quic/QUICGlobals.cc   | 17 +++++++++++++++++
 iocore/net/quic/QUICGlobals.h    |  4 ++++
 proxy/hq/HQ.cc                   |  4 ++--
 4 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index 21ccc29..8ecd953 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -36,6 +36,7 @@
 
 #include "P_SSLNextProtocolSet.h"
 
+#include "QUICStats.h"
 #include "QUICConfig.h"
 #include "QUICDebugNames.h"
 #include "QUICEvents.h"
@@ -761,10 +762,12 @@ QUICNetVConnection::_state_common_send_packet()
   QUICPacket *packet;
 
   SCOPED_MUTEX_LOCK(packet_transmitter_lock, this->_packet_transmitter_mutex, this_ethread());
+  uint32_t packet_count = this->_packet_send_queue.size;
   while ((packet = this->_packet_send_queue.dequeue()) != nullptr) {
     this->_packet_handler->send_packet(*packet, this);
     this->_loss_detector->on_packet_sent(QUICPacketUPtr(packet, &QUICPacketDeleter::delete_packet));
   }
+  QUIC_INCREMENT_DYN_STAT_EX(quic_total_packets_sent_stat, packet_count);
 
   net_activity(this, this_ethread());
 
diff --git a/iocore/net/quic/QUICGlobals.cc b/iocore/net/quic/QUICGlobals.cc
index ca45f67..ebc5e6e 100644
--- a/iocore/net/quic/QUICGlobals.cc
+++ b/iocore/net/quic/QUICGlobals.cc
@@ -23,9 +23,12 @@
 
 #include <cstring>
 #include "QUICGlobals.h"
+#include "QUICStats.h"
 #include "QUICConnection.h"
 #include "P_SSLNextProtocolSet.h"
 
+RecRawStatBlock *quic_rsb;
+
 int QUIC::ssl_quic_qc_index = -1;
 int QUIC::ssl_quic_hs_index = -1;
 
@@ -46,3 +49,17 @@ QUIC::ssl_select_next_protocol(SSL *ssl, const unsigned char **out, unsigned cha
   *outlen = 0;
   return SSL_TLSEXT_ERR_NOACK;
 }
+
+void
+QUIC::_register_stats()
+{
+  quic_rsb = RecAllocateRawStatBlock(static_cast<int>(quic_stat_count));
+
+  // Transfered packet counts
+  RecRegisterRawStat(quic_rsb, RECT_PROCESS, "proxy.process.quic.total_packets_sent", RECD_INT, RECP_PERSISTENT,
+                     static_cast<int>(quic_total_packets_sent_stat), RecRawStatSyncSum);
+  // RecRegisterRawStat(quic_rsb, RECT_PROCESS, "proxy.process.quic.total_packets_retransmitted", RECD_INT, RECP_PERSISTENT,
+  //                              static_cast<int>(quic_total_packets_retransmitted_stat), RecRawStatSyncSum);
+  // RecRegisterRawStat(quic_rsb, RECT_PROCESS, "proxy.process.quic.total_packets_received", RECD_INT, RECP_PERSISTENT,
+  //                            static_cast<int>(quic_total_packets_received_stat), RecRawStatSyncSum);
+}
diff --git a/iocore/net/quic/QUICGlobals.h b/iocore/net/quic/QUICGlobals.h
index 1af0f73..c4b5268 100644
--- a/iocore/net/quic/QUICGlobals.h
+++ b/iocore/net/quic/QUICGlobals.h
@@ -31,6 +31,7 @@ public:
   static void
   init()
   {
+    QUIC::_register_stats();
     ssl_quic_qc_index = SSL_get_ex_new_index(0, (void *)"QUICConnection index", nullptr, nullptr, nullptr);
     ssl_quic_hs_index = SSL_get_ex_new_index(0, (void *)"QUICHandshake index", nullptr, nullptr, nullptr);
   }
@@ -40,4 +41,7 @@ public:
   // SSL callbacks
   static int ssl_select_next_protocol(SSL *ssl, const unsigned char **out, unsigned char *outlen, const unsigned char *in,
                                       unsigned inlen, void *);
+
+private:
+  static void _register_stats();
 };
diff --git a/proxy/hq/HQ.cc b/proxy/hq/HQ.cc
index 1797a86..1282a1a 100644
--- a/proxy/hq/HQ.cc
+++ b/proxy/hq/HQ.cc
@@ -23,10 +23,10 @@
 
 #include "HQ.h"
 
-RecRawStatBlock *quic_rsb;
+RecRawStatBlock *hq_rsb;
 
 void
 HQ::init()
 {
-  quic_rsb = RecAllocateRawStatBlock(static_cast<int>(HQ_N_STATS));
+  hq_rsb = RecAllocateRawStatBlock(static_cast<int>(HQ_N_STATS));
 }

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].