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

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

Issue 17451016: [UMA] Remove redundant bucket_count variable from base::Histogram. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename variables to be clearer Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « base/metrics/sparse_histogram.cc ('k') | net/disk_cache/stats_histogram.h » ('j') | 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 #include <vector> 5 #include <vector>
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/metrics/statistics_recorder.h" 9 #include "base/metrics/statistics_recorder.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 18 matching lines...) Expand all
29 29
30 void UninitializeStatisticsRecorder() { 30 void UninitializeStatisticsRecorder() {
31 delete statistics_recorder_; 31 delete statistics_recorder_;
32 statistics_recorder_ = NULL; 32 statistics_recorder_ = NULL;
33 } 33 }
34 34
35 Histogram* CreateHistogram(const std::string& name, 35 Histogram* CreateHistogram(const std::string& name,
36 HistogramBase::Sample min, 36 HistogramBase::Sample min,
37 HistogramBase::Sample max, 37 HistogramBase::Sample max,
38 size_t bucket_count) { 38 size_t bucket_count) {
39 return new Histogram(name, min, max, bucket_count, NULL); 39 BucketRanges* ranges = new BucketRanges(bucket_count + 1);
40 Histogram::InitializeBucketRanges(min, max, ranges);
41 const BucketRanges* registered_ranges =
42 StatisticsRecorder::RegisterOrDeleteDuplicateRanges(ranges);
43 return new Histogram(name, min, max, registered_ranges);
40 } 44 }
41 45
42 void DeleteHistogram(HistogramBase* histogram) { 46 void DeleteHistogram(HistogramBase* histogram) {
43 delete histogram; 47 delete histogram;
44 } 48 }
45 49
46 StatisticsRecorder* statistics_recorder_; 50 StatisticsRecorder* statistics_recorder_;
47 }; 51 };
48 52
49 TEST_F(StatisticsRecorderTest, NotInitialized) { 53 TEST_F(StatisticsRecorderTest, NotInitialized) {
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 EXPECT_EQ(1u, ranges.size()); 257 EXPECT_EQ(1u, ranges.size());
254 258
255 Histogram::FactoryGet("Histogram3", 1, 64, 16, HistogramBase::kNoFlags); 259 Histogram::FactoryGet("Histogram3", 1, 64, 16, HistogramBase::kNoFlags);
256 260
257 ranges.clear(); 261 ranges.clear();
258 StatisticsRecorder::GetBucketRanges(&ranges); 262 StatisticsRecorder::GetBucketRanges(&ranges);
259 EXPECT_EQ(2u, ranges.size()); 263 EXPECT_EQ(2u, ranges.size());
260 } 264 }
261 265
262 } // namespace base 266 } // namespace base
OLDNEW
« no previous file with comments | « base/metrics/sparse_histogram.cc ('k') | net/disk_cache/stats_histogram.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698