Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(517)

Side by Side Diff: net/spdy/spdy_session.cc

Issue 2429313003: Server push cancellation: add metrics collection for (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/spdy/spdy_session.h ('k') | net/spdy/spdy_session_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/spdy/spdy_session.h" 5 #include "net/spdy/spdy_session.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <map> 9 #include <map>
10 #include <utility> 10 #include <utility>
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 spdy_session_key_(spdy_session_key), 637 spdy_session_key_(spdy_session_key),
638 pool_(NULL), 638 pool_(NULL),
639 http_server_properties_(http_server_properties), 639 http_server_properties_(http_server_properties),
640 transport_security_state_(transport_security_state), 640 transport_security_state_(transport_security_state),
641 read_buffer_(new IOBuffer(kReadBufferSize)), 641 read_buffer_(new IOBuffer(kReadBufferSize)),
642 stream_hi_water_mark_(kFirstStreamId), 642 stream_hi_water_mark_(kFirstStreamId),
643 last_accepted_push_stream_id_(0), 643 last_accepted_push_stream_id_(0),
644 unclaimed_pushed_streams_(this), 644 unclaimed_pushed_streams_(this),
645 num_pushed_streams_(0u), 645 num_pushed_streams_(0u),
646 num_active_pushed_streams_(0u), 646 num_active_pushed_streams_(0u),
647 bytes_pushed_count_(0u),
648 bytes_pushed_and_unclaimed_count_(0u),
647 in_flight_write_frame_type_(DATA), 649 in_flight_write_frame_type_(DATA),
648 in_flight_write_frame_size_(0), 650 in_flight_write_frame_size_(0),
649 is_secure_(false), 651 is_secure_(false),
650 availability_state_(STATE_AVAILABLE), 652 availability_state_(STATE_AVAILABLE),
651 read_state_(READ_STATE_DO_READ), 653 read_state_(READ_STATE_DO_READ),
652 write_state_(WRITE_STATE_IDLE), 654 write_state_(WRITE_STATE_IDLE),
653 error_on_close_(OK), 655 error_on_close_(OK),
654 max_concurrent_streams_(kInitialMaxConcurrentStreams), 656 max_concurrent_streams_(kInitialMaxConcurrentStreams),
655 max_concurrent_pushed_streams_(kMaxConcurrentPushedStreams), 657 max_concurrent_pushed_streams_(kMaxConcurrentPushedStreams),
656 streams_initiated_count_(0), 658 streams_initiated_count_(0),
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
1172 1174
1173 // TODO(akalin): When SpdyStream was ref-counted (and 1175 // TODO(akalin): When SpdyStream was ref-counted (and
1174 // |unclaimed_pushed_streams_| held scoped_refptr<SpdyStream>), this 1176 // |unclaimed_pushed_streams_| held scoped_refptr<SpdyStream>), this
1175 // was only done when status was not OK. This meant that pushed 1177 // was only done when status was not OK. This meant that pushed
1176 // streams can still be claimed after they're closed. This is 1178 // streams can still be claimed after they're closed. This is
1177 // probably something that we still want to support, although server 1179 // probably something that we still want to support, although server
1178 // push is hardly used. Write tests for this and fix this. (See 1180 // push is hardly used. Write tests for this and fix this. (See
1179 // http://crbug.com/261712 .) 1181 // http://crbug.com/261712 .)
1180 if (owned_stream->type() == SPDY_PUSH_STREAM) { 1182 if (owned_stream->type() == SPDY_PUSH_STREAM) {
1181 unclaimed_pushed_streams_.erase(owned_stream->url()); 1183 unclaimed_pushed_streams_.erase(owned_stream->url());
1184 bytes_pushed_count_ += owned_stream->recv_bytes();
1182 num_pushed_streams_--; 1185 num_pushed_streams_--;
1183 if (!owned_stream->IsReservedRemote()) 1186 if (!owned_stream->IsReservedRemote())
1184 num_active_pushed_streams_--; 1187 num_active_pushed_streams_--;
1185 } 1188 }
1186 1189
1187 DeleteStream(std::move(owned_stream), status); 1190 DeleteStream(std::move(owned_stream), status);
1188 1191
1189 // If there are no active streams and the socket pool is stalled, close the 1192 // If there are no active streams and the socket pool is stalled, close the
1190 // session to free up a socket slot. 1193 // session to free up a socket slot.
1191 if (active_streams_.empty() && created_streams_.empty() && 1194 if (active_streams_.empty() && created_streams_.empty() &&
(...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after
2174 if (minimum_freshness > it->second.creation_time) 2177 if (minimum_freshness > it->second.creation_time)
2175 streams_to_close.push_back(it->second.stream_id); 2178 streams_to_close.push_back(it->second.stream_id);
2176 } 2179 }
2177 2180
2178 for (std::vector<SpdyStreamId>::const_iterator to_close_it = 2181 for (std::vector<SpdyStreamId>::const_iterator to_close_it =
2179 streams_to_close.begin(); 2182 streams_to_close.begin();
2180 to_close_it != streams_to_close.end(); ++to_close_it) { 2183 to_close_it != streams_to_close.end(); ++to_close_it) {
2181 ActiveStreamMap::iterator active_it = active_streams_.find(*to_close_it); 2184 ActiveStreamMap::iterator active_it = active_streams_.find(*to_close_it);
2182 if (active_it == active_streams_.end()) 2185 if (active_it == active_streams_.end())
2183 continue; 2186 continue;
2187 bytes_pushed_and_unclaimed_count_ += active_it->second.stream->recv_bytes();
2184 2188
2185 LogAbandonedActiveStream(active_it, ERR_INVALID_SPDY_STREAM); 2189 LogAbandonedActiveStream(active_it, ERR_INVALID_SPDY_STREAM);
2186 // CloseActiveStreamIterator() will remove the stream from 2190 // CloseActiveStreamIterator() will remove the stream from
2187 // |unclaimed_pushed_streams_|. 2191 // |unclaimed_pushed_streams_|.
2188 ResetStreamIterator( 2192 ResetStreamIterator(
2189 active_it, RST_STREAM_REFUSED_STREAM, "Stream not claimed."); 2193 active_it, RST_STREAM_REFUSED_STREAM, "Stream not claimed.");
2190 } 2194 }
2191 2195
2192 next_unclaimed_push_stream_sweep_time_ = time_func_() + 2196 next_unclaimed_push_stream_sweep_time_ = time_func_() +
2193 base::TimeDelta::FromSeconds(kMinPushedStreamLifetimeSeconds); 2197 base::TimeDelta::FromSeconds(kMinPushedStreamLifetimeSeconds);
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
2857 2861
2858 void SpdySession::RecordHistograms() { 2862 void SpdySession::RecordHistograms() {
2859 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdyStreamsPerSession", 2863 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdyStreamsPerSession",
2860 streams_initiated_count_, 1, 300, 50); 2864 streams_initiated_count_, 1, 300, 50);
2861 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdyStreamsPushedPerSession", 2865 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdyStreamsPushedPerSession",
2862 streams_pushed_count_, 1, 300, 50); 2866 streams_pushed_count_, 1, 300, 50);
2863 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdyStreamsPushedAndClaimedPerSession", 2867 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdyStreamsPushedAndClaimedPerSession",
2864 streams_pushed_and_claimed_count_, 1, 300, 50); 2868 streams_pushed_and_claimed_count_, 1, 300, 50);
2865 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdyStreamsAbandonedPerSession", 2869 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdyStreamsAbandonedPerSession",
2866 streams_abandoned_count_, 1, 300, 50); 2870 streams_abandoned_count_, 1, 300, 50);
2871 UMA_HISTOGRAM_COUNTS_1M("Net.SpdySession.PushedBytes", bytes_pushed_count_);
2872 DCHECK_LE(bytes_pushed_and_unclaimed_count_, bytes_pushed_count_);
2873 UMA_HISTOGRAM_COUNTS_1M("Net.SpdySession.PushedAndUnclaimedBytes",
2874 bytes_pushed_and_unclaimed_count_);
2867 UMA_HISTOGRAM_ENUMERATION("Net.SpdySettingsSent", 2875 UMA_HISTOGRAM_ENUMERATION("Net.SpdySettingsSent",
2868 sent_settings_ ? 1 : 0, 2); 2876 sent_settings_ ? 1 : 0, 2);
2869 UMA_HISTOGRAM_ENUMERATION("Net.SpdySettingsReceived", 2877 UMA_HISTOGRAM_ENUMERATION("Net.SpdySettingsReceived",
2870 received_settings_ ? 1 : 0, 2); 2878 received_settings_ ? 1 : 0, 2);
2871 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdyStreamStallsPerSession", 2879 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdyStreamStallsPerSession",
2872 stalled_streams_, 1, 300, 50); 2880 stalled_streams_, 1, 300, 50);
2873 UMA_HISTOGRAM_ENUMERATION("Net.SpdySessionsWithStalls", 2881 UMA_HISTOGRAM_ENUMERATION("Net.SpdySessionsWithStalls",
2874 stalled_streams_ > 0 ? 1 : 0, 2); 2882 stalled_streams_ > 0 ? 1 : 0, 2);
2875 2883
2876 if (received_settings_) { 2884 if (received_settings_) {
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
3107 if (!queue->empty()) { 3115 if (!queue->empty()) {
3108 SpdyStreamId stream_id = queue->front(); 3116 SpdyStreamId stream_id = queue->front();
3109 queue->pop_front(); 3117 queue->pop_front();
3110 return stream_id; 3118 return stream_id;
3111 } 3119 }
3112 } 3120 }
3113 return 0; 3121 return 0;
3114 } 3122 }
3115 3123
3116 } // namespace net 3124 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_session.h ('k') | net/spdy/spdy_session_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698