Chromium Code Reviews| 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" |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 #include "net/quic/quic_address_mismatch.h" | 22 #include "net/quic/quic_address_mismatch.h" |
| 23 #include "net/quic/quic_socket_address_coder.h" | 23 #include "net/quic/quic_socket_address_coder.h" |
| 24 | 24 |
| 25 using base::StringPiece; | 25 using base::StringPiece; |
| 26 using std::string; | 26 using std::string; |
| 27 | 27 |
| 28 namespace net { | 28 namespace net { |
| 29 | 29 |
| 30 namespace { | 30 namespace { |
| 31 | 31 |
| 32 // Histograms to track how often chrome sends/receives flow-control BLOCKED | |
| 33 // frames. Note: these values must be kept in sync with the corresponding values | |
| 34 // in: tools/metrics/histograms/histograms.xml | |
| 35 enum BlockedFrameType { | |
| 36 BLOCKED_FRAME_RECEIVED = 0, | |
| 37 BLOCKED_FRAME_SENT = 1, | |
| 38 NUM_BLOCKED_FRAMES = 2, | |
| 39 }; | |
| 40 | |
| 32 // We have ranges-of-buckets in the cumulative histogram (covering 21 packet | 41 // We have ranges-of-buckets in the cumulative histogram (covering 21 packet |
| 33 // sequences) of length 2, 3, 4, ... 22. | 42 // sequences) of length 2, 3, 4, ... 22. |
| 34 // Hence the largest sample is bounded by the sum of those numbers. | 43 // Hence the largest sample is bounded by the sum of those numbers. |
| 35 const int kBoundingSampleInCumulativeHistogram = ((2 + 22) * 21) / 2; | 44 const int kBoundingSampleInCumulativeHistogram = ((2 + 22) * 21) / 2; |
| 36 | 45 |
| 46 void RecordBlockedFrame(BlockedFrameType blocked_frame_type) { | |
| 47 UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.FlowControlBlockedFrame", | |
| 48 blocked_frame_type, NUM_BLOCKED_FRAMES); | |
|
Ryan Hamilton
2014/10/21 19:48:14
Instead of recording entry each time we become blo
ramant (doing other things)
2014/10/21 22:05:31
Done.
| |
| 49 } | |
| 50 | |
| 37 base::Value* NetLogQuicPacketCallback(const IPEndPoint* self_address, | 51 base::Value* NetLogQuicPacketCallback(const IPEndPoint* self_address, |
| 38 const IPEndPoint* peer_address, | 52 const IPEndPoint* peer_address, |
| 39 size_t packet_size, | 53 size_t packet_size, |
| 40 NetLog::LogLevel /* log_level */) { | 54 NetLog::LogLevel /* log_level */) { |
| 41 base::DictionaryValue* dict = new base::DictionaryValue(); | 55 base::DictionaryValue* dict = new base::DictionaryValue(); |
| 42 dict->SetString("self_address", self_address->ToString()); | 56 dict->SetString("self_address", self_address->ToString()); |
| 43 dict->SetString("peer_address", peer_address->ToString()); | 57 dict->SetString("peer_address", peer_address->ToString()); |
| 44 dict->SetInteger("size", packet_size); | 58 dict->SetInteger("size", packet_size); |
| 45 return dict; | 59 return dict; |
| 46 } | 60 } |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 435 base::Bind(&NetLogQuicGoAwayFrameCallback, | 449 base::Bind(&NetLogQuicGoAwayFrameCallback, |
| 436 frame.goaway_frame)); | 450 frame.goaway_frame)); |
| 437 break; | 451 break; |
| 438 case WINDOW_UPDATE_FRAME: | 452 case WINDOW_UPDATE_FRAME: |
| 439 net_log_.AddEvent( | 453 net_log_.AddEvent( |
| 440 NetLog::TYPE_QUIC_SESSION_WINDOW_UPDATE_FRAME_SENT, | 454 NetLog::TYPE_QUIC_SESSION_WINDOW_UPDATE_FRAME_SENT, |
| 441 base::Bind(&NetLogQuicWindowUpdateFrameCallback, | 455 base::Bind(&NetLogQuicWindowUpdateFrameCallback, |
| 442 frame.window_update_frame)); | 456 frame.window_update_frame)); |
| 443 break; | 457 break; |
| 444 case BLOCKED_FRAME: | 458 case BLOCKED_FRAME: |
| 459 RecordBlockedFrame(BLOCKED_FRAME_SENT); | |
| 445 net_log_.AddEvent( | 460 net_log_.AddEvent( |
| 446 NetLog::TYPE_QUIC_SESSION_BLOCKED_FRAME_SENT, | 461 NetLog::TYPE_QUIC_SESSION_BLOCKED_FRAME_SENT, |
| 447 base::Bind(&NetLogQuicBlockedFrameCallback, | 462 base::Bind(&NetLogQuicBlockedFrameCallback, |
| 448 frame.blocked_frame)); | 463 frame.blocked_frame)); |
| 449 break; | 464 break; |
| 450 case STOP_WAITING_FRAME: | 465 case STOP_WAITING_FRAME: |
| 451 net_log_.AddEvent( | 466 net_log_.AddEvent( |
| 452 NetLog::TYPE_QUIC_SESSION_STOP_WAITING_FRAME_SENT, | 467 NetLog::TYPE_QUIC_SESSION_STOP_WAITING_FRAME_SENT, |
| 453 base::Bind(&NetLogQuicStopWaitingFrameCallback, | 468 base::Bind(&NetLogQuicStopWaitingFrameCallback, |
| 454 frame.stop_waiting_frame)); | 469 frame.stop_waiting_frame)); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 629 } | 644 } |
| 630 | 645 |
| 631 void QuicConnectionLogger::OnWindowUpdateFrame( | 646 void QuicConnectionLogger::OnWindowUpdateFrame( |
| 632 const QuicWindowUpdateFrame& frame) { | 647 const QuicWindowUpdateFrame& frame) { |
| 633 net_log_.AddEvent( | 648 net_log_.AddEvent( |
| 634 NetLog::TYPE_QUIC_SESSION_WINDOW_UPDATE_FRAME_RECEIVED, | 649 NetLog::TYPE_QUIC_SESSION_WINDOW_UPDATE_FRAME_RECEIVED, |
| 635 base::Bind(&NetLogQuicWindowUpdateFrameCallback, &frame)); | 650 base::Bind(&NetLogQuicWindowUpdateFrameCallback, &frame)); |
| 636 } | 651 } |
| 637 | 652 |
| 638 void QuicConnectionLogger::OnBlockedFrame(const QuicBlockedFrame& frame) { | 653 void QuicConnectionLogger::OnBlockedFrame(const QuicBlockedFrame& frame) { |
| 654 RecordBlockedFrame(BLOCKED_FRAME_RECEIVED); | |
| 639 net_log_.AddEvent( | 655 net_log_.AddEvent( |
| 640 NetLog::TYPE_QUIC_SESSION_BLOCKED_FRAME_RECEIVED, | 656 NetLog::TYPE_QUIC_SESSION_BLOCKED_FRAME_RECEIVED, |
| 641 base::Bind(&NetLogQuicBlockedFrameCallback, &frame)); | 657 base::Bind(&NetLogQuicBlockedFrameCallback, &frame)); |
| 642 } | 658 } |
| 643 | 659 |
| 644 void QuicConnectionLogger::OnGoAwayFrame(const QuicGoAwayFrame& frame) { | 660 void QuicConnectionLogger::OnGoAwayFrame(const QuicGoAwayFrame& frame) { |
| 645 net_log_.AddEvent( | 661 net_log_.AddEvent( |
| 646 NetLog::TYPE_QUIC_SESSION_GOAWAY_FRAME_RECEIVED, | 662 NetLog::TYPE_QUIC_SESSION_GOAWAY_FRAME_RECEIVED, |
| 647 base::Bind(&NetLogQuicGoAwayFrameCallback, &frame)); | 663 base::Bind(&NetLogQuicGoAwayFrameCallback, &frame)); |
| 648 } | 664 } |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 884 continue; | 900 continue; |
| 885 } | 901 } |
| 886 // Record some overlapping patterns, to get a better picture, since this is | 902 // Record some overlapping patterns, to get a better picture, since this is |
| 887 // not very expensive. | 903 // not very expensive. |
| 888 if (i % 3 == 0) | 904 if (i % 3 == 0) |
| 889 six_packet_histogram->Add(recent_6_mask); | 905 six_packet_histogram->Add(recent_6_mask); |
| 890 } | 906 } |
| 891 } | 907 } |
| 892 | 908 |
| 893 } // namespace net | 909 } // namespace net |
| OLD | NEW |