Lines Matching refs:Histogram
5 // Test of Histogram class
14 #include "base/metrics/histogram.h"
28 // Each test will have a clean state (no Histogram / BucketRanges
52 HistogramBase* histogram = Histogram::FactoryGet(
54 EXPECT_TRUE(histogram);
79 HistogramBase* histogram = LinearHistogram::FactoryGet(
82 scoped_ptr<HistogramSamples> samples = histogram->SnapshotSamples();
90 Histogram::InitializeBucketRanges(1, 64, &ranges);
99 // Check the corresponding Histogram will use the correct ranges.
100 Histogram* histogram = static_cast<Histogram*>(
101 Histogram::FactoryGet("Histogram", 1, 64, 8, HistogramBase::kNoFlags));
102 EXPECT_TRUE(ranges.Equals(histogram->bucket_ranges()));
107 Histogram::InitializeBucketRanges(1, 32, &ranges2);
126 // Check the corresponding Histogram will use the correct ranges.
127 Histogram* histogram2 = static_cast<Histogram*>(
128 Histogram::FactoryGet("Histogram2", 1, 32, 15, HistogramBase::kNoFlags));
141 Histogram* histogram = static_cast<Histogram*>(
143 EXPECT_TRUE(ranges.Equals(histogram->bucket_ranges()));
155 Histogram* histogram2 = static_cast<Histogram*>(
179 Histogram* histogram = static_cast<Histogram*>(
182 const BucketRanges* ranges = histogram->bucket_ranges();
193 histogram = static_cast<Histogram*>(
196 ranges = histogram->bucket_ranges();
208 histogram = static_cast<Histogram*>(
211 ranges = histogram->bucket_ranges();
221 // while the base class Histogram is *supposed* to have at least 3 buckets.
228 Histogram* histogram = static_cast<Histogram*>(
231 const BucketRanges* ranges = histogram->bucket_ranges();
238 // Make sure histogram handles out-of-bounds data gracefully.
241 Histogram* histogram = static_cast<Histogram*>(
242 Histogram::FactoryGet("Bounded", 10, 100, kBucketCount,
246 histogram->Add(5);
247 histogram->Add(-50);
249 histogram->Add(100);
250 histogram->Add(10000);
253 scoped_ptr<SampleVector> samples = histogram->SnapshotSampleVector();
256 size_t array_size = histogram->bucket_count();
265 Histogram* test_custom_histogram = static_cast<Histogram*>(
288 Histogram* histogram = static_cast<Histogram*>(
289 Histogram::FactoryGet("Histogram", 1, 64, 8, HistogramBase::kNoFlags));
292 histogram->Add(0);
296 histogram->Add(power_of_2);
301 scoped_ptr<SampleVector> samples = histogram->SnapshotSampleVector();
307 Histogram* histogram = static_cast<Histogram*>(
308 Histogram::FactoryGet("Histogram", 1, 64, 8, HistogramBase::kNoFlags));
311 histogram->Add(20);
312 histogram->Add(40);
314 scoped_ptr<SampleVector> snapshot = histogram->SnapshotSampleVector();
316 histogram->FindCorruption(*snapshot));
322 histogram->FindCorruption(*snapshot));
325 histogram->FindCorruption(*snapshot));
330 histogram->FindCorruption(*snapshot));
334 Histogram* histogram = static_cast<Histogram*>(
335 Histogram::FactoryGet("Histogram", 1, 64, 8, HistogramBase::kNoFlags));
337 scoped_ptr<SampleVector> snapshot = histogram->SnapshotSampleVector();
339 histogram->FindCorruption(*snapshot));
342 const_cast<BucketRanges*>(histogram->bucket_ranges());
348 histogram->FindCorruption(*snapshot));
352 EXPECT_EQ(0, histogram->FindCorruption(*snapshot));
357 histogram->FindCorruption(*snapshot));
361 histogram->FindCorruption(*snapshot));
363 // Repair histogram so that destructor won't DCHECK().
369 Histogram* histogram = static_cast<Histogram*>(
370 Histogram::FactoryGet("Histogram", 1, 64, 8,
373 histogram->SerializeInfo(&pickle);
379 EXPECT_EQ(HISTOGRAM, type);
383 EXPECT_EQ("Histogram", name);
403 EXPECT_EQ(histogram->bucket_ranges()->checksum(), checksum);
444 HistogramBase* histogram = Histogram::FactoryGet(
446 EXPECT_TRUE(histogram->HasConstructionArguments(1, 100, 8));
448 // Try to get the same histogram name with different arguments.
449 HistogramBase* bad_histogram = Histogram::FactoryGet(
452 bad_histogram = Histogram::FactoryGet(
460 // Try to get the same histogram name with different arguments.
470 // For Histogram, LinearHistogram and CustomHistogram, the minimum for a
475 HistogramBase* histogram = Histogram::FactoryGet(
479 histogram->HasConstructionArguments(
492 Histogram* custom_histogram = static_cast<Histogram*>(