summaryrefslogtreecommitdiffstats
path: root/chrome/browser/net
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/net')
-rw-r--r--chrome/browser/net/dns_host_info.cc7
-rw-r--r--chrome/browser/net/websocket_experiment/websocket_experiment_runner.cc61
2 files changed, 24 insertions, 44 deletions
diff --git a/chrome/browser/net/dns_host_info.cc b/chrome/browser/net/dns_host_info.cc
index 755f54d..8946f7f 100644
--- a/chrome/browser/net/dns_host_info.cc
+++ b/chrome/browser/net/dns_host_info.cc
@@ -104,10 +104,9 @@ void DnsHostInfo::RemoveFromQueue() {
}
// Make a custom linear histogram for the region from 0 to boundary.
const size_t kBucketCount = 52;
- static scoped_refptr<Histogram> histogram =
- LinearHistogram::LinearHistogramFactoryGet("DNS.QueueRecycledUnder2",
- TimeDelta(), kBoundary, kBucketCount);
- histogram->SetFlags(kUmaTargetedHistogramFlag);
+ static scoped_refptr<Histogram> histogram = LinearHistogram::FactoryGet(
+ "DNS.QueueRecycledUnder2", TimeDelta(), kBoundary, kBucketCount,
+ Histogram::kUmaTargetedHistogramFlag);
histogram->AddTime(queue_duration_);
}
diff --git a/chrome/browser/net/websocket_experiment/websocket_experiment_runner.cc b/chrome/browser/net/websocket_experiment/websocket_experiment_runner.cc
index 8d03b6f..845d448 100644
--- a/chrome/browser/net/websocket_experiment/websocket_experiment_runner.cc
+++ b/chrome/browser/net/websocket_experiment/websocket_experiment_runner.cc
@@ -28,36 +28,27 @@ static const int kWebSocketTimeSec = 10;
static const int kTimeBucketCount = 50;
// TODO(ukai): Use new thread-safe-reference-counted Histograms.
-#define UPDATE_HISTOGRAM(name, sample, min, max, bucket_count) do { \
+#define UPDATE_HISTOGRAM_ENUMS(name, sample, boundary_value) do { \
switch (task_state_) { \
case STATE_RUN_WS: \
{ \
- static scoped_refptr<Histogram> counter = \
- LinearHistogram::LinearHistogramFactoryGet(\
- "WebSocketExperiment.Basic." name, \
- min, max, bucket_count); \
- counter->SetFlags(kUmaTargetedHistogramFlag); \
- counter->Add(sample); \
+ UMA_HISTOGRAM_ENUMERATION( \
+ "WebSocketExperiment.Basic." name, \
+ sample, boundary_value); \
} \
break; \
case STATE_RUN_WSS: \
{ \
- static scoped_refptr<Histogram> counter = \
- LinearHistogram::LinearHistogramFactoryGet(\
- "WebSocketExperiment.Secure." name, \
- min, max, bucket_count); \
- counter->SetFlags(kUmaTargetedHistogramFlag); \
- counter->Add(sample); \
+ UMA_HISTOGRAM_ENUMERATION( \
+ "WebSocketExperiment.Secure." name, \
+ sample, boundary_value); \
} \
break; \
case STATE_RUN_WS_NODEFAULT_PORT: \
{ \
- static scoped_refptr<Histogram> counter = \
- LinearHistogram::LinearHistogramFactoryGet(\
- "WebSocketExperiment.NoDefaultPort." name, \
- min, max, bucket_count); \
- counter->SetFlags(kUmaTargetedHistogramFlag); \
- counter->Add(sample); \
+ UMA_HISTOGRAM_ENUMERATION( \
+ "WebSocketExperiment.NoDefaultPort." name, \
+ sample, boundary_value); \
} \
break; \
default: \
@@ -70,32 +61,23 @@ static const int kTimeBucketCount = 50;
switch (task_state_) { \
case STATE_RUN_WS: \
{ \
- static scoped_refptr<Histogram> counter = \
- Histogram::HistogramFactoryGet(\
- "WebSocketExperiment.Basic." name, \
- min, max, bucket_count); \
- counter->SetFlags(kUmaTargetedHistogramFlag); \
- counter->AddTime(sample); \
+ UMA_HISTOGRAM_CUSTOM_TIMES( \
+ "WebSocketExperiment.Basic." name, \
+ sample, min, max, bucket_count); \
} \
break; \
case STATE_RUN_WSS: \
{ \
- static scoped_refptr<Histogram> counter = \
- Histogram::HistogramFactoryGet(\
- "WebSocketExperiment.Secure." name, \
- min, max, bucket_count); \
- counter->SetFlags(kUmaTargetedHistogramFlag); \
- counter->AddTime(sample); \
+ UMA_HISTOGRAM_CUSTOM_TIMES( \
+ "WebSocketExperiment.Secure." name, \
+ sample, min, max, bucket_count); \
} \
break; \
case STATE_RUN_WS_NODEFAULT_PORT: \
{ \
- static scoped_refptr<Histogram> counter = \
- Histogram::HistogramFactoryGet(\
- "WebSocketExperiment.NoDefaultPort." name, \
- min, max, bucket_count); \
- counter->SetFlags(kUmaTargetedHistogramFlag); \
- counter->AddTime(sample); \
+ UMA_HISTOGRAM_CUSTOM_TIMES( \
+ "WebSocketExperiment.NoDefaultPort." name, \
+ sample, min, max, bucket_count); \
} \
break; \
default: \
@@ -277,9 +259,8 @@ void WebSocketExperimentRunner::UpdateTaskResultHistogram(
DCHECK(task);
const WebSocketExperimentTask::Result& task_result = task->result();
- UPDATE_HISTOGRAM("LastState", task_result.last_state,
- 1, WebSocketExperimentTask::NUM_STATES,
- WebSocketExperimentTask::NUM_STATES + 1);
+ UPDATE_HISTOGRAM_ENUMS("LastState", task_result.last_state,
+ WebSocketExperimentTask::NUM_STATES);
UPDATE_HISTOGRAM_TIMES("UrlFetch", task_result.url_fetch,
base::TimeDelta::FromMilliseconds(1),