Commit 37a4f70b authored by Brian White's avatar Brian White Committed by Commit Bot

Field-check ranges creation.

Check if the original ranges creation is causing the bad bucket
values or if its some kind of corruption since the last time.

Bug: 836238
Change-Id: I5b2b72504b6ac6437a9cec3ee42ae7e688be451b
Reviewed-on: https://chromium-review.googlesource.com/1234215Reviewed-by: default avatarAlexei Svitkine <asvitkine@chromium.org>
Commit-Queue: Brian White <bcwhite@chromium.org>
Cr-Commit-Position: refs/heads/master@{#592484}
parent 09a198c9
...@@ -168,9 +168,56 @@ HistogramBase* Histogram::Factory::Build() { ...@@ -168,9 +168,56 @@ HistogramBase* Histogram::Factory::Build() {
return DummyHistogram::GetInstance(); return DummyHistogram::GetInstance();
// To avoid racy destruction at shutdown, the following will be leaked. // To avoid racy destruction at shutdown, the following will be leaked.
const BucketRanges* created_ranges = CreateRanges(); const BucketRanges* created_ranges = CreateRanges();
// Temporary check for https://crbug.com/836238
#if defined(OS_WIN) // Only Windows has a debugger that makes this useful.
if (bucket_count_ > 0 &&
maximum_ != created_ranges->range(bucket_count_ - 1)) {
// Create local copies of the parameters to be sure they'll be available
// in the crash dump for the debugger to see.
DEBUG_ALIAS_FOR_CSTR(h_name, name_.c_str(), 100);
HistogramType h_type = histogram_type_;
Sample h_min = minimum_;
Sample h_max = maximum_;
uint32_t h_count = bucket_count_;
debug::Alias(&h_type);
debug::Alias(&h_min);
debug::Alias(&h_max);
debug::Alias(&h_count);
uint32_t ranges_min = created_ranges->range(1);
uint32_t ranges_max = created_ranges->range(bucket_count_ - 1);
debug::Alias(&ranges_min);
debug::Alias(&ranges_max);
CHECK(false) << name_;
}
#endif
const BucketRanges* registered_ranges = const BucketRanges* registered_ranges =
StatisticsRecorder::RegisterOrDeleteDuplicateRanges(created_ranges); StatisticsRecorder::RegisterOrDeleteDuplicateRanges(created_ranges);
// Temporary check for https://crbug.com/836238
#if defined(OS_WIN) // Only Windows has a debugger that makes this useful.
std::unique_ptr<const BucketRanges> recreated_ranges(CreateRanges());
for (uint32_t i = 0; i < bucket_count_; ++i) {
uint32_t created_range = recreated_ranges->range(i);
uint32_t registered_range = registered_ranges->range(i);
if (created_range != registered_range) {
// Create local copies of the parameters to be sure they'll be available
// in the crash dump for the debugger to see.
DEBUG_ALIAS_FOR_CSTR(h_name, name_.c_str(), 100);
HistogramType h_type = histogram_type_;
uint32_t b_count = bucket_count_;
size_t c_count = recreated_ranges->size();
size_t r_count = registered_ranges->size();
debug::Alias(&h_type);
debug::Alias(&b_count);
debug::Alias(&c_count);
debug::Alias(&r_count);
CHECK(false) << name_;
}
}
#endif
// In most cases, the bucket-count, minimum, and maximum values are known // In most cases, the bucket-count, minimum, and maximum values are known
// when the code is written and so are passed in explicitly. In other // when the code is written and so are passed in explicitly. In other
// cases (such as with a CustomHistogram), they are calculated dynamically // cases (such as with a CustomHistogram), they are calculated dynamically
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment