summaryrefslogtreecommitdiffstats
path: root/net/socket_stream/socket_stream_metrics.cc
diff options
context:
space:
mode:
Diffstat (limited to 'net/socket_stream/socket_stream_metrics.cc')
-rw-r--r--net/socket_stream/socket_stream_metrics.cc22
1 files changed, 12 insertions, 10 deletions
diff --git a/net/socket_stream/socket_stream_metrics.cc b/net/socket_stream/socket_stream_metrics.cc
index 625a491..71239af 100644
--- a/net/socket_stream/socket_stream_metrics.cc
+++ b/net/socket_stream/socket_stream_metrics.cc
@@ -70,16 +70,18 @@ void SocketStreamMetrics::OnWrite(int len) {
void SocketStreamMetrics::OnClose() {
base::TimeTicks closed_time = base::TimeTicks::Now();
- UMA_HISTOGRAM_LONG_TIMES("Net.SocketStream.Duration",
- closed_time - connect_establish_time_);
- UMA_HISTOGRAM_COUNTS("Net.SocketStream.ReceivedBytes",
- received_bytes_);
- UMA_HISTOGRAM_COUNTS("Net.SocketStream.ReceivedCounts",
- received_counts_);
- UMA_HISTOGRAM_COUNTS("Net.SocketStream.SentBytes",
- sent_bytes_);
- UMA_HISTOGRAM_COUNTS("Net.SocketStream.SentCounts",
- sent_counts_);
+ if (!connect_establish_time_.is_null()) {
+ UMA_HISTOGRAM_LONG_TIMES("Net.SocketStream.Duration",
+ closed_time - connect_establish_time_);
+ UMA_HISTOGRAM_COUNTS("Net.SocketStream.ReceivedBytes",
+ received_bytes_);
+ UMA_HISTOGRAM_COUNTS("Net.SocketStream.ReceivedCounts",
+ received_counts_);
+ UMA_HISTOGRAM_COUNTS("Net.SocketStream.SentBytes",
+ sent_bytes_);
+ UMA_HISTOGRAM_COUNTS("Net.SocketStream.SentCounts",
+ sent_counts_);
+ }
}
void SocketStreamMetrics::CountProtocolType(ProtocolType protocol_type) {