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/17 01:19:02 UTC

[trafficserver] branch quic-latest updated: Add QUICStats.h

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

masaori 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 2f954c6  Add QUICStats.h
2f954c6 is described below

commit 2f954c6eaa6c0ec07025830af8160ffd5269ded3
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Wed Jan 17 10:18:23 2018 +0900

    Add QUICStats.h
---
 iocore/net/QUICNetVConnection.cc |  2 +-
 iocore/net/quic/QUICGlobals.cc   |  4 ++--
 iocore/net/quic/QUICStats.h      | 43 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index 8ecd953..9882b43 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -767,7 +767,7 @@ QUICNetVConnection::_state_common_send_packet()
     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);
+  QUIC_INCREMENT_DYN_STAT_EX(QUICStats::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 ebc5e6e..7627a2e 100644
--- a/iocore/net/quic/QUICGlobals.cc
+++ b/iocore/net/quic/QUICGlobals.cc
@@ -53,11 +53,11 @@ QUIC::ssl_select_next_protocol(SSL *ssl, const unsigned char **out, unsigned cha
 void
 QUIC::_register_stats()
 {
-  quic_rsb = RecAllocateRawStatBlock(static_cast<int>(quic_stat_count));
+  quic_rsb = RecAllocateRawStatBlock(static_cast<int>(QUICStats::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);
+                     static_cast<int>(QUICStats::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,
diff --git a/iocore/net/quic/QUICStats.h b/iocore/net/quic/QUICStats.h
new file mode 100644
index 0000000..51dcff2
--- /dev/null
+++ b/iocore/net/quic/QUICStats.h
@@ -0,0 +1,43 @@
+/** @file
+ *
+ *  QUIC Stats
+ *
+ *  @section license License
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+#pragma once
+
+#include "records/I_RecProcess.h"
+
+extern RecRawStatBlock *quic_rsb;
+
+enum class QUICStats {
+  total_packets_sent_stat,
+  count,
+};
+
+#define QUIC_INCREMENT_DYN_STAT(x) RecIncrRawStat(quic_rsb, nullptr, (int)x, 1)
+#define QUIC_DECREMENT_DYN_STAT(x) RecIncrRawStat(quic_rsb, nullptr, (int)x, -1)
+#define QUIC_SET_COUNT_DYN_STAT(x, count) RecSetRawStatCount(quic_rsb, x, count)
+#define QUIC_INCREMENT_DYN_STAT_EX(x, y) RecIncrRawStat(quic_rsb, nullptr, (int)x, y)
+#define QUIC_CLEAR_DYN_STAT(x)            \
+  do {                                    \
+    RecSetRawStatSum(quic_rsb, (x), 0);   \
+    RecSetRawStatCount(quic_rsb, (x), 0); \
+  } while (0)

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