| 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( |
| 411 NetLogEventType::QUIC_SESSION_MTU_DISCOVERY_FRAME_SENT); |
| 409 break; | 412 break; |
| 410 default: | 413 default: |
| 411 DCHECK(false) << "Illegal frame type: " << frame.type; | 414 DCHECK(false) << "Illegal frame type: " << frame.type; |
| 412 } | 415 } |
| 413 } | 416 } |
| 414 | 417 |
| 415 void QuicConnectionLogger::OnPacketSent( | 418 void QuicConnectionLogger::OnPacketSent( |
| 416 const SerializedPacket& serialized_packet, | 419 const SerializedPacket& serialized_packet, |
| 417 QuicPathId /* original_path_id */, | 420 QuicPathId /* original_path_id */, |
| 418 QuicPacketNumber original_packet_number, | 421 QuicPacketNumber original_packet_number, |
| 419 TransmissionType transmission_type, | 422 TransmissionType transmission_type, |
| 420 QuicTime sent_time) { | 423 QuicTime sent_time) { |
| 421 if (original_packet_number == 0) { | 424 if (original_packet_number == 0) { |
| 422 net_log_.AddEvent( | 425 net_log_.AddEvent( |
| 423 NetLog::TYPE_QUIC_SESSION_PACKET_SENT, | 426 NetLogEventType::QUIC_SESSION_PACKET_SENT, |
| 424 base::Bind(&NetLogQuicPacketSentCallback, serialized_packet, | 427 base::Bind(&NetLogQuicPacketSentCallback, serialized_packet, |
| 425 transmission_type, sent_time)); | 428 transmission_type, sent_time)); |
| 426 } else { | 429 } else { |
| 427 net_log_.AddEvent( | 430 net_log_.AddEvent( |
| 428 NetLog::TYPE_QUIC_SESSION_PACKET_RETRANSMITTED, | 431 NetLogEventType::QUIC_SESSION_PACKET_RETRANSMITTED, |
| 429 base::Bind(&NetLogQuicPacketRetransmittedCallback, | 432 base::Bind(&NetLogQuicPacketRetransmittedCallback, |
| 430 original_packet_number, serialized_packet.packet_number)); | 433 original_packet_number, serialized_packet.packet_number)); |
| 431 } | 434 } |
| 432 } | 435 } |
| 433 | 436 |
| 434 void QuicConnectionLogger::OnPacketReceived(const IPEndPoint& self_address, | 437 void QuicConnectionLogger::OnPacketReceived(const IPEndPoint& self_address, |
| 435 const IPEndPoint& peer_address, | 438 const IPEndPoint& peer_address, |
| 436 const QuicEncryptedPacket& packet) { | 439 const QuicEncryptedPacket& packet) { |
| 437 if (local_address_from_self_.GetFamily() == ADDRESS_FAMILY_UNSPECIFIED) { | 440 if (local_address_from_self_.GetFamily() == ADDRESS_FAMILY_UNSPECIFIED) { |
| 438 local_address_from_self_ = self_address; | 441 local_address_from_self_ = self_address; |
| 439 UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.ConnectionTypeFromSelf", | 442 UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.ConnectionTypeFromSelf", |
| 440 GetRealAddressFamily(self_address.address()), | 443 GetRealAddressFamily(self_address.address()), |
| 441 ADDRESS_FAMILY_LAST); | 444 ADDRESS_FAMILY_LAST); |
| 442 } | 445 } |
| 443 | 446 |
| 444 previous_received_packet_size_ = last_received_packet_size_; | 447 previous_received_packet_size_ = last_received_packet_size_; |
| 445 last_received_packet_size_ = packet.length(); | 448 last_received_packet_size_ = packet.length(); |
| 446 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_PACKET_RECEIVED, | 449 net_log_.AddEvent(NetLogEventType::QUIC_SESSION_PACKET_RECEIVED, |
| 447 base::Bind(&NetLogQuicPacketCallback, &self_address, | 450 base::Bind(&NetLogQuicPacketCallback, &self_address, |
| 448 &peer_address, packet.length())); | 451 &peer_address, packet.length())); |
| 449 } | 452 } |
| 450 | 453 |
| 451 void QuicConnectionLogger::OnUnauthenticatedHeader( | 454 void QuicConnectionLogger::OnUnauthenticatedHeader( |
| 452 const QuicPacketHeader& header) { | 455 const QuicPacketHeader& header) { |
| 453 net_log_.AddEvent( | 456 net_log_.AddEvent( |
| 454 NetLog::TYPE_QUIC_SESSION_UNAUTHENTICATED_PACKET_HEADER_RECEIVED, | 457 NetLogEventType::QUIC_SESSION_UNAUTHENTICATED_PACKET_HEADER_RECEIVED, |
| 455 base::Bind(&NetLogQuicPacketHeaderCallback, &header)); | 458 base::Bind(&NetLogQuicPacketHeaderCallback, &header)); |
| 456 } | 459 } |
| 457 | 460 |
| 458 void QuicConnectionLogger::OnIncorrectConnectionId( | 461 void QuicConnectionLogger::OnIncorrectConnectionId( |
| 459 QuicConnectionId connection_id) { | 462 QuicConnectionId connection_id) { |
| 460 ++num_incorrect_connection_ids_; | 463 ++num_incorrect_connection_ids_; |
| 461 } | 464 } |
| 462 | 465 |
| 463 void QuicConnectionLogger::OnUndecryptablePacket() { | 466 void QuicConnectionLogger::OnUndecryptablePacket() { |
| 464 ++num_undecryptable_packets_; | 467 ++num_undecryptable_packets_; |
| 465 } | 468 } |
| 466 | 469 |
| 467 void QuicConnectionLogger::OnDuplicatePacket(QuicPacketNumber packet_number) { | 470 void QuicConnectionLogger::OnDuplicatePacket(QuicPacketNumber packet_number) { |
| 468 net_log_.AddEvent( | 471 net_log_.AddEvent( |
| 469 NetLog::TYPE_QUIC_SESSION_DUPLICATE_PACKET_RECEIVED, | 472 NetLogEventType::QUIC_SESSION_DUPLICATE_PACKET_RECEIVED, |
| 470 base::Bind(&NetLogQuicDuplicatePacketCallback, packet_number)); | 473 base::Bind(&NetLogQuicDuplicatePacketCallback, packet_number)); |
| 471 ++num_duplicate_packets_; | 474 ++num_duplicate_packets_; |
| 472 } | 475 } |
| 473 | 476 |
| 474 void QuicConnectionLogger::OnProtocolVersionMismatch( | 477 void QuicConnectionLogger::OnProtocolVersionMismatch( |
| 475 QuicVersion received_version) { | 478 QuicVersion received_version) { |
| 476 // TODO(rtenneti): Add logging. | 479 // TODO(rtenneti): Add logging. |
| 477 } | 480 } |
| 478 | 481 |
| 479 void QuicConnectionLogger::OnPacketHeader(const QuicPacketHeader& header) { | 482 void QuicConnectionLogger::OnPacketHeader(const QuicPacketHeader& header) { |
| 480 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_PACKET_AUTHENTICATED); | 483 net_log_.AddEvent(NetLogEventType::QUIC_SESSION_PACKET_AUTHENTICATED); |
| 481 ++num_packets_received_; | 484 ++num_packets_received_; |
| 482 if (largest_received_packet_number_ < header.packet_number) { | 485 if (largest_received_packet_number_ < header.packet_number) { |
| 483 QuicPacketNumber delta = | 486 QuicPacketNumber delta = |
| 484 header.packet_number - largest_received_packet_number_; | 487 header.packet_number - largest_received_packet_number_; |
| 485 if (delta > 1) { | 488 if (delta > 1) { |
| 486 // There is a gap between the largest packet previously received and | 489 // There is a gap between the largest packet previously received and |
| 487 // the current packet. This indicates either loss, or out-of-order | 490 // the current packet. This indicates either loss, or out-of-order |
| 488 // delivery. | 491 // delivery. |
| 489 UMA_HISTOGRAM_COUNTS("Net.QuicSession.PacketGapReceived", | 492 UMA_HISTOGRAM_COUNTS("Net.QuicSession.PacketGapReceived", |
| 490 static_cast<base::HistogramBase::Sample>(delta - 1)); | 493 static_cast<base::HistogramBase::Sample>(delta - 1)); |
| 491 } | 494 } |
| 492 largest_received_packet_number_ = header.packet_number; | 495 largest_received_packet_number_ = header.packet_number; |
| 493 } | 496 } |
| 494 if (header.packet_number < received_packets_.size()) { | 497 if (header.packet_number < received_packets_.size()) { |
| 495 received_packets_[static_cast<size_t>(header.packet_number)] = true; | 498 received_packets_[static_cast<size_t>(header.packet_number)] = true; |
| 496 } | 499 } |
| 497 if (header.packet_number < last_received_packet_number_) { | 500 if (header.packet_number < last_received_packet_number_) { |
| 498 ++num_out_of_order_received_packets_; | 501 ++num_out_of_order_received_packets_; |
| 499 if (previous_received_packet_size_ < last_received_packet_size_) | 502 if (previous_received_packet_size_ < last_received_packet_size_) |
| 500 ++num_out_of_order_large_received_packets_; | 503 ++num_out_of_order_large_received_packets_; |
| 501 UMA_HISTOGRAM_COUNTS( | 504 UMA_HISTOGRAM_COUNTS( |
| 502 "Net.QuicSession.OutOfOrderGapReceived", | 505 "Net.QuicSession.OutOfOrderGapReceived", |
| 503 static_cast<base::HistogramBase::Sample>(last_received_packet_number_ - | 506 static_cast<base::HistogramBase::Sample>(last_received_packet_number_ - |
| 504 header.packet_number)); | 507 header.packet_number)); |
| 505 } | 508 } |
| 506 last_received_packet_number_ = header.packet_number; | 509 last_received_packet_number_ = header.packet_number; |
| 507 } | 510 } |
| 508 | 511 |
| 509 void QuicConnectionLogger::OnStreamFrame(const QuicStreamFrame& frame) { | 512 void QuicConnectionLogger::OnStreamFrame(const QuicStreamFrame& frame) { |
| 510 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_STREAM_FRAME_RECEIVED, | 513 net_log_.AddEvent(NetLogEventType::QUIC_SESSION_STREAM_FRAME_RECEIVED, |
| 511 base::Bind(&NetLogQuicStreamFrameCallback, &frame)); | 514 base::Bind(&NetLogQuicStreamFrameCallback, &frame)); |
| 512 } | 515 } |
| 513 | 516 |
| 514 void QuicConnectionLogger::OnAckFrame(const QuicAckFrame& frame) { | 517 void QuicConnectionLogger::OnAckFrame(const QuicAckFrame& frame) { |
| 515 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_ACK_FRAME_RECEIVED, | 518 net_log_.AddEvent(NetLogEventType::QUIC_SESSION_ACK_FRAME_RECEIVED, |
| 516 base::Bind(&NetLogQuicAckFrameCallback, &frame)); | 519 base::Bind(&NetLogQuicAckFrameCallback, &frame)); |
| 517 | 520 |
| 518 const size_t kApproximateLargestSoloAckBytes = 100; | 521 const size_t kApproximateLargestSoloAckBytes = 100; |
| 519 if (last_received_packet_number_ < received_acks_.size() && | 522 if (last_received_packet_number_ < received_acks_.size() && |
| 520 last_received_packet_size_ < kApproximateLargestSoloAckBytes) { | 523 last_received_packet_size_ < kApproximateLargestSoloAckBytes) { |
| 521 received_acks_[static_cast<size_t>(last_received_packet_number_)] = true; | 524 received_acks_[static_cast<size_t>(last_received_packet_number_)] = true; |
| 522 } | 525 } |
| 523 | 526 |
| 524 if (frame.packets.Empty()) | 527 if (frame.packets.Empty()) |
| 525 return; | 528 return; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 num_consecutive_missing_packets = interval_len; | 561 num_consecutive_missing_packets = interval_len; |
| 559 } | 562 } |
| 560 previous_missing_packet = it->max() - 1; | 563 previous_missing_packet = it->max() - 1; |
| 561 } | 564 } |
| 562 UpdatePacketGapSentHistogram(num_consecutive_missing_packets); | 565 UpdatePacketGapSentHistogram(num_consecutive_missing_packets); |
| 563 largest_received_missing_packet_number_ = missing_packets.Max(); | 566 largest_received_missing_packet_number_ = missing_packets.Max(); |
| 564 } | 567 } |
| 565 | 568 |
| 566 void QuicConnectionLogger::OnStopWaitingFrame( | 569 void QuicConnectionLogger::OnStopWaitingFrame( |
| 567 const QuicStopWaitingFrame& frame) { | 570 const QuicStopWaitingFrame& frame) { |
| 568 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_STOP_WAITING_FRAME_RECEIVED, | 571 net_log_.AddEvent(NetLogEventType::QUIC_SESSION_STOP_WAITING_FRAME_RECEIVED, |
| 569 base::Bind(&NetLogQuicStopWaitingFrameCallback, &frame)); | 572 base::Bind(&NetLogQuicStopWaitingFrameCallback, &frame)); |
| 570 } | 573 } |
| 571 | 574 |
| 572 void QuicConnectionLogger::OnRstStreamFrame(const QuicRstStreamFrame& frame) { | 575 void QuicConnectionLogger::OnRstStreamFrame(const QuicRstStreamFrame& frame) { |
| 573 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.RstStreamErrorCodeServer", | 576 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.RstStreamErrorCodeServer", |
| 574 frame.error_code); | 577 frame.error_code); |
| 575 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_RST_STREAM_FRAME_RECEIVED, | 578 net_log_.AddEvent(NetLogEventType::QUIC_SESSION_RST_STREAM_FRAME_RECEIVED, |
| 576 base::Bind(&NetLogQuicRstStreamFrameCallback, &frame)); | 579 base::Bind(&NetLogQuicRstStreamFrameCallback, &frame)); |
| 577 } | 580 } |
| 578 | 581 |
| 579 void QuicConnectionLogger::OnConnectionCloseFrame( | 582 void QuicConnectionLogger::OnConnectionCloseFrame( |
| 580 const QuicConnectionCloseFrame& frame) { | 583 const QuicConnectionCloseFrame& frame) { |
| 581 net_log_.AddEvent( | 584 net_log_.AddEvent( |
| 582 NetLog::TYPE_QUIC_SESSION_CONNECTION_CLOSE_FRAME_RECEIVED, | 585 NetLogEventType::QUIC_SESSION_CONNECTION_CLOSE_FRAME_RECEIVED, |
| 583 base::Bind(&NetLogQuicConnectionCloseFrameCallback, &frame)); | 586 base::Bind(&NetLogQuicConnectionCloseFrameCallback, &frame)); |
| 584 } | 587 } |
| 585 | 588 |
| 586 void QuicConnectionLogger::OnWindowUpdateFrame( | 589 void QuicConnectionLogger::OnWindowUpdateFrame( |
| 587 const QuicWindowUpdateFrame& frame) { | 590 const QuicWindowUpdateFrame& frame) { |
| 588 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_WINDOW_UPDATE_FRAME_RECEIVED, | 591 net_log_.AddEvent(NetLogEventType::QUIC_SESSION_WINDOW_UPDATE_FRAME_RECEIVED, |
| 589 base::Bind(&NetLogQuicWindowUpdateFrameCallback, &frame)); | 592 base::Bind(&NetLogQuicWindowUpdateFrameCallback, &frame)); |
| 590 } | 593 } |
| 591 | 594 |
| 592 void QuicConnectionLogger::OnBlockedFrame(const QuicBlockedFrame& frame) { | 595 void QuicConnectionLogger::OnBlockedFrame(const QuicBlockedFrame& frame) { |
| 593 ++num_blocked_frames_received_; | 596 ++num_blocked_frames_received_; |
| 594 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_BLOCKED_FRAME_RECEIVED, | 597 net_log_.AddEvent(NetLogEventType::QUIC_SESSION_BLOCKED_FRAME_RECEIVED, |
| 595 base::Bind(&NetLogQuicBlockedFrameCallback, &frame)); | 598 base::Bind(&NetLogQuicBlockedFrameCallback, &frame)); |
| 596 } | 599 } |
| 597 | 600 |
| 598 void QuicConnectionLogger::OnGoAwayFrame(const QuicGoAwayFrame& frame) { | 601 void QuicConnectionLogger::OnGoAwayFrame(const QuicGoAwayFrame& frame) { |
| 599 UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.GoAwayReceivedForConnectionMigration", | 602 UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.GoAwayReceivedForConnectionMigration", |
| 600 frame.error_code == QUIC_ERROR_MIGRATING_PORT); | 603 frame.error_code == QUIC_ERROR_MIGRATING_PORT); |
| 601 | 604 |
| 602 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_GOAWAY_FRAME_RECEIVED, | 605 net_log_.AddEvent(NetLogEventType::QUIC_SESSION_GOAWAY_FRAME_RECEIVED, |
| 603 base::Bind(&NetLogQuicGoAwayFrameCallback, &frame)); | 606 base::Bind(&NetLogQuicGoAwayFrameCallback, &frame)); |
| 604 } | 607 } |
| 605 | 608 |
| 606 void QuicConnectionLogger::OnPingFrame(const QuicPingFrame& frame) { | 609 void QuicConnectionLogger::OnPingFrame(const QuicPingFrame& frame) { |
| 607 // PingFrame has no contents to log, so just record that it was received. | 610 // PingFrame has no contents to log, so just record that it was received. |
| 608 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_PING_FRAME_RECEIVED); | 611 net_log_.AddEvent(NetLogEventType::QUIC_SESSION_PING_FRAME_RECEIVED); |
| 609 } | 612 } |
| 610 | 613 |
| 611 void QuicConnectionLogger::OnPublicResetPacket( | 614 void QuicConnectionLogger::OnPublicResetPacket( |
| 612 const QuicPublicResetPacket& packet) { | 615 const QuicPublicResetPacket& packet) { |
| 613 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_PUBLIC_RESET_PACKET_RECEIVED); | 616 net_log_.AddEvent( |
| 617 NetLogEventType::QUIC_SESSION_PUBLIC_RESET_PACKET_RECEIVED); |
| 614 UpdatePublicResetAddressMismatchHistogram(local_address_from_shlo_, | 618 UpdatePublicResetAddressMismatchHistogram(local_address_from_shlo_, |
| 615 packet.client_address); | 619 packet.client_address); |
| 616 } | 620 } |
| 617 | 621 |
| 618 void QuicConnectionLogger::OnVersionNegotiationPacket( | 622 void QuicConnectionLogger::OnVersionNegotiationPacket( |
| 619 const QuicVersionNegotiationPacket& packet) { | 623 const QuicVersionNegotiationPacket& packet) { |
| 620 net_log_.AddEvent( | 624 net_log_.AddEvent( |
| 621 NetLog::TYPE_QUIC_SESSION_VERSION_NEGOTIATION_PACKET_RECEIVED, | 625 NetLogEventType::QUIC_SESSION_VERSION_NEGOTIATION_PACKET_RECEIVED, |
| 622 base::Bind(&NetLogQuicVersionNegotiationPacketCallback, &packet)); | 626 base::Bind(&NetLogQuicVersionNegotiationPacketCallback, &packet)); |
| 623 } | 627 } |
| 624 | 628 |
| 625 void QuicConnectionLogger::OnCryptoHandshakeMessageReceived( | 629 void QuicConnectionLogger::OnCryptoHandshakeMessageReceived( |
| 626 const CryptoHandshakeMessage& message) { | 630 const CryptoHandshakeMessage& message) { |
| 627 net_log_.AddEvent( | 631 net_log_.AddEvent( |
| 628 NetLog::TYPE_QUIC_SESSION_CRYPTO_HANDSHAKE_MESSAGE_RECEIVED, | 632 NetLogEventType::QUIC_SESSION_CRYPTO_HANDSHAKE_MESSAGE_RECEIVED, |
| 629 base::Bind(&NetLogQuicCryptoHandshakeMessageCallback, &message)); | 633 base::Bind(&NetLogQuicCryptoHandshakeMessageCallback, &message)); |
| 630 | 634 |
| 631 if (message.tag() == kSHLO) { | 635 if (message.tag() == kSHLO) { |
| 632 StringPiece address; | 636 StringPiece address; |
| 633 QuicSocketAddressCoder decoder; | 637 QuicSocketAddressCoder decoder; |
| 634 if (message.GetStringPiece(kCADR, &address) && | 638 if (message.GetStringPiece(kCADR, &address) && |
| 635 decoder.Decode(address.data(), address.size())) { | 639 decoder.Decode(address.data(), address.size())) { |
| 636 local_address_from_shlo_ = IPEndPoint(decoder.ip(), decoder.port()); | 640 local_address_from_shlo_ = IPEndPoint(decoder.ip(), decoder.port()); |
| 637 UMA_HISTOGRAM_ENUMERATION( | 641 UMA_HISTOGRAM_ENUMERATION( |
| 638 "Net.QuicSession.ConnectionTypeFromPeer", | 642 "Net.QuicSession.ConnectionTypeFromPeer", |
| 639 GetRealAddressFamily(local_address_from_shlo_.address()), | 643 GetRealAddressFamily(local_address_from_shlo_.address()), |
| 640 ADDRESS_FAMILY_LAST); | 644 ADDRESS_FAMILY_LAST); |
| 641 } | 645 } |
| 642 } | 646 } |
| 643 } | 647 } |
| 644 | 648 |
| 645 void QuicConnectionLogger::OnCryptoHandshakeMessageSent( | 649 void QuicConnectionLogger::OnCryptoHandshakeMessageSent( |
| 646 const CryptoHandshakeMessage& message) { | 650 const CryptoHandshakeMessage& message) { |
| 647 net_log_.AddEvent( | 651 net_log_.AddEvent( |
| 648 NetLog::TYPE_QUIC_SESSION_CRYPTO_HANDSHAKE_MESSAGE_SENT, | 652 NetLogEventType::QUIC_SESSION_CRYPTO_HANDSHAKE_MESSAGE_SENT, |
| 649 base::Bind(&NetLogQuicCryptoHandshakeMessageCallback, &message)); | 653 base::Bind(&NetLogQuicCryptoHandshakeMessageCallback, &message)); |
| 650 } | 654 } |
| 651 | 655 |
| 652 void QuicConnectionLogger::OnConnectionClosed(QuicErrorCode error, | 656 void QuicConnectionLogger::OnConnectionClosed(QuicErrorCode error, |
| 653 const string& error_details, | 657 const string& error_details, |
| 654 ConnectionCloseSource source) { | 658 ConnectionCloseSource source) { |
| 655 net_log_.AddEvent( | 659 net_log_.AddEvent( |
| 656 NetLog::TYPE_QUIC_SESSION_CLOSED, | 660 NetLogEventType::QUIC_SESSION_CLOSED, |
| 657 base::Bind(&NetLogQuicOnConnectionClosedCallback, error, source)); | 661 base::Bind(&NetLogQuicOnConnectionClosedCallback, error, source)); |
| 658 } | 662 } |
| 659 | 663 |
| 660 void QuicConnectionLogger::OnSuccessfulVersionNegotiation( | 664 void QuicConnectionLogger::OnSuccessfulVersionNegotiation( |
| 661 const QuicVersion& version) { | 665 const QuicVersion& version) { |
| 662 string quic_version = QuicVersionToString(version); | 666 string quic_version = QuicVersionToString(version); |
| 663 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_VERSION_NEGOTIATED, | 667 net_log_.AddEvent(NetLogEventType::QUIC_SESSION_VERSION_NEGOTIATED, |
| 664 NetLog::StringCallback("version", &quic_version)); | 668 NetLog::StringCallback("version", &quic_version)); |
| 665 } | 669 } |
| 666 | 670 |
| 667 void QuicConnectionLogger::UpdateReceivedFrameCounts( | 671 void QuicConnectionLogger::UpdateReceivedFrameCounts( |
| 668 QuicStreamId stream_id, | 672 QuicStreamId stream_id, |
| 669 int num_frames_received, | 673 int num_frames_received, |
| 670 int num_duplicate_frames_received) { | 674 int num_duplicate_frames_received) { |
| 671 if (stream_id != kCryptoStreamId) { | 675 if (stream_id != kCryptoStreamId) { |
| 672 num_frames_received_ += num_frames_received; | 676 num_frames_received_ += num_frames_received; |
| 673 num_duplicate_frames_received_ += num_duplicate_frames_received; | 677 num_duplicate_frames_received_ += num_duplicate_frames_received; |
| 674 } | 678 } |
| 675 } | 679 } |
| 676 | 680 |
| 677 void QuicConnectionLogger::OnCertificateVerified( | 681 void QuicConnectionLogger::OnCertificateVerified( |
| 678 const CertVerifyResult& result) { | 682 const CertVerifyResult& result) { |
| 679 if (result.cert_status == CERT_STATUS_INVALID) { | 683 if (result.cert_status == CERT_STATUS_INVALID) { |
| 680 net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_CERTIFICATE_VERIFY_FAILED); | 684 net_log_.AddEvent(NetLogEventType::QUIC_SESSION_CERTIFICATE_VERIFY_FAILED); |
| 681 return; | 685 return; |
| 682 } | 686 } |
| 683 net_log_.AddEvent( | 687 net_log_.AddEvent( |
| 684 NetLog::TYPE_QUIC_SESSION_CERTIFICATE_VERIFIED, | 688 NetLogEventType::QUIC_SESSION_CERTIFICATE_VERIFIED, |
| 685 base::Bind(&NetLogQuicCertificateVerifiedCallback, result.verified_cert)); | 689 base::Bind(&NetLogQuicCertificateVerifiedCallback, result.verified_cert)); |
| 686 } | 690 } |
| 687 | 691 |
| 688 base::HistogramBase* QuicConnectionLogger::Get6PacketHistogram( | 692 base::HistogramBase* QuicConnectionLogger::Get6PacketHistogram( |
| 689 const char* which_6) const { | 693 const char* which_6) const { |
| 690 // This histogram takes a binary encoding of the 6 consecutive packets | 694 // This histogram takes a binary encoding of the 6 consecutive packets |
| 691 // received. As a result, there are 64 possible sample-patterns. | 695 // received. As a result, there are 64 possible sample-patterns. |
| 692 string prefix("Net.QuicSession.6PacketsPatternsReceived_"); | 696 string prefix("Net.QuicSession.6PacketsPatternsReceived_"); |
| 693 return base::LinearHistogram::FactoryGet( | 697 return base::LinearHistogram::FactoryGet( |
| 694 prefix + which_6 + connection_description_, 1, 64, 65, | 698 prefix + which_6 + connection_description_, 1, 64, 65, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 | 730 |
| 727 string prefix("Net.QuicSession.PacketLossRate_"); | 731 string prefix("Net.QuicSession.PacketLossRate_"); |
| 728 base::HistogramBase* histogram = base::Histogram::FactoryGet( | 732 base::HistogramBase* histogram = base::Histogram::FactoryGet( |
| 729 prefix + connection_description_, 1, 1000, 75, | 733 prefix + connection_description_, 1, 1000, 75, |
| 730 base::HistogramBase::kUmaTargetedHistogramFlag); | 734 base::HistogramBase::kUmaTargetedHistogramFlag); |
| 731 histogram->Add(static_cast<base::HistogramBase::Sample>( | 735 histogram->Add(static_cast<base::HistogramBase::Sample>( |
| 732 ReceivedPacketLossRate() * 1000)); | 736 ReceivedPacketLossRate() * 1000)); |
| 733 } | 737 } |
| 734 | 738 |
| 735 } // namespace net | 739 } // namespace net |
| OLD | NEW |