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
3 // found in the LICENSE file.
5 #include "base/metrics/histogram.h"
11 #include "base/logging.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/metrics/bucket_ranges.h"
14 #include "base/metrics/histogram_macros.h"
15 #include "base/metrics/sample_vector.h"
16 #include "base/metrics/statistics_recorder.h"
17 #include "base/pickle.h"
18 #include "base/time/time.h"
19 #include "testing/gtest/include/gtest/gtest.h"
23 class HistogramTest
: public testing::Test
{
25 void SetUp() override
{
26 // Each test will have a clean state (no Histogram / BucketRanges
28 InitializeStatisticsRecorder();
31 void TearDown() override
{ UninitializeStatisticsRecorder(); }
33 void InitializeStatisticsRecorder() {
34 statistics_recorder_
= new StatisticsRecorder();
37 void UninitializeStatisticsRecorder() {
38 delete statistics_recorder_
;
39 statistics_recorder_
= NULL
;
42 StatisticsRecorder
* statistics_recorder_
;
45 // Check for basic syntax and use.
46 TEST_F(HistogramTest
, BasicTest
) {
47 // Try basic construction
48 HistogramBase
* histogram
= Histogram::FactoryGet(
49 "TestHistogram", 1, 1000, 10, HistogramBase::kNoFlags
);
50 EXPECT_TRUE(histogram
);
52 HistogramBase
* linear_histogram
= LinearHistogram::FactoryGet(
53 "TestLinearHistogram", 1, 1000, 10, HistogramBase::kNoFlags
);
54 EXPECT_TRUE(linear_histogram
);
56 std::vector
<int> custom_ranges
;
57 custom_ranges
.push_back(1);
58 custom_ranges
.push_back(5);
59 HistogramBase
* custom_histogram
= CustomHistogram::FactoryGet(
60 "TestCustomHistogram", custom_ranges
, HistogramBase::kNoFlags
);
61 EXPECT_TRUE(custom_histogram
);
63 // Use standard macros (but with fixed samples)
64 LOCAL_HISTOGRAM_TIMES("Test2Histogram", TimeDelta::FromDays(1));
65 LOCAL_HISTOGRAM_COUNTS("Test3Histogram", 30);
67 LOCAL_HISTOGRAM_ENUMERATION("Test6Histogram", 129, 130);
70 // Check that the macro correctly matches histograms by name and records their
72 TEST_F(HistogramTest
, NameMatchTest
) {
73 LOCAL_HISTOGRAM_PERCENTAGE("DuplicatedHistogram", 10);
74 LOCAL_HISTOGRAM_PERCENTAGE("DuplicatedHistogram", 10);
75 HistogramBase
* histogram
= LinearHistogram::FactoryGet(
76 "DuplicatedHistogram", 1, 101, 102, HistogramBase::kNoFlags
);
78 scoped_ptr
<HistogramSamples
> samples
= histogram
->SnapshotSamples();
79 EXPECT_EQ(2, samples
->TotalCount());
80 EXPECT_EQ(2, samples
->GetCount(10));
83 TEST_F(HistogramTest
, ExponentialRangesTest
) {
84 // Check that we got a nice exponential when there was enough rooom.
85 BucketRanges
ranges(9);
86 Histogram::InitializeBucketRanges(1, 64, &ranges
);
87 EXPECT_EQ(0, ranges
.range(0));
89 for (int i
= 1; i
< 8; i
++) {
90 EXPECT_EQ(power_of_2
, ranges
.range(i
));
93 EXPECT_EQ(HistogramBase::kSampleType_MAX
, ranges
.range(8));
95 // Check the corresponding Histogram will use the correct ranges.
96 Histogram
* histogram
= static_cast<Histogram
*>(
97 Histogram::FactoryGet("Histogram", 1, 64, 8, HistogramBase::kNoFlags
));
98 EXPECT_TRUE(ranges
.Equals(histogram
->bucket_ranges()));
100 // When bucket count is limited, exponential ranges will partially look like
102 BucketRanges
ranges2(16);
103 Histogram::InitializeBucketRanges(1, 32, &ranges2
);
105 EXPECT_EQ(0, ranges2
.range(0));
106 EXPECT_EQ(1, ranges2
.range(1));
107 EXPECT_EQ(2, ranges2
.range(2));
108 EXPECT_EQ(3, ranges2
.range(3));
109 EXPECT_EQ(4, ranges2
.range(4));
110 EXPECT_EQ(5, ranges2
.range(5));
111 EXPECT_EQ(6, ranges2
.range(6));
112 EXPECT_EQ(7, ranges2
.range(7));
113 EXPECT_EQ(9, ranges2
.range(8));
114 EXPECT_EQ(11, ranges2
.range(9));
115 EXPECT_EQ(14, ranges2
.range(10));
116 EXPECT_EQ(17, ranges2
.range(11));
117 EXPECT_EQ(21, ranges2
.range(12));
118 EXPECT_EQ(26, ranges2
.range(13));
119 EXPECT_EQ(32, ranges2
.range(14));
120 EXPECT_EQ(HistogramBase::kSampleType_MAX
, ranges2
.range(15));
122 // Check the corresponding Histogram will use the correct ranges.
123 Histogram
* histogram2
= static_cast<Histogram
*>(
124 Histogram::FactoryGet("Histogram2", 1, 32, 15, HistogramBase::kNoFlags
));
125 EXPECT_TRUE(ranges2
.Equals(histogram2
->bucket_ranges()));
128 TEST_F(HistogramTest
, LinearRangesTest
) {
129 BucketRanges
ranges(9);
130 LinearHistogram::InitializeBucketRanges(1, 7, &ranges
);
131 // Gets a nice linear set of bucket ranges.
132 for (int i
= 0; i
< 8; i
++)
133 EXPECT_EQ(i
, ranges
.range(i
));
134 EXPECT_EQ(HistogramBase::kSampleType_MAX
, ranges
.range(8));
136 // The correspoding LinearHistogram should use the correct ranges.
137 Histogram
* histogram
= static_cast<Histogram
*>(
138 LinearHistogram::FactoryGet("Linear", 1, 7, 8, HistogramBase::kNoFlags
));
139 EXPECT_TRUE(ranges
.Equals(histogram
->bucket_ranges()));
141 // Linear ranges are not divisible.
142 BucketRanges
ranges2(6);
143 LinearHistogram::InitializeBucketRanges(1, 6, &ranges2
);
144 EXPECT_EQ(0, ranges2
.range(0));
145 EXPECT_EQ(1, ranges2
.range(1));
146 EXPECT_EQ(3, ranges2
.range(2));
147 EXPECT_EQ(4, ranges2
.range(3));
148 EXPECT_EQ(6, ranges2
.range(4));
149 EXPECT_EQ(HistogramBase::kSampleType_MAX
, ranges2
.range(5));
150 // The correspoding LinearHistogram should use the correct ranges.
151 Histogram
* histogram2
= static_cast<Histogram
*>(
152 LinearHistogram::FactoryGet("Linear2", 1, 6, 5, HistogramBase::kNoFlags
));
153 EXPECT_TRUE(ranges2
.Equals(histogram2
->bucket_ranges()));
156 TEST_F(HistogramTest
, ArrayToCustomRangesTest
) {
157 const HistogramBase::Sample ranges
[3] = {5, 10, 20};
158 std::vector
<HistogramBase::Sample
> ranges_vec
=
159 CustomHistogram::ArrayToCustomRanges(ranges
, 3);
160 ASSERT_EQ(6u, ranges_vec
.size());
161 EXPECT_EQ(5, ranges_vec
[0]);
162 EXPECT_EQ(6, ranges_vec
[1]);
163 EXPECT_EQ(10, ranges_vec
[2]);
164 EXPECT_EQ(11, ranges_vec
[3]);
165 EXPECT_EQ(20, ranges_vec
[4]);
166 EXPECT_EQ(21, ranges_vec
[5]);
169 TEST_F(HistogramTest
, CustomHistogramTest
) {
170 // A well prepared custom ranges.
171 std::vector
<HistogramBase::Sample
> custom_ranges
;
172 custom_ranges
.push_back(1);
173 custom_ranges
.push_back(2);
175 Histogram
* histogram
= static_cast<Histogram
*>(
176 CustomHistogram::FactoryGet("TestCustomHistogram1", custom_ranges
,
177 HistogramBase::kNoFlags
));
178 const BucketRanges
* ranges
= histogram
->bucket_ranges();
179 ASSERT_EQ(4u, ranges
->size());
180 EXPECT_EQ(0, ranges
->range(0)); // Auto added.
181 EXPECT_EQ(1, ranges
->range(1));
182 EXPECT_EQ(2, ranges
->range(2));
183 EXPECT_EQ(HistogramBase::kSampleType_MAX
, ranges
->range(3)); // Auto added.
185 // A unordered custom ranges.
186 custom_ranges
.clear();
187 custom_ranges
.push_back(2);
188 custom_ranges
.push_back(1);
189 histogram
= static_cast<Histogram
*>(
190 CustomHistogram::FactoryGet("TestCustomHistogram2", custom_ranges
,
191 HistogramBase::kNoFlags
));
192 ranges
= histogram
->bucket_ranges();
193 ASSERT_EQ(4u, ranges
->size());
194 EXPECT_EQ(0, ranges
->range(0));
195 EXPECT_EQ(1, ranges
->range(1));
196 EXPECT_EQ(2, ranges
->range(2));
197 EXPECT_EQ(HistogramBase::kSampleType_MAX
, ranges
->range(3));
199 // A custom ranges with duplicated values.
200 custom_ranges
.clear();
201 custom_ranges
.push_back(4);
202 custom_ranges
.push_back(1);
203 custom_ranges
.push_back(4);
204 histogram
= static_cast<Histogram
*>(
205 CustomHistogram::FactoryGet("TestCustomHistogram3", custom_ranges
,
206 HistogramBase::kNoFlags
));
207 ranges
= histogram
->bucket_ranges();
208 ASSERT_EQ(4u, ranges
->size());
209 EXPECT_EQ(0, ranges
->range(0));
210 EXPECT_EQ(1, ranges
->range(1));
211 EXPECT_EQ(4, ranges
->range(2));
212 EXPECT_EQ(HistogramBase::kSampleType_MAX
, ranges
->range(3));
215 TEST_F(HistogramTest
, CustomHistogramWithOnly2Buckets
) {
216 // This test exploits the fact that the CustomHistogram can have 2 buckets,
217 // while the base class Histogram is *supposed* to have at least 3 buckets.
218 // We should probably change the restriction on the base class (or not inherit
221 std::vector
<HistogramBase::Sample
> custom_ranges
;
222 custom_ranges
.push_back(4);
224 Histogram
* histogram
= static_cast<Histogram
*>(
225 CustomHistogram::FactoryGet("2BucketsCustomHistogram", custom_ranges
,
226 HistogramBase::kNoFlags
));
227 const BucketRanges
* ranges
= histogram
->bucket_ranges();
228 ASSERT_EQ(3u, ranges
->size());
229 EXPECT_EQ(0, ranges
->range(0));
230 EXPECT_EQ(4, ranges
->range(1));
231 EXPECT_EQ(HistogramBase::kSampleType_MAX
, ranges
->range(2));
234 // Test the AddCount function.
235 TEST_F(HistogramTest
, AddCountTest
) {
236 const size_t kBucketCount
= 50;
237 Histogram
* histogram
= static_cast<Histogram
*>(
238 Histogram::FactoryGet("AddCountHistogram", 10, 100, kBucketCount
,
239 HistogramBase::kNoFlags
));
241 histogram
->AddCount(20, 15);
242 histogram
->AddCount(30, 14);
244 scoped_ptr
<SampleVector
> samples
= histogram
->SnapshotSampleVector();
245 EXPECT_EQ(29, samples
->TotalCount());
246 EXPECT_EQ(15, samples
->GetCount(20));
247 EXPECT_EQ(14, samples
->GetCount(30));
249 histogram
->AddCount(20, 25);
250 histogram
->AddCount(30, 24);
252 scoped_ptr
<SampleVector
> samples2
= histogram
->SnapshotSampleVector();
253 EXPECT_EQ(78, samples2
->TotalCount());
254 EXPECT_EQ(40, samples2
->GetCount(20));
255 EXPECT_EQ(38, samples2
->GetCount(30));
258 // Make sure histogram handles out-of-bounds data gracefully.
259 TEST_F(HistogramTest
, BoundsTest
) {
260 const size_t kBucketCount
= 50;
261 Histogram
* histogram
= static_cast<Histogram
*>(
262 Histogram::FactoryGet("Bounded", 10, 100, kBucketCount
,
263 HistogramBase::kNoFlags
));
265 // Put two samples "out of bounds" above and below.
270 histogram
->Add(10000);
272 // Verify they landed in the underflow, and overflow buckets.
273 scoped_ptr
<SampleVector
> samples
= histogram
->SnapshotSampleVector();
274 EXPECT_EQ(2, samples
->GetCountAtIndex(0));
275 EXPECT_EQ(0, samples
->GetCountAtIndex(1));
276 size_t array_size
= histogram
->bucket_count();
277 EXPECT_EQ(kBucketCount
, array_size
);
278 EXPECT_EQ(0, samples
->GetCountAtIndex(array_size
- 2));
279 EXPECT_EQ(2, samples
->GetCountAtIndex(array_size
- 1));
281 std::vector
<int> custom_ranges
;
282 custom_ranges
.push_back(10);
283 custom_ranges
.push_back(50);
284 custom_ranges
.push_back(100);
285 Histogram
* test_custom_histogram
= static_cast<Histogram
*>(
286 CustomHistogram::FactoryGet("TestCustomRangeBoundedHistogram",
287 custom_ranges
, HistogramBase::kNoFlags
));
289 // Put two samples "out of bounds" above and below.
290 test_custom_histogram
->Add(5);
291 test_custom_histogram
->Add(-50);
292 test_custom_histogram
->Add(100);
293 test_custom_histogram
->Add(1000);
294 test_custom_histogram
->Add(INT_MAX
);
296 // Verify they landed in the underflow, and overflow buckets.
297 scoped_ptr
<SampleVector
> custom_samples
=
298 test_custom_histogram
->SnapshotSampleVector();
299 EXPECT_EQ(2, custom_samples
->GetCountAtIndex(0));
300 EXPECT_EQ(0, custom_samples
->GetCountAtIndex(1));
301 size_t bucket_count
= test_custom_histogram
->bucket_count();
302 EXPECT_EQ(0, custom_samples
->GetCountAtIndex(bucket_count
- 2));
303 EXPECT_EQ(3, custom_samples
->GetCountAtIndex(bucket_count
- 1));
306 // Check to be sure samples land as expected is "correct" buckets.
307 TEST_F(HistogramTest
, BucketPlacementTest
) {
308 Histogram
* histogram
= static_cast<Histogram
*>(
309 Histogram::FactoryGet("Histogram", 1, 64, 8, HistogramBase::kNoFlags
));
311 // Add i+1 samples to the i'th bucket.
314 for (int i
= 1; i
< 8; i
++) {
315 for (int j
= 0; j
<= i
; j
++)
316 histogram
->Add(power_of_2
);
320 // Check to see that the bucket counts reflect our additions.
321 scoped_ptr
<SampleVector
> samples
= histogram
->SnapshotSampleVector();
322 for (int i
= 0; i
< 8; i
++)
323 EXPECT_EQ(i
+ 1, samples
->GetCountAtIndex(i
));
326 TEST_F(HistogramTest
, CorruptSampleCounts
) {
327 Histogram
* histogram
= static_cast<Histogram
*>(
328 Histogram::FactoryGet("Histogram", 1, 64, 8, HistogramBase::kNoFlags
));
334 scoped_ptr
<SampleVector
> snapshot
= histogram
->SnapshotSampleVector();
335 EXPECT_EQ(HistogramBase::NO_INCONSISTENCIES
,
336 histogram
->FindCorruption(*snapshot
));
337 EXPECT_EQ(2, snapshot
->redundant_count());
338 EXPECT_EQ(2, snapshot
->TotalCount());
340 snapshot
->counts_
[3] += 100; // Sample count won't match redundant count.
341 EXPECT_EQ(HistogramBase::COUNT_LOW_ERROR
,
342 histogram
->FindCorruption(*snapshot
));
343 snapshot
->counts_
[2] -= 200;
344 EXPECT_EQ(HistogramBase::COUNT_HIGH_ERROR
,
345 histogram
->FindCorruption(*snapshot
));
347 // But we can't spot a corruption if it is compensated for.
348 snapshot
->counts_
[1] += 100;
349 EXPECT_EQ(HistogramBase::NO_INCONSISTENCIES
,
350 histogram
->FindCorruption(*snapshot
));
353 TEST_F(HistogramTest
, CorruptBucketBounds
) {
354 Histogram
* histogram
= static_cast<Histogram
*>(
355 Histogram::FactoryGet("Histogram", 1, 64, 8, HistogramBase::kNoFlags
));
357 scoped_ptr
<SampleVector
> snapshot
= histogram
->SnapshotSampleVector();
358 EXPECT_EQ(HistogramBase::NO_INCONSISTENCIES
,
359 histogram
->FindCorruption(*snapshot
));
361 BucketRanges
* bucket_ranges
=
362 const_cast<BucketRanges
*>(histogram
->bucket_ranges());
363 HistogramBase::Sample tmp
= bucket_ranges
->range(1);
364 bucket_ranges
->set_range(1, bucket_ranges
->range(2));
365 bucket_ranges
->set_range(2, tmp
);
367 HistogramBase::BUCKET_ORDER_ERROR
| HistogramBase::RANGE_CHECKSUM_ERROR
,
368 histogram
->FindCorruption(*snapshot
));
370 bucket_ranges
->set_range(2, bucket_ranges
->range(1));
371 bucket_ranges
->set_range(1, tmp
);
372 EXPECT_EQ(0, histogram
->FindCorruption(*snapshot
));
374 // Show that two simple changes don't offset each other
375 bucket_ranges
->set_range(3, bucket_ranges
->range(3) + 1);
376 EXPECT_EQ(HistogramBase::RANGE_CHECKSUM_ERROR
,
377 histogram
->FindCorruption(*snapshot
));
379 bucket_ranges
->set_range(4, bucket_ranges
->range(4) - 1);
380 EXPECT_EQ(HistogramBase::RANGE_CHECKSUM_ERROR
,
381 histogram
->FindCorruption(*snapshot
));
383 // Repair histogram so that destructor won't DCHECK().
384 bucket_ranges
->set_range(3, bucket_ranges
->range(3) - 1);
385 bucket_ranges
->set_range(4, bucket_ranges
->range(4) + 1);
388 TEST_F(HistogramTest
, HistogramSerializeInfo
) {
389 Histogram
* histogram
= static_cast<Histogram
*>(
390 Histogram::FactoryGet("Histogram", 1, 64, 8,
391 HistogramBase::kIPCSerializationSourceFlag
));
393 histogram
->SerializeInfo(&pickle
);
395 PickleIterator
iter(pickle
);
398 EXPECT_TRUE(iter
.ReadInt(&type
));
399 EXPECT_EQ(HISTOGRAM
, type
);
402 EXPECT_TRUE(iter
.ReadString(&name
));
403 EXPECT_EQ("Histogram", name
);
406 EXPECT_TRUE(iter
.ReadInt(&flag
));
407 EXPECT_EQ(HistogramBase::kIPCSerializationSourceFlag
, flag
);
410 EXPECT_TRUE(iter
.ReadInt(&min
));
414 EXPECT_TRUE(iter
.ReadInt(&max
));
418 EXPECT_TRUE(iter
.ReadInt64(&bucket_count
));
419 EXPECT_EQ(8, bucket_count
);
422 EXPECT_TRUE(iter
.ReadUInt32(&checksum
));
423 EXPECT_EQ(histogram
->bucket_ranges()->checksum(), checksum
);
425 // No more data in the pickle.
426 EXPECT_FALSE(iter
.SkipBytes(1));
429 TEST_F(HistogramTest
, CustomHistogramSerializeInfo
) {
430 std::vector
<int> custom_ranges
;
431 custom_ranges
.push_back(10);
432 custom_ranges
.push_back(100);
434 HistogramBase
* custom_histogram
= CustomHistogram::FactoryGet(
435 "TestCustomRangeBoundedHistogram",
437 HistogramBase::kNoFlags
);
439 custom_histogram
->SerializeInfo(&pickle
);
441 // Validate the pickle.
442 PickleIterator
iter(pickle
);
448 EXPECT_TRUE(iter
.ReadInt(&i
) && iter
.ReadString(&s
) && iter
.ReadInt(&i
) &&
449 iter
.ReadInt(&i
) && iter
.ReadInt(&i
) &&
450 iter
.ReadInt64(&bucket_count
) && iter
.ReadUInt32(&ui32
));
451 EXPECT_EQ(3, bucket_count
);
454 EXPECT_TRUE(iter
.ReadInt(&range
));
455 EXPECT_EQ(10, range
);
456 EXPECT_TRUE(iter
.ReadInt(&range
));
457 EXPECT_EQ(100, range
);
459 // No more data in the pickle.
460 EXPECT_FALSE(iter
.SkipBytes(1));
463 TEST_F(HistogramTest
, BadConstruction
) {
464 HistogramBase
* histogram
= Histogram::FactoryGet(
465 "BadConstruction", 0, 100, 8, HistogramBase::kNoFlags
);
466 EXPECT_TRUE(histogram
->HasConstructionArguments(1, 100, 8));
468 // Try to get the same histogram name with different arguments.
469 HistogramBase
* bad_histogram
= Histogram::FactoryGet(
470 "BadConstruction", 0, 100, 7, HistogramBase::kNoFlags
);
471 EXPECT_EQ(NULL
, bad_histogram
);
472 bad_histogram
= Histogram::FactoryGet(
473 "BadConstruction", 0, 99, 8, HistogramBase::kNoFlags
);
474 EXPECT_EQ(NULL
, bad_histogram
);
476 HistogramBase
* linear_histogram
= LinearHistogram::FactoryGet(
477 "BadConstructionLinear", 0, 100, 8, HistogramBase::kNoFlags
);
478 EXPECT_TRUE(linear_histogram
->HasConstructionArguments(1, 100, 8));
480 // Try to get the same histogram name with different arguments.
481 bad_histogram
= LinearHistogram::FactoryGet(
482 "BadConstructionLinear", 0, 100, 7, HistogramBase::kNoFlags
);
483 EXPECT_EQ(NULL
, bad_histogram
);
484 bad_histogram
= LinearHistogram::FactoryGet(
485 "BadConstructionLinear", 10, 100, 8, HistogramBase::kNoFlags
);
486 EXPECT_EQ(NULL
, bad_histogram
);
489 #if GTEST_HAS_DEATH_TEST
490 // For Histogram, LinearHistogram and CustomHistogram, the minimum for a
491 // declared range is 1, while the maximum is (HistogramBase::kSampleType_MAX -
492 // 1). But we accept ranges exceeding those limits, and silently clamped to
493 // those limits. This is for backwards compatibility.
494 TEST(HistogramDeathTest
, BadRangesTest
) {
495 HistogramBase
* histogram
= Histogram::FactoryGet(
496 "BadRanges", 0, HistogramBase::kSampleType_MAX
, 8,
497 HistogramBase::kNoFlags
);
499 histogram
->HasConstructionArguments(
500 1, HistogramBase::kSampleType_MAX
- 1, 8));
502 HistogramBase
* linear_histogram
= LinearHistogram::FactoryGet(
503 "BadRangesLinear", 0, HistogramBase::kSampleType_MAX
, 8,
504 HistogramBase::kNoFlags
);
506 linear_histogram
->HasConstructionArguments(
507 1, HistogramBase::kSampleType_MAX
- 1, 8));
509 std::vector
<int> custom_ranges
;
510 custom_ranges
.push_back(0);
511 custom_ranges
.push_back(5);
512 Histogram
* custom_histogram
= static_cast<Histogram
*>(
513 CustomHistogram::FactoryGet(
514 "BadRangesCustom", custom_ranges
, HistogramBase::kNoFlags
));
515 const BucketRanges
* ranges
= custom_histogram
->bucket_ranges();
516 ASSERT_EQ(3u, ranges
->size());
517 EXPECT_EQ(0, ranges
->range(0));
518 EXPECT_EQ(5, ranges
->range(1));
519 EXPECT_EQ(HistogramBase::kSampleType_MAX
, ranges
->range(2));
521 // CustomHistogram does not accepts kSampleType_MAX as range.
522 custom_ranges
.push_back(HistogramBase::kSampleType_MAX
);
523 EXPECT_DEATH(CustomHistogram::FactoryGet("BadRangesCustom2", custom_ranges
,
524 HistogramBase::kNoFlags
),
527 // CustomHistogram needs at least 1 valid range.
528 custom_ranges
.clear();
529 custom_ranges
.push_back(0);
530 EXPECT_DEATH(CustomHistogram::FactoryGet("BadRangesCustom3", custom_ranges
,
531 HistogramBase::kNoFlags
),