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/x509_certificate.h" |
18 #include "net/quic/crypto/crypto_handshake_message.h" | 19 #include "net/quic/crypto/crypto_handshake_message.h" |
19 #include "net/quic/crypto/crypto_protocol.h" | 20 #include "net/quic/crypto/crypto_protocol.h" |
20 #include "net/quic/quic_address_mismatch.h" | 21 #include "net/quic/quic_address_mismatch.h" |
21 #include "net/quic/quic_socket_address_coder.h" | 22 #include "net/quic/quic_socket_address_coder.h" |
22 | 23 |
23 using base::StringPiece; | 24 using base::StringPiece; |
24 using std::string; | 25 using std::string; |
25 | 26 |
26 namespace net { | 27 namespace net { |
27 | 28 |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 base::Value* NetLogQuicOnConnectionClosedCallback( | 233 base::Value* NetLogQuicOnConnectionClosedCallback( |
233 QuicErrorCode error, | 234 QuicErrorCode error, |
234 bool from_peer, | 235 bool from_peer, |
235 NetLog::LogLevel /* log_level */) { | 236 NetLog::LogLevel /* log_level */) { |
236 base::DictionaryValue* dict = new base::DictionaryValue(); | 237 base::DictionaryValue* dict = new base::DictionaryValue(); |
237 dict->SetInteger("quic_error", error); | 238 dict->SetInteger("quic_error", error); |
238 dict->SetBoolean("from_peer", from_peer); | 239 dict->SetBoolean("from_peer", from_peer); |
239 return dict; | 240 return dict; |
240 } | 241 } |
241 | 242 |
| 243 base::Value* NetLogQuicCertificateVerifiedCallback( |
| 244 scoped_refptr<X509Certificate> cert, |
| 245 NetLog::LogLevel /* log_level */) { |
| 246 std::vector<std::string> dns_names; |
| 247 cert->GetDNSNames(&dns_names); |
| 248 base::DictionaryValue* dict = new base::DictionaryValue(); |
| 249 base::ListValue* cert_subjects = new base::ListValue(); |
| 250 for (std::vector<std::string>::const_iterator it = dns_names.begin(); |
| 251 it != dns_names.end(); it++) { |
| 252 cert_subjects->Append(new base::StringValue(*it)); |
| 253 } |
| 254 dict->Set("cert_subjects", cert_subjects); |
| 255 return dict; |
| 256 } |
| 257 |
242 void UpdatePacketGapSentHistogram(size_t num_consecutive_missing_packets) { | 258 void UpdatePacketGapSentHistogram(size_t num_consecutive_missing_packets) { |
243 UMA_HISTOGRAM_COUNTS("Net.QuicSession.PacketGapSent", | 259 UMA_HISTOGRAM_COUNTS("Net.QuicSession.PacketGapSent", |
244 num_consecutive_missing_packets); | 260 num_consecutive_missing_packets); |
245 } | 261 } |
246 | 262 |
247 void UpdatePublicResetAddressMismatchHistogram( | 263 void UpdatePublicResetAddressMismatchHistogram( |
248 const IPEndPoint& server_hello_address, | 264 const IPEndPoint& server_hello_address, |
249 const IPEndPoint& public_reset_address) { | 265 const IPEndPoint& public_reset_address) { |
250 int sample = GetAddressMismatch(server_hello_address, public_reset_address); | 266 int sample = GetAddressMismatch(server_hello_address, public_reset_address); |
251 // We are seemingly talking to an older server that does not support the | 267 // 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( | 681 void QuicConnectionLogger::UpdateReceivedFrameCounts( |
666 QuicStreamId stream_id, | 682 QuicStreamId stream_id, |
667 int num_frames_received, | 683 int num_frames_received, |
668 int num_duplicate_frames_received) { | 684 int num_duplicate_frames_received) { |
669 if (stream_id != kCryptoStreamId) { | 685 if (stream_id != kCryptoStreamId) { |
670 num_frames_received_ += num_frames_received; | 686 num_frames_received_ += num_frames_received; |
671 num_duplicate_frames_received_ += num_duplicate_frames_received; | 687 num_duplicate_frames_received_ += num_duplicate_frames_received; |
672 } | 688 } |
673 } | 689 } |
674 | 690 |
| 691 void QuicConnectionLogger::OnCertificateVerified( |
| 692 scoped_refptr<X509Certificate> cert) { |
| 693 net_log_.AddEvent( |
| 694 NetLog::TYPE_QUIC_SESSION_CERTIFICATE_VERIFIED, |
| 695 base::Bind(&NetLogQuicCertificateVerifiedCallback, cert)); |
| 696 } |
| 697 |
675 base::HistogramBase* QuicConnectionLogger::GetPacketSequenceNumberHistogram( | 698 base::HistogramBase* QuicConnectionLogger::GetPacketSequenceNumberHistogram( |
676 const char* statistic_name) const { | 699 const char* statistic_name) const { |
677 string prefix("Net.QuicSession.PacketReceived_"); | 700 string prefix("Net.QuicSession.PacketReceived_"); |
678 return base::LinearHistogram::FactoryGet( | 701 return base::LinearHistogram::FactoryGet( |
679 prefix + statistic_name + connection_description_, | 702 prefix + statistic_name + connection_description_, |
680 1, received_packets_.size(), received_packets_.size() + 1, | 703 1, received_packets_.size(), received_packets_.size() + 1, |
681 base::HistogramBase::kUmaTargetedHistogramFlag); | 704 base::HistogramBase::kUmaTargetedHistogramFlag); |
682 } | 705 } |
683 | 706 |
684 base::HistogramBase* QuicConnectionLogger::Get6PacketHistogram( | 707 base::HistogramBase* QuicConnectionLogger::Get6PacketHistogram( |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
824 continue; | 847 continue; |
825 } | 848 } |
826 // Record some overlapping patterns, to get a better picture, since this is | 849 // Record some overlapping patterns, to get a better picture, since this is |
827 // not very expensive. | 850 // not very expensive. |
828 if (i % 3 == 0) | 851 if (i % 3 == 0) |
829 six_packet_histogram->Add(recent_6_mask); | 852 six_packet_histogram->Add(recent_6_mask); |
830 } | 853 } |
831 } | 854 } |
832 | 855 |
833 } // namespace net | 856 } // namespace net |
OLD | NEW |