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

Side by Side Diff: webrtc/system_wrappers/source/metrics_default.cc

Issue 2337883003: Remove name parameter from HistogramAdd function. (Closed)
Patch Set: Add check to Android Metrics. Created 4 years, 3 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 (c) 2014 The WebRTC project authors. All Rights Reserved. 1 // Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
2 // 2 //
3 // Use of this source code is governed by a BSD-style license 3 // Use of this source code is governed by a BSD-style license
4 // that can be found in the LICENSE file in the root of the source 4 // that can be found in the LICENSE file in the root of the source
5 // tree. An additional intellectual property rights grant can be found 5 // tree. An additional intellectual property rights grant can be found
6 // in the file PATENTS. All contributing project authors may 6 // in the file PATENTS. All contributing project authors may
7 // be found in the AUTHORS file in the root of the source tree. 7 // be found in the AUTHORS file in the root of the source tree.
8 // 8 //
9 9
10 #include "webrtc/system_wrappers/include/metrics_default.h" 10 #include "webrtc/system_wrappers/include/metrics_default.h"
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 // subsequent calls). 225 // subsequent calls).
226 Histogram* HistogramFactoryGetEnumeration(const std::string& name, 226 Histogram* HistogramFactoryGetEnumeration(const std::string& name,
227 int boundary) { 227 int boundary) {
228 RtcHistogramMap* map = GetMap(); 228 RtcHistogramMap* map = GetMap();
229 if (!map) 229 if (!map)
230 return nullptr; 230 return nullptr;
231 231
232 return map->GetEnumerationHistogram(name, boundary); 232 return map->GetEnumerationHistogram(name, boundary);
233 } 233 }
234 234
235 // Fast path. Adds |sample| to cached |histogram_pointer|. 235 const std::string& GetHistogramName(Histogram* histogram_pointer) {
236 void HistogramAdd(Histogram* histogram_pointer,
237 const std::string& name,
238 int sample) {
239 if (!histogram_pointer)
240 return;
241
242 RtcHistogram* ptr = reinterpret_cast<RtcHistogram*>(histogram_pointer); 236 RtcHistogram* ptr = reinterpret_cast<RtcHistogram*>(histogram_pointer);
243 RTC_DCHECK_EQ(name, ptr->name()) << "The name should not vary."; 237 return ptr->name();
244 ptr->Add(sample);
245 } 238 }
246 239
247 // Fast path. Adds |sample| to cached |histogram_pointer|. 240 // Fast path. Adds |sample| to cached |histogram_pointer|.
248 void HistogramAdd(Histogram* histogram_pointer, int sample) { 241 void HistogramAdd(Histogram* histogram_pointer, int sample) {
249 if (!histogram_pointer)
250 return;
251
252 RtcHistogram* ptr = reinterpret_cast<RtcHistogram*>(histogram_pointer); 242 RtcHistogram* ptr = reinterpret_cast<RtcHistogram*>(histogram_pointer);
253 ptr->Add(sample); 243 ptr->Add(sample);
254 } 244 }
255 245
256 SampleInfo::SampleInfo(const std::string& name, 246 SampleInfo::SampleInfo(const std::string& name,
257 int min, 247 int min,
258 int max, 248 int max,
259 size_t bucket_count) 249 size_t bucket_count)
260 : name(name), min(min), max(max), bucket_count(bucket_count) {} 250 : name(name), min(min), max(max), bucket_count(bucket_count) {}
261 251
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 return map ? map->NumSamples(name) : 0; 284 return map ? map->NumSamples(name) : 0;
295 } 285 }
296 286
297 int MinSample(const std::string& name) { 287 int MinSample(const std::string& name) {
298 RtcHistogramMap* map = GetMap(); 288 RtcHistogramMap* map = GetMap();
299 return map ? map->MinSample(name) : -1; 289 return map ? map->MinSample(name) : -1;
300 } 290 }
301 291
302 } // namespace metrics 292 } // namespace metrics
303 } // namespace webrtc 293 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698