| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/quic/quic_connection_logger.h" | 5 #include "net/quic/quic_connection_logger.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 13 #include "base/metrics/sparse_histogram.h" | 13 #include "base/metrics/sparse_histogram.h" |
| 14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "net/base/net_log.h" | 16 #include "net/base/net_log.h" |
| 17 #include "net/base/net_util.h" | 17 #include "net/base/net_util.h" |
| 18 #include "net/cert/cert_verify_result.h" |
| 19 #include "net/cert/x509_certificate.h" |
| 18 #include "net/quic/crypto/crypto_handshake_message.h" | 20 #include "net/quic/crypto/crypto_handshake_message.h" |
| 19 #include "net/quic/crypto/crypto_protocol.h" | 21 #include "net/quic/crypto/crypto_protocol.h" |
| 20 #include "net/quic/quic_address_mismatch.h" | 22 #include "net/quic/quic_address_mismatch.h" |
| 21 #include "net/quic/quic_socket_address_coder.h" | 23 #include "net/quic/quic_socket_address_coder.h" |
| 22 | 24 |
| 23 using base::StringPiece; | 25 using base::StringPiece; |
| 24 using std::string; | 26 using std::string; |
| 25 | 27 |
| 26 namespace net { | 28 namespace net { |
| 27 | 29 |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 base::Value* NetLogQuicOnConnectionClosedCallback( | 234 base::Value* NetLogQuicOnConnectionClosedCallback( |
| 233 QuicErrorCode error, | 235 QuicErrorCode error, |
| 234 bool from_peer, | 236 bool from_peer, |
| 235 NetLog::LogLevel /* log_level */) { | 237 NetLog::LogLevel /* log_level */) { |
| 236 base::DictionaryValue* dict = new base::DictionaryValue(); | 238 base::DictionaryValue* dict = new base::DictionaryValue(); |
| 237 dict->SetInteger("quic_error", error); | 239 dict->SetInteger("quic_error", error); |
| 238 dict->SetBoolean("from_peer", from_peer); | 240 dict->SetBoolean("from_peer", from_peer); |
| 239 return dict; | 241 return dict; |
| 240 } | 242 } |
| 241 | 243 |
| 244 base::Value* NetLogQuicCertificateVerifiedCallback( |
| 245 scoped_refptr<X509Certificate> cert, |
| 246 NetLog::LogLevel /* log_level */) { |
| 247 // Only the subjects are logged so that we can investigate connection pooling. |
| 248 // More fields could be logged in the future. |
| 249 std::vector<std::string> dns_names; |
| 250 cert->GetDNSNames(&dns_names); |
| 251 base::DictionaryValue* dict = new base::DictionaryValue(); |
| 252 base::ListValue* subjects = new base::ListValue(); |
| 253 for (std::vector<std::string>::const_iterator it = dns_names.begin(); |
| 254 it != dns_names.end(); it++) { |
| 255 subjects->Append(new base::StringValue(*it)); |
| 256 } |
| 257 dict->Set("subjects", subjects); |
| 258 return dict; |
| 259 } |
| 260 |
| 242 void UpdatePacketGapSentHistogram(size_t num_consecutive_missing_packets) { | 261 void UpdatePacketGapSentHistogram(size_t num_consecutive_missing_packets) { |
| 243 UMA_HISTOGRAM_COUNTS("Net.QuicSession.PacketGapSent", | 262 UMA_HISTOGRAM_COUNTS("Net.QuicSession.PacketGapSent", |
| 244 num_consecutive_missing_packets); | 263 num_consecutive_missing_packets); |
| 245 } | 264 } |
| 246 | 265 |
| 247 void UpdatePublicResetAddressMismatchHistogram( | 266 void UpdatePublicResetAddressMismatchHistogram( |
| 248 const IPEndPoint& server_hello_address, | 267 const IPEndPoint& server_hello_address, |
| 249 const IPEndPoint& public_reset_address) { | 268 const IPEndPoint& public_reset_address) { |
| 250 int sample = GetAddressMismatch(server_hello_address, public_reset_address); | 269 int sample = GetAddressMismatch(server_hello_address, public_reset_address); |
| 251 // We are seemingly talking to an older server that does not support the | 270 // We are seemingly talking to an older server that does not support the |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 void QuicConnectionLogger::UpdateReceivedFrameCounts( | 684 void QuicConnectionLogger::UpdateReceivedFrameCounts( |
| 666 QuicStreamId stream_id, | 685 QuicStreamId stream_id, |
| 667 int num_frames_received, | 686 int num_frames_received, |
| 668 int num_duplicate_frames_received) { | 687 int num_duplicate_frames_received) { |
| 669 if (stream_id != kCryptoStreamId) { | 688 if (stream_id != kCryptoStreamId) { |
| 670 num_frames_received_ += num_frames_received; | 689 num_frames_received_ += num_frames_received; |
| 671 num_duplicate_frames_received_ += num_duplicate_frames_received; | 690 num_duplicate_frames_received_ += num_duplicate_frames_received; |
| 672 } | 691 } |
| 673 } | 692 } |
| 674 | 693 |
| 694 void QuicConnectionLogger::OnCertificateVerified( |
| 695 const CertVerifyResult& result) { |
| 696 net_log_.AddEvent( |
| 697 NetLog::TYPE_QUIC_SESSION_CERTIFICATE_VERIFIED, |
| 698 base::Bind(&NetLogQuicCertificateVerifiedCallback, result.verified_cert)); |
| 699 } |
| 700 |
| 675 base::HistogramBase* QuicConnectionLogger::GetPacketSequenceNumberHistogram( | 701 base::HistogramBase* QuicConnectionLogger::GetPacketSequenceNumberHistogram( |
| 676 const char* statistic_name) const { | 702 const char* statistic_name) const { |
| 677 string prefix("Net.QuicSession.PacketReceived_"); | 703 string prefix("Net.QuicSession.PacketReceived_"); |
| 678 return base::LinearHistogram::FactoryGet( | 704 return base::LinearHistogram::FactoryGet( |
| 679 prefix + statistic_name + connection_description_, | 705 prefix + statistic_name + connection_description_, |
| 680 1, received_packets_.size(), received_packets_.size() + 1, | 706 1, received_packets_.size(), received_packets_.size() + 1, |
| 681 base::HistogramBase::kUmaTargetedHistogramFlag); | 707 base::HistogramBase::kUmaTargetedHistogramFlag); |
| 682 } | 708 } |
| 683 | 709 |
| 684 base::HistogramBase* QuicConnectionLogger::Get6PacketHistogram( | 710 base::HistogramBase* QuicConnectionLogger::Get6PacketHistogram( |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 continue; | 850 continue; |
| 825 } | 851 } |
| 826 // Record some overlapping patterns, to get a better picture, since this is | 852 // Record some overlapping patterns, to get a better picture, since this is |
| 827 // not very expensive. | 853 // not very expensive. |
| 828 if (i % 3 == 0) | 854 if (i % 3 == 0) |
| 829 six_packet_histogram->Add(recent_6_mask); | 855 six_packet_histogram->Add(recent_6_mask); |
| 830 } | 856 } |
| 831 } | 857 } |
| 832 | 858 |
| 833 } // namespace net | 859 } // namespace net |
| OLD | NEW |