| 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/chromium/quic_connection_logger.h" | 5 #include "net/quic/chromium/quic_connection_logger.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "base/callback.h" | 14 #include "base/callback.h" |
| 15 #include "base/metrics/histogram_base.h" | 15 #include "base/metrics/histogram_base.h" |
| 16 #include "base/metrics/histogram_macros.h" | 16 #include "base/metrics/histogram_macros.h" |
| 17 #include "base/metrics/sparse_histogram.h" | 17 #include "base/metrics/sparse_histogram.h" |
| 18 #include "base/profiler/scoped_tracker.h" | 18 #include "base/profiler/scoped_tracker.h" |
| 19 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
| 20 #include "base/values.h" | 20 #include "base/values.h" |
| 21 #include "net/base/ip_address.h" | 21 #include "net/base/ip_address.h" |
| 22 #include "net/cert/x509_certificate.h" | 22 #include "net/cert/x509_certificate.h" |
| 23 #include "net/log/net_log_event_type.h" |
| 23 #include "net/quic/core/crypto/crypto_handshake_message.h" | 24 #include "net/quic/core/crypto/crypto_handshake_message.h" |
| 24 #include "net/quic/core/crypto/crypto_protocol.h" | 25 #include "net/quic/core/crypto/crypto_protocol.h" |
| 25 #include "net/quic/core/quic_address_mismatch.h" | 26 #include "net/quic/core/quic_address_mismatch.h" |
| 26 #include "net/quic/core/quic_protocol.h" | 27 #include "net/quic/core/quic_protocol.h" |
| 27 #include "net/quic/core/quic_socket_address_coder.h" | 28 #include "net/quic/core/quic_socket_address_coder.h" |
| 28 #include "net/quic/core/quic_time.h" | 29 #include "net/quic/core/quic_time.h" |
| 29 | 30 |
| 30 using base::StringPiece; | 31 using base::StringPiece; |
| 31 using std::string; | 32 using std::string; |
| 32 | 33 |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 | 347 |
| 347 RecordAggregatePacketLossRate(); | 348 RecordAggregatePacketLossRate(); |
| 348 } | 349 } |
| 349 | 350 |
| 350 void QuicConnectionLogger::OnFrameAddedToPacket(const QuicFrame& frame) { | 351 void QuicConnectionLogger::OnFrameAddedToPacket(const QuicFrame& frame) { |
| 351 switch (frame.type) { | 352 switch (frame.type) { |
| 352 case PADDING_FRAME: | 353 case PADDING_FRAME: |
| 353 break; | 354 break; |
| 354 case STREAM_FRAME: | 355 case STREAM_FRAME: |
| 355 net_log_.AddEvent( | 356 net_log_.AddEvent( |
| 356 NetLog::TYPE_QUIC_SESSION_STREAM_FRAME_SENT, | 357 NetLogEventType::QUIC_SESSION_STREAM_FRAME_SENT, |
| 357 base::Bind(&NetLogQuicStreamFrameCallback, frame.stream_frame)); | 358 base::Bind(&NetLogQuicStreamFrameCallback, frame.stream_frame)); |
| 358 break; | 359 break; |
| 359 case ACK_FRAME: { | 360 case ACK_FRAME: { |
| 360 net_log_.AddEvent( | 361 net_log_.AddEvent( |
| 361 NetLog::TYPE_QUIC_SESSION_ACK_FRAME_SENT, | 362 NetLogEventType::QUIC_SESSION_ACK_FRAME_SENT, |
| 362 base::Bind(&NetLogQuicAckFrameCallback, frame.ack_frame)); | 363 base::Bind(&NetLogQuicAckFrameCallback, frame.ack_frame)); |
| 363 break; | 364 break; |
| 364 } | 365 } |
| 365 case RST_STREAM_FRAME: | 366 case RST_STREAM_FRAME: |
| 366 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.RstStreamErrorCodeClient", | 367 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.RstStreamErrorCodeClient", |
| 367 frame.rst_stream_frame->error_code); | 368 frame.rst_stream_frame->error_code); |
| 368 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_RST_STREAM_FRAME_SENT, | 369 net_log_.AddEvent(NetLogEventType::QUIC_SESSION_RST_STREAM_FRAME_SENT, |
| 369 base::Bind(&NetLogQuicRstStreamFrameCallback, | 370 base::Bind(&NetLogQuicRstStreamFrameCallback, |
| 370 frame.rst_stream_frame)); | 371 frame.rst_stream_frame)); |
| 371 break; | 372 break; |
| 372 case CONNECTION_CLOSE_FRAME: | 373 case CONNECTION_CLOSE_FRAME: |
| 373 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_CONNECTION_CLOSE_FRAME_SENT, | 374 net_log_.AddEvent( |
| 374 base::Bind(&NetLogQuicConnectionCloseFrameCallback, | 375 NetLogEventType::QUIC_SESSION_CONNECTION_CLOSE_FRAME_SENT, |
| 375 frame.connection_close_frame)); | 376 base::Bind(&NetLogQuicConnectionCloseFrameCallback, |
| 377 frame.connection_close_frame)); |
| 376 break; | 378 break; |
| 377 case GOAWAY_FRAME: | 379 case GOAWAY_FRAME: |
| 378 net_log_.AddEvent( | 380 net_log_.AddEvent( |
| 379 NetLog::TYPE_QUIC_SESSION_GOAWAY_FRAME_SENT, | 381 NetLogEventType::QUIC_SESSION_GOAWAY_FRAME_SENT, |
| 380 base::Bind(&NetLogQuicGoAwayFrameCallback, frame.goaway_frame)); | 382 base::Bind(&NetLogQuicGoAwayFrameCallback, frame.goaway_frame)); |
| 381 break; | 383 break; |
| 382 case WINDOW_UPDATE_FRAME: | 384 case WINDOW_UPDATE_FRAME: |
| 383 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_WINDOW_UPDATE_FRAME_SENT, | 385 net_log_.AddEvent(NetLogEventType::QUIC_SESSION_WINDOW_UPDATE_FRAME_SENT, |
| 384 base::Bind(&NetLogQuicWindowUpdateFrameCallback, | 386 base::Bind(&NetLogQuicWindowUpdateFrameCallback, |
| 385 frame.window_update_frame)); | 387 frame.window_update_frame)); |
| 386 break; | 388 break; |
| 387 case BLOCKED_FRAME: | 389 case BLOCKED_FRAME: |
| 388 ++num_blocked_frames_sent_; | 390 ++num_blocked_frames_sent_; |
| 389 net_log_.AddEvent( | 391 net_log_.AddEvent( |
| 390 NetLog::TYPE_QUIC_SESSION_BLOCKED_FRAME_SENT, | 392 NetLogEventType::QUIC_SESSION_BLOCKED_FRAME_SENT, |
| 391 base::Bind(&NetLogQuicBlockedFrameCallback, frame.blocked_frame)); | 393 base::Bind(&NetLogQuicBlockedFrameCallback, frame.blocked_frame)); |
| 392 break; | 394 break; |
| 393 case STOP_WAITING_FRAME: | 395 case STOP_WAITING_FRAME: |
| 394 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_STOP_WAITING_FRAME_SENT, | 396 net_log_.AddEvent(NetLogEventType::QUIC_SESSION_STOP_WAITING_FRAME_SENT, |
| 395 base::Bind(&NetLogQuicStopWaitingFrameCallback, | 397 base::Bind(&NetLogQuicStopWaitingFrameCallback, |
| 396 frame.stop_waiting_frame)); | 398 frame.stop_waiting_frame)); |
| 397 break; | 399 break; |
| 398 case PING_FRAME: | 400 case PING_FRAME: |
| 399 UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.ConnectionFlowControlBlocked", | 401 UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.ConnectionFlowControlBlocked", |
| 400 session_->IsConnectionFlowControlBlocked()); | 402 session_->IsConnectionFlowControlBlocked()); |
| 401 UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.StreamFlowControlBlocked", | 403 UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.StreamFlowControlBlocked", |
| 402 session_->IsStreamFlowControlBlocked()); | 404 session_->IsStreamFlowControlBlocked()); |
| 403 // PingFrame has no contents to log, so just record that it was sent. | 405 // PingFrame has no contents to log, so just record that it was sent. |
| 404 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_PING_FRAME_SENT); | 406 net_log_.AddEvent(NetLogEventType::QUIC_SESSION_PING_FRAME_SENT); |
| 405 break; | 407 break; |
| 406 case MTU_DISCOVERY_FRAME: | 408 case MTU_DISCOVERY_FRAME: |
| 407 // MtuDiscoveryFrame is PingFrame on wire, it does not have any payload. | 409 // MtuDiscoveryFrame is PingFrame on wire, it does not have any payload. |
| 408 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_MTU_DISCOVERY_FRAME_SENT); | 410 net_log_.AddEvent(NetLogEventType::QUIC_SESSION_MTU_DISCOVERY_FRAME_SENT); |
| 409 break; | 411 break; |
| 410 default: | 412 default: |
| 411 DCHECK(false) << "Illegal frame type: " << frame.type; | 413 DCHECK(false) << "Illegal frame type: " << frame.type; |
| 412 } | 414 } |
| 413 } | 415 } |
| 414 | 416 |
| 415 void QuicConnectionLogger::OnPacketSent( | 417 void QuicConnectionLogger::OnPacketSent( |
| 416 const SerializedPacket& serialized_packet, | 418 const SerializedPacket& serialized_packet, |
| 417 QuicPathId /* original_path_id */, | 419 QuicPathId /* original_path_id */, |
| 418 QuicPacketNumber original_packet_number, | 420 QuicPacketNumber original_packet_number, |
| 419 TransmissionType transmission_type, | 421 TransmissionType transmission_type, |
| 420 QuicTime sent_time) { | 422 QuicTime sent_time) { |
| 421 if (original_packet_number == 0) { | 423 if (original_packet_number == 0) { |
| 422 net_log_.AddEvent( | 424 net_log_.AddEvent( |
| 423 NetLog::TYPE_QUIC_SESSION_PACKET_SENT, | 425 NetLogEventType::QUIC_SESSION_PACKET_SENT, |
| 424 base::Bind(&NetLogQuicPacketSentCallback, serialized_packet, | 426 base::Bind(&NetLogQuicPacketSentCallback, serialized_packet, |
| 425 transmission_type, sent_time)); | 427 transmission_type, sent_time)); |
| 426 } else { | 428 } else { |
| 427 net_log_.AddEvent( | 429 net_log_.AddEvent( |
| 428 NetLog::TYPE_QUIC_SESSION_PACKET_RETRANSMITTED, | 430 NetLogEventType::QUIC_SESSION_PACKET_RETRANSMITTED, |
| 429 base::Bind(&NetLogQuicPacketRetransmittedCallback, | 431 base::Bind(&NetLogQuicPacketRetransmittedCallback, |
| 430 original_packet_number, serialized_packet.packet_number)); | 432 original_packet_number, serialized_packet.packet_number)); |
| 431 } | 433 } |
| 432 } | 434 } |
| 433 | 435 |
| 434 void QuicConnectionLogger::OnPacketReceived(const IPEndPoint& self_address, | 436 void QuicConnectionLogger::OnPacketReceived(const IPEndPoint& self_address, |
| 435 const IPEndPoint& peer_address, | 437 const IPEndPoint& peer_address, |
| 436 const QuicEncryptedPacket& packet) { | 438 const QuicEncryptedPacket& packet) { |
| 437 if (local_address_from_self_.GetFamily() == ADDRESS_FAMILY_UNSPECIFIED) { | 439 if (local_address_from_self_.GetFamily() == ADDRESS_FAMILY_UNSPECIFIED) { |
| 438 local_address_from_self_ = self_address; | 440 local_address_from_self_ = self_address; |
| 439 UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.ConnectionTypeFromSelf", | 441 UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.ConnectionTypeFromSelf", |
| 440 GetRealAddressFamily(self_address.address()), | 442 GetRealAddressFamily(self_address.address()), |
| 441 ADDRESS_FAMILY_LAST); | 443 ADDRESS_FAMILY_LAST); |
| 442 } | 444 } |
| 443 | 445 |
| 444 previous_received_packet_size_ = last_received_packet_size_; | 446 previous_received_packet_size_ = last_received_packet_size_; |
| 445 last_received_packet_size_ = packet.length(); | 447 last_received_packet_size_ = packet.length(); |
| 446 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_PACKET_RECEIVED, | 448 net_log_.AddEvent(NetLogEventType::QUIC_SESSION_PACKET_RECEIVED, |
| 447 base::Bind(&NetLogQuicPacketCallback, &self_address, | 449 base::Bind(&NetLogQuicPacketCallback, &self_address, |
| 448 &peer_address, packet.length())); | 450 &peer_address, packet.length())); |
| 449 } | 451 } |
| 450 | 452 |
| 451 void QuicConnectionLogger::OnUnauthenticatedHeader( | 453 void QuicConnectionLogger::OnUnauthenticatedHeader( |
| 452 const QuicPacketHeader& header) { | 454 const QuicPacketHeader& header) { |
| 453 net_log_.AddEvent( | 455 net_log_.AddEvent( |
| 454 NetLog::TYPE_QUIC_SESSION_UNAUTHENTICATED_PACKET_HEADER_RECEIVED, | 456 NetLogEventType::QUIC_SESSION_UNAUTHENTICATED_PACKET_HEADER_RECEIVED, |
| 455 base::Bind(&NetLogQuicPacketHeaderCallback, &header)); | 457 base::Bind(&NetLogQuicPacketHeaderCallback, &header)); |
| 456 } | 458 } |
| 457 | 459 |
| 458 void QuicConnectionLogger::OnIncorrectConnectionId( | 460 void QuicConnectionLogger::OnIncorrectConnectionId( |
| 459 QuicConnectionId connection_id) { | 461 QuicConnectionId connection_id) { |
| 460 ++num_incorrect_connection_ids_; | 462 ++num_incorrect_connection_ids_; |
| 461 } | 463 } |
| 462 | 464 |
| 463 void QuicConnectionLogger::OnUndecryptablePacket() { | 465 void QuicConnectionLogger::OnUndecryptablePacket() { |
| 464 ++num_undecryptable_packets_; | 466 ++num_undecryptable_packets_; |
| 465 } | 467 } |
| 466 | 468 |
| 467 void QuicConnectionLogger::OnDuplicatePacket(QuicPacketNumber packet_number) { | 469 void QuicConnectionLogger::OnDuplicatePacket(QuicPacketNumber packet_number) { |
| 468 net_log_.AddEvent( | 470 net_log_.AddEvent( |
| 469 NetLog::TYPE_QUIC_SESSION_DUPLICATE_PACKET_RECEIVED, | 471 NetLogEventType::QUIC_SESSION_DUPLICATE_PACKET_RECEIVED, |
| 470 base::Bind(&NetLogQuicDuplicatePacketCallback, packet_number)); | 472 base::Bind(&NetLogQuicDuplicatePacketCallback, packet_number)); |
| 471 ++num_duplicate_packets_; | 473 ++num_duplicate_packets_; |
| 472 } | 474 } |
| 473 | 475 |
| 474 void QuicConnectionLogger::OnProtocolVersionMismatch( | 476 void QuicConnectionLogger::OnProtocolVersionMismatch( |
| 475 QuicVersion received_version) { | 477 QuicVersion received_version) { |
| 476 // TODO(rtenneti): Add logging. | 478 // TODO(rtenneti): Add logging. |
| 477 } | 479 } |
| 478 | 480 |
| 479 void QuicConnectionLogger::OnPacketHeader(const QuicPacketHeader& header) { | 481 void QuicConnectionLogger::OnPacketHeader(const QuicPacketHeader& header) { |
| 480 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_PACKET_AUTHENTICATED); | 482 net_log_.AddEvent(NetLogEventType::QUIC_SESSION_PACKET_AUTHENTICATED); |
| 481 ++num_packets_received_; | 483 ++num_packets_received_; |
| 482 if (largest_received_packet_number_ < header.packet_number) { | 484 if (largest_received_packet_number_ < header.packet_number) { |
| 483 QuicPacketNumber delta = | 485 QuicPacketNumber delta = |
| 484 header.packet_number - largest_received_packet_number_; | 486 header.packet_number - largest_received_packet_number_; |
| 485 if (delta > 1) { | 487 if (delta > 1) { |
| 486 // There is a gap between the largest packet previously received and | 488 // There is a gap between the largest packet previously received and |
| 487 // the current packet. This indicates either loss, or out-of-order | 489 // the current packet. This indicates either loss, or out-of-order |
| 488 // delivery. | 490 // delivery. |
| 489 UMA_HISTOGRAM_COUNTS("Net.QuicSession.PacketGapReceived", | 491 UMA_HISTOGRAM_COUNTS("Net.QuicSession.PacketGapReceived", |
| 490 static_cast<base::HistogramBase::Sample>(delta - 1)); | 492 static_cast<base::HistogramBase::Sample>(delta - 1)); |
| 491 } | 493 } |
| 492 largest_received_packet_number_ = header.packet_number; | 494 largest_received_packet_number_ = header.packet_number; |
| 493 } | 495 } |
| 494 if (header.packet_number < received_packets_.size()) { | 496 if (header.packet_number < received_packets_.size()) { |
| 495 received_packets_[static_cast<size_t>(header.packet_number)] = true; | 497 received_packets_[static_cast<size_t>(header.packet_number)] = true; |
| 496 } | 498 } |
| 497 if (header.packet_number < last_received_packet_number_) { | 499 if (header.packet_number < last_received_packet_number_) { |
| 498 ++num_out_of_order_received_packets_; | 500 ++num_out_of_order_received_packets_; |
| 499 if (previous_received_packet_size_ < last_received_packet_size_) | 501 if (previous_received_packet_size_ < last_received_packet_size_) |
| 500 ++num_out_of_order_large_received_packets_; | 502 ++num_out_of_order_large_received_packets_; |
| 501 UMA_HISTOGRAM_COUNTS( | 503 UMA_HISTOGRAM_COUNTS( |
| 502 "Net.QuicSession.OutOfOrderGapReceived", | 504 "Net.QuicSession.OutOfOrderGapReceived", |
| 503 static_cast<base::HistogramBase::Sample>(last_received_packet_number_ - | 505 static_cast<base::HistogramBase::Sample>(last_received_packet_number_ - |
| 504 header.packet_number)); | 506 header.packet_number)); |
| 505 } | 507 } |
| 506 last_received_packet_number_ = header.packet_number; | 508 last_received_packet_number_ = header.packet_number; |
| 507 } | 509 } |
| 508 | 510 |
| 509 void QuicConnectionLogger::OnStreamFrame(const QuicStreamFrame& frame) { | 511 void QuicConnectionLogger::OnStreamFrame(const QuicStreamFrame& frame) { |
| 510 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_STREAM_FRAME_RECEIVED, | 512 net_log_.AddEvent(NetLogEventType::QUIC_SESSION_STREAM_FRAME_RECEIVED, |
| 511 base::Bind(&NetLogQuicStreamFrameCallback, &frame)); | 513 base::Bind(&NetLogQuicStreamFrameCallback, &frame)); |
| 512 } | 514 } |
| 513 | 515 |
| 514 void QuicConnectionLogger::OnAckFrame(const QuicAckFrame& frame) { | 516 void QuicConnectionLogger::OnAckFrame(const QuicAckFrame& frame) { |
| 515 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_ACK_FRAME_RECEIVED, | 517 net_log_.AddEvent(NetLogEventType::QUIC_SESSION_ACK_FRAME_RECEIVED, |
| 516 base::Bind(&NetLogQuicAckFrameCallback, &frame)); | 518 base::Bind(&NetLogQuicAckFrameCallback, &frame)); |
| 517 | 519 |
| 518 const size_t kApproximateLargestSoloAckBytes = 100; | 520 const size_t kApproximateLargestSoloAckBytes = 100; |
| 519 if (last_received_packet_number_ < received_acks_.size() && | 521 if (last_received_packet_number_ < received_acks_.size() && |
| 520 last_received_packet_size_ < kApproximateLargestSoloAckBytes) { | 522 last_received_packet_size_ < kApproximateLargestSoloAckBytes) { |
| 521 received_acks_[static_cast<size_t>(last_received_packet_number_)] = true; | 523 received_acks_[static_cast<size_t>(last_received_packet_number_)] = true; |
| 522 } | 524 } |
| 523 | 525 |
| 524 if (frame.packets.Empty()) | 526 if (frame.packets.Empty()) |
| 525 return; | 527 return; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 num_consecutive_missing_packets = interval_len; | 560 num_consecutive_missing_packets = interval_len; |
| 559 } | 561 } |
| 560 previous_missing_packet = it->max() - 1; | 562 previous_missing_packet = it->max() - 1; |
| 561 } | 563 } |
| 562 UpdatePacketGapSentHistogram(num_consecutive_missing_packets); | 564 UpdatePacketGapSentHistogram(num_consecutive_missing_packets); |
| 563 largest_received_missing_packet_number_ = missing_packets.Max(); | 565 largest_received_missing_packet_number_ = missing_packets.Max(); |
| 564 } | 566 } |
| 565 | 567 |
| 566 void QuicConnectionLogger::OnStopWaitingFrame( | 568 void QuicConnectionLogger::OnStopWaitingFrame( |
| 567 const QuicStopWaitingFrame& frame) { | 569 const QuicStopWaitingFrame& frame) { |
| 568 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_STOP_WAITING_FRAME_RECEIVED, | 570 net_log_.AddEvent(NetLogEventType::QUIC_SESSION_STOP_WAITING_FRAME_RECEIVED, |
| 569 base::Bind(&NetLogQuicStopWaitingFrameCallback, &frame)); | 571 base::Bind(&NetLogQuicStopWaitingFrameCallback, &frame)); |
| 570 } | 572 } |
| 571 | 573 |
| 572 void QuicConnectionLogger::OnRstStreamFrame(const QuicRstStreamFrame& frame) { | 574 void QuicConnectionLogger::OnRstStreamFrame(const QuicRstStreamFrame& frame) { |
| 573 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.RstStreamErrorCodeServer", | 575 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.RstStreamErrorCodeServer", |
| 574 frame.error_code); | 576 frame.error_code); |
| 575 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_RST_STREAM_FRAME_RECEIVED, | 577 net_log_.AddEvent(NetLogEventType::QUIC_SESSION_RST_STREAM_FRAME_RECEIVED, |
| 576 base::Bind(&NetLogQuicRstStreamFrameCallback, &frame)); | 578 base::Bind(&NetLogQuicRstStreamFrameCallback, &frame)); |
| 577 } | 579 } |
| 578 | 580 |
| 579 void QuicConnectionLogger::OnConnectionCloseFrame( | 581 void QuicConnectionLogger::OnConnectionCloseFrame( |
| 580 const QuicConnectionCloseFrame& frame) { | 582 const QuicConnectionCloseFrame& frame) { |
| 581 net_log_.AddEvent( | 583 net_log_.AddEvent( |
| 582 NetLog::TYPE_QUIC_SESSION_CONNECTION_CLOSE_FRAME_RECEIVED, | 584 NetLogEventType::QUIC_SESSION_CONNECTION_CLOSE_FRAME_RECEIVED, |
| 583 base::Bind(&NetLogQuicConnectionCloseFrameCallback, &frame)); | 585 base::Bind(&NetLogQuicConnectionCloseFrameCallback, &frame)); |
| 584 } | 586 } |
| 585 | 587 |
| 586 void QuicConnectionLogger::OnWindowUpdateFrame( | 588 void QuicConnectionLogger::OnWindowUpdateFrame( |
| 587 const QuicWindowUpdateFrame& frame) { | 589 const QuicWindowUpdateFrame& frame) { |
| 588 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_WINDOW_UPDATE_FRAME_RECEIVED, | 590 net_log_.AddEvent(NetLogEventType::QUIC_SESSION_WINDOW_UPDATE_FRAME_RECEIVED, |
| 589 base::Bind(&NetLogQuicWindowUpdateFrameCallback, &frame)); | 591 base::Bind(&NetLogQuicWindowUpdateFrameCallback, &frame)); |
| 590 } | 592 } |
| 591 | 593 |
| 592 void QuicConnectionLogger::OnBlockedFrame(const QuicBlockedFrame& frame) { | 594 void QuicConnectionLogger::OnBlockedFrame(const QuicBlockedFrame& frame) { |
| 593 ++num_blocked_frames_received_; | 595 ++num_blocked_frames_received_; |
| 594 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_BLOCKED_FRAME_RECEIVED, | 596 net_log_.AddEvent(NetLogEventType::QUIC_SESSION_BLOCKED_FRAME_RECEIVED, |
| 595 base::Bind(&NetLogQuicBlockedFrameCallback, &frame)); | 597 base::Bind(&NetLogQuicBlockedFrameCallback, &frame)); |
| 596 } | 598 } |
| 597 | 599 |
| 598 void QuicConnectionLogger::OnGoAwayFrame(const QuicGoAwayFrame& frame) { | 600 void QuicConnectionLogger::OnGoAwayFrame(const QuicGoAwayFrame& frame) { |
| 599 UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.GoAwayReceivedForConnectionMigration", | 601 UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.GoAwayReceivedForConnectionMigration", |
| 600 frame.error_code == QUIC_ERROR_MIGRATING_PORT); | 602 frame.error_code == QUIC_ERROR_MIGRATING_PORT); |
| 601 | 603 |
| 602 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_GOAWAY_FRAME_RECEIVED, | 604 net_log_.AddEvent(NetLogEventType::QUIC_SESSION_GOAWAY_FRAME_RECEIVED, |
| 603 base::Bind(&NetLogQuicGoAwayFrameCallback, &frame)); | 605 base::Bind(&NetLogQuicGoAwayFrameCallback, &frame)); |
| 604 } | 606 } |
| 605 | 607 |
| 606 void QuicConnectionLogger::OnPingFrame(const QuicPingFrame& frame) { | 608 void QuicConnectionLogger::OnPingFrame(const QuicPingFrame& frame) { |
| 607 // PingFrame has no contents to log, so just record that it was received. | 609 // PingFrame has no contents to log, so just record that it was received. |
| 608 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_PING_FRAME_RECEIVED); | 610 net_log_.AddEvent(NetLogEventType::QUIC_SESSION_PING_FRAME_RECEIVED); |
| 609 } | 611 } |
| 610 | 612 |
| 611 void QuicConnectionLogger::OnPublicResetPacket( | 613 void QuicConnectionLogger::OnPublicResetPacket( |
| 612 const QuicPublicResetPacket& packet) { | 614 const QuicPublicResetPacket& packet) { |
| 613 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_PUBLIC_RESET_PACKET_RECEIVED); | 615 net_log_.AddEvent(NetLogEventType::QUIC_SESSION_PUBLIC_RESET_PACKET_RECEIVED); |
| 614 UpdatePublicResetAddressMismatchHistogram(local_address_from_shlo_, | 616 UpdatePublicResetAddressMismatchHistogram(local_address_from_shlo_, |
| 615 packet.client_address); | 617 packet.client_address); |
| 616 } | 618 } |
| 617 | 619 |
| 618 void QuicConnectionLogger::OnVersionNegotiationPacket( | 620 void QuicConnectionLogger::OnVersionNegotiationPacket( |
| 619 const QuicVersionNegotiationPacket& packet) { | 621 const QuicVersionNegotiationPacket& packet) { |
| 620 net_log_.AddEvent( | 622 net_log_.AddEvent( |
| 621 NetLog::TYPE_QUIC_SESSION_VERSION_NEGOTIATION_PACKET_RECEIVED, | 623 NetLogEventType::QUIC_SESSION_VERSION_NEGOTIATION_PACKET_RECEIVED, |
| 622 base::Bind(&NetLogQuicVersionNegotiationPacketCallback, &packet)); | 624 base::Bind(&NetLogQuicVersionNegotiationPacketCallback, &packet)); |
| 623 } | 625 } |
| 624 | 626 |
| 625 void QuicConnectionLogger::OnCryptoHandshakeMessageReceived( | 627 void QuicConnectionLogger::OnCryptoHandshakeMessageReceived( |
| 626 const CryptoHandshakeMessage& message) { | 628 const CryptoHandshakeMessage& message) { |
| 627 net_log_.AddEvent( | 629 net_log_.AddEvent( |
| 628 NetLog::TYPE_QUIC_SESSION_CRYPTO_HANDSHAKE_MESSAGE_RECEIVED, | 630 NetLogEventType::QUIC_SESSION_CRYPTO_HANDSHAKE_MESSAGE_RECEIVED, |
| 629 base::Bind(&NetLogQuicCryptoHandshakeMessageCallback, &message)); | 631 base::Bind(&NetLogQuicCryptoHandshakeMessageCallback, &message)); |
| 630 | 632 |
| 631 if (message.tag() == kSHLO) { | 633 if (message.tag() == kSHLO) { |
| 632 StringPiece address; | 634 StringPiece address; |
| 633 QuicSocketAddressCoder decoder; | 635 QuicSocketAddressCoder decoder; |
| 634 if (message.GetStringPiece(kCADR, &address) && | 636 if (message.GetStringPiece(kCADR, &address) && |
| 635 decoder.Decode(address.data(), address.size())) { | 637 decoder.Decode(address.data(), address.size())) { |
| 636 local_address_from_shlo_ = IPEndPoint(decoder.ip(), decoder.port()); | 638 local_address_from_shlo_ = IPEndPoint(decoder.ip(), decoder.port()); |
| 637 UMA_HISTOGRAM_ENUMERATION( | 639 UMA_HISTOGRAM_ENUMERATION( |
| 638 "Net.QuicSession.ConnectionTypeFromPeer", | 640 "Net.QuicSession.ConnectionTypeFromPeer", |
| 639 GetRealAddressFamily(local_address_from_shlo_.address()), | 641 GetRealAddressFamily(local_address_from_shlo_.address()), |
| 640 ADDRESS_FAMILY_LAST); | 642 ADDRESS_FAMILY_LAST); |
| 641 } | 643 } |
| 642 } | 644 } |
| 643 } | 645 } |
| 644 | 646 |
| 645 void QuicConnectionLogger::OnCryptoHandshakeMessageSent( | 647 void QuicConnectionLogger::OnCryptoHandshakeMessageSent( |
| 646 const CryptoHandshakeMessage& message) { | 648 const CryptoHandshakeMessage& message) { |
| 647 net_log_.AddEvent( | 649 net_log_.AddEvent( |
| 648 NetLog::TYPE_QUIC_SESSION_CRYPTO_HANDSHAKE_MESSAGE_SENT, | 650 NetLogEventType::QUIC_SESSION_CRYPTO_HANDSHAKE_MESSAGE_SENT, |
| 649 base::Bind(&NetLogQuicCryptoHandshakeMessageCallback, &message)); | 651 base::Bind(&NetLogQuicCryptoHandshakeMessageCallback, &message)); |
| 650 } | 652 } |
| 651 | 653 |
| 652 void QuicConnectionLogger::OnConnectionClosed(QuicErrorCode error, | 654 void QuicConnectionLogger::OnConnectionClosed(QuicErrorCode error, |
| 653 const string& error_details, | 655 const string& error_details, |
| 654 ConnectionCloseSource source) { | 656 ConnectionCloseSource source) { |
| 655 net_log_.AddEvent( | 657 net_log_.AddEvent( |
| 656 NetLog::TYPE_QUIC_SESSION_CLOSED, | 658 NetLogEventType::QUIC_SESSION_CLOSED, |
| 657 base::Bind(&NetLogQuicOnConnectionClosedCallback, error, source)); | 659 base::Bind(&NetLogQuicOnConnectionClosedCallback, error, source)); |
| 658 } | 660 } |
| 659 | 661 |
| 660 void QuicConnectionLogger::OnSuccessfulVersionNegotiation( | 662 void QuicConnectionLogger::OnSuccessfulVersionNegotiation( |
| 661 const QuicVersion& version) { | 663 const QuicVersion& version) { |
| 662 string quic_version = QuicVersionToString(version); | 664 string quic_version = QuicVersionToString(version); |
| 663 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_VERSION_NEGOTIATED, | 665 net_log_.AddEvent(NetLogEventType::QUIC_SESSION_VERSION_NEGOTIATED, |
| 664 NetLog::StringCallback("version", &quic_version)); | 666 NetLog::StringCallback("version", &quic_version)); |
| 665 } | 667 } |
| 666 | 668 |
| 667 void QuicConnectionLogger::UpdateReceivedFrameCounts( | 669 void QuicConnectionLogger::UpdateReceivedFrameCounts( |
| 668 QuicStreamId stream_id, | 670 QuicStreamId stream_id, |
| 669 int num_frames_received, | 671 int num_frames_received, |
| 670 int num_duplicate_frames_received) { | 672 int num_duplicate_frames_received) { |
| 671 if (stream_id != kCryptoStreamId) { | 673 if (stream_id != kCryptoStreamId) { |
| 672 num_frames_received_ += num_frames_received; | 674 num_frames_received_ += num_frames_received; |
| 673 num_duplicate_frames_received_ += num_duplicate_frames_received; | 675 num_duplicate_frames_received_ += num_duplicate_frames_received; |
| 674 } | 676 } |
| 675 } | 677 } |
| 676 | 678 |
| 677 void QuicConnectionLogger::OnCertificateVerified( | 679 void QuicConnectionLogger::OnCertificateVerified( |
| 678 const CertVerifyResult& result) { | 680 const CertVerifyResult& result) { |
| 679 if (result.cert_status == CERT_STATUS_INVALID) { | 681 if (result.cert_status == CERT_STATUS_INVALID) { |
| 680 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_CERTIFICATE_VERIFY_FAILED); | 682 net_log_.AddEvent(NetLogEventType::QUIC_SESSION_CERTIFICATE_VERIFY_FAILED); |
| 681 return; | 683 return; |
| 682 } | 684 } |
| 683 net_log_.AddEvent( | 685 net_log_.AddEvent( |
| 684 NetLog::TYPE_QUIC_SESSION_CERTIFICATE_VERIFIED, | 686 NetLogEventType::QUIC_SESSION_CERTIFICATE_VERIFIED, |
| 685 base::Bind(&NetLogQuicCertificateVerifiedCallback, result.verified_cert)); | 687 base::Bind(&NetLogQuicCertificateVerifiedCallback, result.verified_cert)); |
| 686 } | 688 } |
| 687 | 689 |
| 688 base::HistogramBase* QuicConnectionLogger::Get6PacketHistogram( | 690 base::HistogramBase* QuicConnectionLogger::Get6PacketHistogram( |
| 689 const char* which_6) const { | 691 const char* which_6) const { |
| 690 // This histogram takes a binary encoding of the 6 consecutive packets | 692 // This histogram takes a binary encoding of the 6 consecutive packets |
| 691 // received. As a result, there are 64 possible sample-patterns. | 693 // received. As a result, there are 64 possible sample-patterns. |
| 692 string prefix("Net.QuicSession.6PacketsPatternsReceived_"); | 694 string prefix("Net.QuicSession.6PacketsPatternsReceived_"); |
| 693 return base::LinearHistogram::FactoryGet( | 695 return base::LinearHistogram::FactoryGet( |
| 694 prefix + which_6 + connection_description_, 1, 64, 65, | 696 prefix + which_6 + connection_description_, 1, 64, 65, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 | 728 |
| 727 string prefix("Net.QuicSession.PacketLossRate_"); | 729 string prefix("Net.QuicSession.PacketLossRate_"); |
| 728 base::HistogramBase* histogram = base::Histogram::FactoryGet( | 730 base::HistogramBase* histogram = base::Histogram::FactoryGet( |
| 729 prefix + connection_description_, 1, 1000, 75, | 731 prefix + connection_description_, 1, 1000, 75, |
| 730 base::HistogramBase::kUmaTargetedHistogramFlag); | 732 base::HistogramBase::kUmaTargetedHistogramFlag); |
| 731 histogram->Add(static_cast<base::HistogramBase::Sample>( | 733 histogram->Add(static_cast<base::HistogramBase::Sample>( |
| 732 ReceivedPacketLossRate() * 1000)); | 734 ReceivedPacketLossRate() * 1000)); |
| 733 } | 735 } |
| 734 | 736 |
| 735 } // namespace net | 737 } // namespace net |
| OLD | NEW |