summaryrefslogtreecommitdiffstats
path: root/net/ftp
diff options
context:
space:
mode:
authorjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-28 06:59:52 +0000
committerjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-28 06:59:52 +0000
commit2753b39e0c2e83d3b497ebadc2d720f12b74db40 (patch)
tree01edf034e65922a229b3ccbaef8291059ac5e2bc /net/ftp
parente660e88dc26b9b31c48c815b2358212ea4067ca5 (diff)
downloadchromium_src-2753b39e0c2e83d3b497ebadc2d720f12b74db40.zip
chromium_src-2753b39e0c2e83d3b497ebadc2d720f12b74db40.tar.gz
chromium_src-2753b39e0c2e83d3b497ebadc2d720f12b74db40.tar.bz2
Cleanup histogram classes mixing SetFlags into FactoryGet arguments
Generic cleanup of histogram class, renaming *FactoryGet to FactoryGet, along with reformatting. The macros were cleaned up to use common sub-macros rather than repeating code as much. Removed ThreadSafeHistogram (and associated ASSET_HISTOGRAM macros) since this class was not getting used. I introduced UMA_HISTOGRAM_ENUMERATION to support the common use of LinearHistograms to count various enumerated values. I added a Flags argument to all the FactoryGet routines to help avoid needing to call SetFlags each time a new sample is Add()ed. This also simplifies the code. This will all help prepare for a "don't histogram at all" macro setting so that I can test the impact of the histogram macro calls on performance (since there are now so many active histograms). BUG=31206 r=raman.tenneti Review URL: http://codereview.chromium.org/515033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35295 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/ftp')
-rw-r--r--net/ftp/ftp_network_transaction.cc34
-rw-r--r--net/ftp/ftp_server_type_histograms.cc36
2 files changed, 23 insertions, 47 deletions
diff --git a/net/ftp/ftp_network_transaction.cc b/net/ftp/ftp_network_transaction.cc
index 44f1aa1..ec87b8c 100644
--- a/net/ftp/ftp_network_transaction.cc
+++ b/net/ftp/ftp_network_transaction.cc
@@ -1146,18 +1146,14 @@ int FtpNetworkTransaction::DoDataReadComplete(int result) {
return result;
}
-// We're using a histogram as a group of counters. We're only interested in
-// the values of the counters. Ignore the shape, average, and standard
-// deviation of the histograms because they are meaningless.
+// We're using a histogram as a group of counters, with one bucket for each
+// enumeration value. We're only interested in the values of the counters.
+// Ignore the shape, average, and standard deviation of the histograms because
+// they are meaningless.
//
-// We use two groups of counters. In the first group (counter1), each counter
-// is a boolean (0 or 1) that indicates whether the user has seen an error
-// of that type during that session. In the second group (counter2), each
-// counter is the number of errors of that type the user has seen during
-// that session.
-//
-// Each histogram has an unused bucket at the end to allow seamless future
-// expansion.
+// We use two histograms. In the first histogram we tally whether the user has
+// seen an error of that type during the session. In the second histogram we
+// tally the total number of times the users sees each errer.
void FtpNetworkTransaction::RecordDataConnectionError(int result) {
// Gather data for http://crbug.com/3073. See how many users have trouble
// establishing FTP data connection in passive FTP mode.
@@ -1205,23 +1201,15 @@ void FtpNetworkTransaction::RecordDataConnectionError(int result) {
break;
};
static bool had_error_type[NUM_OF_NET_ERROR_TYPES];
- static scoped_refptr<Histogram> error_flagged =
- LinearHistogram::LinearHistogramFactoryGet(
- "Net.FtpDataConnectionErrorHappened",
- 1, NUM_OF_NET_ERROR_TYPES, NUM_OF_NET_ERROR_TYPES + 1);
- static scoped_refptr<Histogram> error_counter =
- LinearHistogram::LinearHistogramFactoryGet(
- "Net.FtpDataConnectionErrorCount",
- 1, NUM_OF_NET_ERROR_TYPES, NUM_OF_NET_ERROR_TYPES + 1);
DCHECK(type >= 0 && type < NUM_OF_NET_ERROR_TYPES);
if (!had_error_type[type]) {
had_error_type[type] = true;
- error_flagged->SetFlags(kUmaTargetedHistogramFlag);
- error_flagged->Add(type);
+ UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorHappened",
+ type, NUM_OF_NET_ERROR_TYPES);
}
- error_counter->SetFlags(kUmaTargetedHistogramFlag);
- error_counter->Add(type);
+ UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorCount",
+ type, NUM_OF_NET_ERROR_TYPES);
}
} // namespace net
diff --git a/net/ftp/ftp_server_type_histograms.cc b/net/ftp/ftp_server_type_histograms.cc
index 60ab9b9..de90d72 100644
--- a/net/ftp/ftp_server_type_histograms.cc
+++ b/net/ftp/ftp_server_type_histograms.cc
@@ -8,38 +8,26 @@
namespace net {
-// We're using a histogram as a group of counters. We're only interested in
-// the values of the counters. Ignore the shape, average, and standard
-// deviation of the histograms because they are meaningless.
+// We're using a histogram as a group of counters, with one bucket for each
+// enumeration value. We're only interested in the values of the counters.
+// Ignore the shape, average, and standard deviation of the histograms because
+// they are meaningless.
//
-// We use two groups of counters. In the first group (counter1), each counter
-// is a boolean (0 or 1) that indicates whether the user has seen an FTP server
-// of that type during that session. In the second group (counter2), each
-// counter is the number of transactions with FTP server of that type the user
-// has made during that session.
-//
-// Each histogram has an unused bucket at the end to allow seamless future
-// expansion.
+// We use two histograms. In the first histogram we tally whether the user has
+// seen an FTP server of a given type during that session. In the second
+// histogram we tally the number of transactions with FTP server of a given type
+// the user has made during that session.
void UpdateFtpServerTypeHistograms(FtpServerType type) {
static bool had_server_type[NUM_OF_SERVER_TYPES];
- static scoped_refptr<Histogram> counter1 =
- LinearHistogram::LinearHistogramFactoryGet("Net.HadFtpServerType",
- 1, NUM_OF_SERVER_TYPES,
- NUM_OF_SERVER_TYPES + 1);
- static scoped_refptr<Histogram> counter2 =
- LinearHistogram::LinearHistogramFactoryGet("Net.FtpServerTypeCount",
- 1, NUM_OF_SERVER_TYPES,
- NUM_OF_SERVER_TYPES + 1);
-
if (type >= 0 && type < NUM_OF_SERVER_TYPES) {
if (!had_server_type[type]) {
had_server_type[type] = true;
- counter1->SetFlags(kUmaTargetedHistogramFlag);
- counter1->Add(type);
+ UMA_HISTOGRAM_ENUMERATION("Net.HadFtpServerType",
+ type, NUM_OF_SERVER_TYPES);
}
}
- counter2->SetFlags(kUmaTargetedHistogramFlag);
- counter2->Add(type);
+ UMA_HISTOGRAM_ENUMERATION("Net.FtpServerTypeCount",
+ type, NUM_OF_SERVER_TYPES);
}
} // namespace net