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

Side by Side Diff: base/metrics/histogram.cc

Issue 878223002: Fix Histogram shadowing warning on vs2015 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « no previous file | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Histogram is an object that aggregates statistics, and can summarize them in 5 // Histogram is an object that aggregates statistics, and can summarize them in
6 // various forms, including ASCII graphical, HTML, and numerically (as a 6 // various forms, including ASCII graphical, HTML, and numerically (as a
7 // vector of numbers corresponding to each of the aggregating buckets). 7 // vector of numbers corresponding to each of the aggregating buckets).
8 // See header file for details and examples. 8 // See header file for details and examples.
9 9
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 } 488 }
489 489
490 void Histogram::GetCountAndBucketData(Count* count, 490 void Histogram::GetCountAndBucketData(Count* count,
491 int64* sum, 491 int64* sum,
492 ListValue* buckets) const { 492 ListValue* buckets) const {
493 scoped_ptr<SampleVector> snapshot = SnapshotSampleVector(); 493 scoped_ptr<SampleVector> snapshot = SnapshotSampleVector();
494 *count = snapshot->TotalCount(); 494 *count = snapshot->TotalCount();
495 *sum = snapshot->sum(); 495 *sum = snapshot->sum();
496 size_t index = 0; 496 size_t index = 0;
497 for (size_t i = 0; i < bucket_count(); ++i) { 497 for (size_t i = 0; i < bucket_count(); ++i) {
498 Sample count = snapshot->GetCountAtIndex(i); 498 Sample count_at_index = snapshot->GetCountAtIndex(i);
499 if (count > 0) { 499 if (count_at_index > 0) {
500 scoped_ptr<DictionaryValue> bucket_value(new DictionaryValue()); 500 scoped_ptr<DictionaryValue> bucket_value(new DictionaryValue());
501 bucket_value->SetInteger("low", ranges(i)); 501 bucket_value->SetInteger("low", ranges(i));
502 if (i != bucket_count() - 1) 502 if (i != bucket_count() - 1)
503 bucket_value->SetInteger("high", ranges(i + 1)); 503 bucket_value->SetInteger("high", ranges(i + 1));
504 bucket_value->SetInteger("count", count); 504 bucket_value->SetInteger("count", count_at_index);
505 buckets->Set(index, bucket_value.release()); 505 buckets->Set(index, bucket_value.release());
506 ++index; 506 ++index;
507 } 507 }
508 } 508 }
509 } 509 }
510 510
511 //------------------------------------------------------------------------------ 511 //------------------------------------------------------------------------------
512 // LinearHistogram: This histogram uses a traditional set of evenly spaced 512 // LinearHistogram: This histogram uses a traditional set of evenly spaced
513 // buckets. 513 // buckets.
514 //------------------------------------------------------------------------------ 514 //------------------------------------------------------------------------------
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 837
838 BucketRanges* bucket_ranges = new BucketRanges(ranges.size()); 838 BucketRanges* bucket_ranges = new BucketRanges(ranges.size());
839 for (size_t i = 0; i < ranges.size(); i++) { 839 for (size_t i = 0; i < ranges.size(); i++) {
840 bucket_ranges->set_range(i, ranges[i]); 840 bucket_ranges->set_range(i, ranges[i]);
841 } 841 }
842 bucket_ranges->ResetChecksum(); 842 bucket_ranges->ResetChecksum();
843 return bucket_ranges; 843 return bucket_ranges;
844 } 844 }
845 845
846 } // namespace base 846 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698