OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/socket_stream/socket_stream_metrics.h" | 5 #include "net/socket_stream/socket_stream_metrics.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "base/histogram.h" | 9 #include "base/histogram.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 received_bytes_); | 76 received_bytes_); |
77 UMA_HISTOGRAM_COUNTS("Net.SocketStream.ReceivedCounts", | 77 UMA_HISTOGRAM_COUNTS("Net.SocketStream.ReceivedCounts", |
78 received_counts_); | 78 received_counts_); |
79 UMA_HISTOGRAM_COUNTS("Net.SocketStream.SentBytes", | 79 UMA_HISTOGRAM_COUNTS("Net.SocketStream.SentBytes", |
80 sent_bytes_); | 80 sent_bytes_); |
81 UMA_HISTOGRAM_COUNTS("Net.SocketStream.SentCounts", | 81 UMA_HISTOGRAM_COUNTS("Net.SocketStream.SentCounts", |
82 sent_counts_); | 82 sent_counts_); |
83 } | 83 } |
84 | 84 |
85 void SocketStreamMetrics::CountProtocolType(ProtocolType protocol_type) { | 85 void SocketStreamMetrics::CountProtocolType(ProtocolType protocol_type) { |
86 static LinearHistogram counter("Net.SocketStream.ProtocolType", | 86 static scoped_refptr<Histogram> counter = |
87 0, NUM_PROTOCOL_TYPES, | 87 LinearHistogram::LinearHistogramFactoryGet( |
88 NUM_PROTOCOL_TYPES + 1); | 88 "Net.SocketStream.ProtocolType", |
89 counter.SetFlags(kUmaTargetedHistogramFlag); | 89 0, NUM_PROTOCOL_TYPES, NUM_PROTOCOL_TYPES + 1); |
90 counter.Add(protocol_type); | 90 counter->SetFlags(kUmaTargetedHistogramFlag); |
| 91 counter->Add(protocol_type); |
91 } | 92 } |
92 | 93 |
93 void SocketStreamMetrics::CountConnectionType(ConnectionType connection_type) { | 94 void SocketStreamMetrics::CountConnectionType(ConnectionType connection_type) { |
94 static LinearHistogram counter("Net.SocketStream.ConnectionType", | 95 static scoped_refptr<Histogram> counter = |
95 1, NUM_CONNECTION_TYPES, | 96 LinearHistogram::LinearHistogramFactoryGet( |
96 NUM_CONNECTION_TYPES + 1); | 97 "Net.SocketStream.ConnectionType", |
97 counter.SetFlags(kUmaTargetedHistogramFlag); | 98 1, NUM_CONNECTION_TYPES, NUM_CONNECTION_TYPES + 1); |
98 counter.Add(connection_type); | 99 counter->SetFlags(kUmaTargetedHistogramFlag); |
| 100 counter->Add(connection_type); |
99 } | 101 } |
100 | 102 |
101 | 103 |
102 } // namespace net | 104 } // namespace net |
OLD | NEW |