Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Unified Diff: net/quic/quic_connection_logger.cc

Issue 180833004: Gather histogram for received packets indicating losses. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« net/quic/quic_connection_logger.h ('K') | « net/quic/quic_connection_logger.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_connection_logger.cc
diff --git a/net/quic/quic_connection_logger.cc b/net/quic/quic_connection_logger.cc
index d52debe1faef89f99e2e39c4edfae149fc47a183..8c150e83e2ff5b58a81e20ea3fd4ef882e36766f 100644
--- a/net/quic/quic_connection_logger.cc
+++ b/net/quic/quic_connection_logger.cc
@@ -4,6 +4,9 @@
#include "net/quic/quic_connection_logger.h"
+#include <algorithm>
+#include <string>
+
#include "base/bind.h"
#include "base/callback.h"
#include "base/metrics/histogram.h"
@@ -22,6 +25,8 @@ using std::string;
namespace net {
namespace {
+// The number of packets for which status is recorded.
+const size_t MAX_PACKET_STATUS = 100;
Ryan Hamilton 2014/03/05 03:48:00 nit: kMaxPacketStatus, I think, right?
jar (doing other things) 2014/03/06 03:34:17 Chromium style guide seems to ask for this format:
Ryan Hamilton 2014/03/06 04:47:43 Do you mean this line: Though the Google C++ Styl
jar (doing other things) 2014/03/07 17:11:48 Done.
base::Value* NetLogQuicPacketCallback(const IPEndPoint* self_address,
const IPEndPoint* peer_address,
@@ -55,12 +60,12 @@ base::Value* NetLogQuicPacketRetransmittedCallback(
QuicPacketSequenceNumber old_sequence_number,
QuicPacketSequenceNumber new_sequence_number,
NetLog::LogLevel /* log_level */) {
- base::DictionaryValue* dict = new base::DictionaryValue();
- dict->SetString("old_packet_sequence_number",
- base::Uint64ToString(old_sequence_number));
- dict->SetString("new_packet_sequence_number",
- base::Uint64ToString(new_sequence_number));
- return dict;
+ base::DictionaryValue* dict = new base::DictionaryValue();
+ dict->SetString("old_packet_sequence_number",
+ base::Uint64ToString(old_sequence_number));
+ dict->SetString("new_packet_sequence_number",
+ base::Uint64ToString(new_sequence_number));
+ return dict;
}
base::Value* NetLogQuicPacketHeaderCallback(const QuicPacketHeader* header,
@@ -124,7 +129,7 @@ base::Value* NetLogQuicCongestionFeedbackFrameCallback(
for (TimeMap::const_iterator it =
frame->inter_arrival.received_packet_times.begin();
it != frame->inter_arrival.received_packet_times.end(); ++it) {
- std::string value = base::Uint64ToString(it->first) + "@" +
+ string value = base::Uint64ToString(it->first) + "@" +
base::Uint64ToString(it->second.ToDebuggingValue());
received->AppendString(value);
}
@@ -221,7 +226,8 @@ QuicConnectionLogger::QuicConnectionLogger(const BoundNetLog& net_log)
largest_received_missing_packet_sequence_number_(0),
out_of_order_recieved_packet_count_(0),
num_truncated_acks_sent_(0),
- num_truncated_acks_received_(0) {
+ num_truncated_acks_received_(0),
+ packets_received_(MAX_PACKET_STATUS) {
}
QuicConnectionLogger::~QuicConnectionLogger() {
@@ -231,6 +237,19 @@ QuicConnectionLogger::~QuicConnectionLogger() {
num_truncated_acks_sent_);
UMA_HISTOGRAM_COUNTS("Net.QuicSession.TruncatedAcksReceived",
num_truncated_acks_received_);
+
+ const size_t last_index = std::min<size_t>(MAX_PACKET_STATUS - 1,
Ryan Hamilton 2014/03/05 03:48:00 nit: We typically just say min(foo, bar); Is the
jar (doing other things) 2014/03/06 03:34:17 I think the code may have been wrong, since it was
+ largest_received_packet_sequence_number_);
+ // We never get packet 0, so it is just a sentinel.
+ for (size_t i = 1; i <= last_index; ++i) {
+ if (packets_received_[i]) {
+ UMA_HISTOGRAM_ENUMERATION("Net.QuicSessionPacketReceivedAck", i - 1,
Ryan Hamilton 2014/03/05 03:48:00 Interesting! I didn't realize ENUMERATION was app
jar (doing other things) 2014/03/06 03:34:17 Yes... it works nicely when what you really want i
+ MAX_PACKET_STATUS);
+ } else {
+ UMA_HISTOGRAM_ENUMERATION("Net.QuicSessionPacketReceivedNack", i - 1,
+ MAX_PACKET_STATUS);
+ }
+ }
}
void QuicConnectionLogger::OnFrameAddedToPacket(const QuicFrame& frame) {
@@ -325,6 +344,13 @@ void QuicConnectionLogger::OnPacketHeader(const QuicPacketHeader& header) {
UMA_HISTOGRAM_COUNTS("Net.QuicSession.PacketGapReceived", delta - 1);
}
largest_received_packet_sequence_number_ = header.packet_sequence_number;
+ if (largest_received_packet_sequence_number_ < MAX_PACKET_STATUS) {
+ // We never get a packet of zero, but it is safer to handle this in
+ // production and avoiding reporting data from the 0th entry in the
+ // array.
+ DCHECK_GT(largest_received_packet_sequence_number_, 0);
+ packets_received_[largest_received_packet_sequence_number_] = true;
Ryan Hamilton 2014/03/05 03:48:00 nit: i think the style guide says that DCHECK is o
Ryan Hamilton 2014/03/05 03:48:00 It looks like this code only records packets that
jar (doing other things) 2014/03/06 03:34:17 I moved around the DCHECK, and it now just checks
jar (doing other things) 2014/03/06 03:34:17 No. That was not intended... I messed this up in m
+ }
}
if (header.packet_sequence_number < last_received_packet_sequence_number_) {
++out_of_order_recieved_packet_count_;
« net/quic/quic_connection_logger.h ('K') | « net/quic/quic_connection_logger.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698