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

Side by Side Diff: net/ftp/ftp_network_transaction.cc

Issue 515033: Cleanup histogram classes mixing SetFlags into FactoryGet arguments... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 12 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 | Annotate | Revision Log
« no previous file with comments | « net/disk_cache/histogram_macros.h ('k') | net/ftp/ftp_server_type_histograms.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) 2008 The Chromium Authors. All rights reserved. Use of this 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // LICENSE file.
4 4
5 #include "net/ftp/ftp_network_transaction.h" 5 #include "net/ftp/ftp_network_transaction.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/histogram.h" 8 #include "base/histogram.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "net/base/connection_type_histograms.h" 10 #include "net/base/connection_type_histograms.h"
(...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 next_state_ = STATE_DATA_READ_COMPLETE; 1139 next_state_ = STATE_DATA_READ_COMPLETE;
1140 read_data_buf_->data()[0] = 0; 1140 read_data_buf_->data()[0] = 0;
1141 return data_socket_->Read(read_data_buf_, read_data_buf_len_, 1141 return data_socket_->Read(read_data_buf_, read_data_buf_len_,
1142 &io_callback_); 1142 &io_callback_);
1143 } 1143 }
1144 1144
1145 int FtpNetworkTransaction::DoDataReadComplete(int result) { 1145 int FtpNetworkTransaction::DoDataReadComplete(int result) {
1146 return result; 1146 return result;
1147 } 1147 }
1148 1148
1149 // We're using a histogram as a group of counters. We're only interested in 1149 // We're using a histogram as a group of counters, with one bucket for each
1150 // the values of the counters. Ignore the shape, average, and standard 1150 // enumeration value. We're only interested in the values of the counters.
1151 // deviation of the histograms because they are meaningless. 1151 // Ignore the shape, average, and standard deviation of the histograms because
1152 // they are meaningless.
1152 // 1153 //
1153 // We use two groups of counters. In the first group (counter1), each counter 1154 // We use two histograms. In the first histogram we tally whether the user has
1154 // is a boolean (0 or 1) that indicates whether the user has seen an error 1155 // seen an error of that type during the session. In the second histogram we
1155 // of that type during that session. In the second group (counter2), each 1156 // tally the total number of times the users sees each errer.
1156 // counter is the number of errors of that type the user has seen during
1157 // that session.
1158 //
1159 // Each histogram has an unused bucket at the end to allow seamless future
1160 // expansion.
1161 void FtpNetworkTransaction::RecordDataConnectionError(int result) { 1157 void FtpNetworkTransaction::RecordDataConnectionError(int result) {
1162 // Gather data for http://crbug.com/3073. See how many users have trouble 1158 // Gather data for http://crbug.com/3073. See how many users have trouble
1163 // establishing FTP data connection in passive FTP mode. 1159 // establishing FTP data connection in passive FTP mode.
1164 enum { 1160 enum {
1165 // Data connection successful. 1161 // Data connection successful.
1166 NET_ERROR_OK = 0, 1162 NET_ERROR_OK = 0,
1167 1163
1168 // Local firewall blocked the connection. 1164 // Local firewall blocked the connection.
1169 NET_ERROR_ACCESS_DENIED = 1, 1165 NET_ERROR_ACCESS_DENIED = 1,
1170 1166
(...skipping 27 matching lines...) Expand all
1198 type = NET_ERROR_CONNECTION_BROKEN; 1194 type = NET_ERROR_CONNECTION_BROKEN;
1199 break; 1195 break;
1200 case ERR_CONNECTION_REFUSED: 1196 case ERR_CONNECTION_REFUSED:
1201 type = NET_ERROR_CONNECTION_REFUSED; 1197 type = NET_ERROR_CONNECTION_REFUSED;
1202 break; 1198 break;
1203 default: 1199 default:
1204 type = NET_ERROR_OTHER; 1200 type = NET_ERROR_OTHER;
1205 break; 1201 break;
1206 }; 1202 };
1207 static bool had_error_type[NUM_OF_NET_ERROR_TYPES]; 1203 static bool had_error_type[NUM_OF_NET_ERROR_TYPES];
1208 static scoped_refptr<Histogram> error_flagged =
1209 LinearHistogram::LinearHistogramFactoryGet(
1210 "Net.FtpDataConnectionErrorHappened",
1211 1, NUM_OF_NET_ERROR_TYPES, NUM_OF_NET_ERROR_TYPES + 1);
1212 static scoped_refptr<Histogram> error_counter =
1213 LinearHistogram::LinearHistogramFactoryGet(
1214 "Net.FtpDataConnectionErrorCount",
1215 1, NUM_OF_NET_ERROR_TYPES, NUM_OF_NET_ERROR_TYPES + 1);
1216 1204
1217 DCHECK(type >= 0 && type < NUM_OF_NET_ERROR_TYPES); 1205 DCHECK(type >= 0 && type < NUM_OF_NET_ERROR_TYPES);
1218 if (!had_error_type[type]) { 1206 if (!had_error_type[type]) {
1219 had_error_type[type] = true; 1207 had_error_type[type] = true;
1220 error_flagged->SetFlags(kUmaTargetedHistogramFlag); 1208 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorHappened",
1221 error_flagged->Add(type); 1209 type, NUM_OF_NET_ERROR_TYPES);
1222 } 1210 }
1223 error_counter->SetFlags(kUmaTargetedHistogramFlag); 1211 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorCount",
1224 error_counter->Add(type); 1212 type, NUM_OF_NET_ERROR_TYPES);
1225 } 1213 }
1226 1214
1227 } // namespace net 1215 } // namespace net
OLDNEW
« no previous file with comments | « net/disk_cache/histogram_macros.h ('k') | net/ftp/ftp_server_type_histograms.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698