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

Side by Side Diff: net/url_request/data_use_measurement.cc

Issue 1273303002: Measuring data use of different ModelTypes in Sync Service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@NewServices
Patch Set: Updating previous message size in commit Created 5 years, 4 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <string> 5 #include <string>
6 6
7 #include "base/hash.h" 7 #include "base/hash.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/metrics/sparse_histogram.h" 9 #include "base/metrics/sparse_histogram.h"
10 #include "net/base/network_change_notifier.h" 10 #include "net/base/network_change_notifier.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 std::string serviceHistogramName = "DataUse.Service." + service_name; 129 std::string serviceHistogramName = "DataUse.Service." + service_name;
130 std::string combinedHistogramName = 130 std::string combinedHistogramName =
131 "DataUse.Services" + first_suffix + second_suffix + third_suffix; 131 "DataUse.Services" + first_suffix + second_suffix + third_suffix;
132 UMA_HISTOGRAM_SPARSE_SLOWLY_WITH_VALUE( 132 UMA_HISTOGRAM_SPARSE_SLOWLY_WITH_VALUE(
133 combinedHistogramName, base::Hash(service_name), message_size); 133 combinedHistogramName, base::Hash(service_name), message_size);
134 TRAFFIC_MEASUREMENT_UMA_HISTOGRAM(serviceHistogramName, message_size); 134 TRAFFIC_MEASUREMENT_UMA_HISTOGRAM(serviceHistogramName, message_size);
135 } 135 }
136 136
137 } // namespace 137 } // namespace
138 138
139 void SparseDataUseReport(const std::string& histogram_name,
140 int value,
141 int count) {
142 if (count > 0)
143 UMA_HISTOGRAM_SPARSE_SLOWLY_WITH_VALUE(histogram_name, value, count);
144 }
145
139 void DataUseReport(const std::string& service_name, 146 void DataUseReport(const std::string& service_name,
140 const net::URLFetcher* fetcher) { 147 const net::URLFetcher* fetcher) {
141 #if defined(OS_ANDROID) 148 #if defined(OS_ANDROID)
142 if (!listener_made) { 149 if (!listener_made) {
143 listener_made = true; 150 listener_made = true;
144 app_listener = new base::android::ApplicationStatusListener( 151 app_listener = new base::android::ApplicationStatusListener(
145 base::Bind(&OnApplicationStateChange)); 152 base::Bind(&OnApplicationStateChange));
146 } 153 }
147 #endif 154 #endif
148 int total_upload_bytes = fetcher->GetBytesSentSize(); 155 int total_upload_bytes = fetcher->GetBytesSentSize();
149 int total_received_bytes = fetcher->GetBytesReceivedSize(); 156 int total_received_bytes = fetcher->GetBytesReceivedSize();
150 ReportDataUsage(service_name, UPLOAD, total_upload_bytes); 157 ReportDataUsage(service_name, UPLOAD, total_upload_bytes);
151 ReportDataUsage(service_name, DOWNLOAD, total_received_bytes); 158 ReportDataUsage(service_name, DOWNLOAD, total_received_bytes);
152 } 159 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698