Commit 0e1f2bca authored by Brian White's avatar Brian White Committed by Commit Bot

Remove mismatch test code for branch point.

The code checking for problemating floating point math should not be
part of the M72 beta/stable releases so removing it for now.  It will
likely be restored in some form after the branch occurs.

Bug: 836238
Change-Id: Id6f95382589de7e3d5a05cefa09087e2e598e4ad
Reviewed-on: https://chromium-review.googlesource.com/c/1351091Reviewed-by: default avatarAlexei Svitkine <asvitkine@chromium.org>
Commit-Queue: Brian White <bcwhite@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610977}
parent f0393509
...@@ -166,91 +166,10 @@ HistogramBase* Histogram::Factory::Build() { ...@@ -166,91 +166,10 @@ 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();
CHECK(created_ranges->HasValidChecksum()) << name_;
// 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());
// Most histograms have 50 buckets plus underflow and overflow.
const size_t capture_boundaries = 52;
Sample created_boundaries[capture_boundaries];
Sample recreated_boundaries[capture_boundaries];
for (uint32_t i = 0; i < bucket_count_ && i < capture_boundaries; ++i) {
created_boundaries[i] = created_ranges->range(i);
recreated_boundaries[i] = recreated_ranges->range(i);
}
debug::Alias(created_boundaries);
debug::Alias(recreated_boundaries);
for (uint32_t i = 0; i < bucket_count_; ++i) {
Sample created_range = created_ranges->range(i);
Sample recreated_range = recreated_ranges->range(i);
debug::Alias(&created_range);
debug::Alias(&recreated_range);
if (created_range != recreated_range ||
(i == bucket_count_ - 1 && created_range != maximum_)) {
// 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 b_count = bucket_count_;
size_t c_count = created_ranges->size() - 1;
size_t r_count = recreated_ranges->size() - 1;
bool c_valid = created_ranges->HasValidChecksum();
bool r_valid = recreated_ranges->HasValidChecksum();
CHECK(recreated_ranges->Equals(created_ranges)) << name_;
debug::Alias(&h_type);
debug::Alias(&h_min);
debug::Alias(&h_max);
debug::Alias(&b_count);
debug::Alias(&c_count);
debug::Alias(&r_count);
debug::Alias(&c_valid);
debug::Alias(&r_valid);
CHECK(false) << name_;
}
}
CHECK(recreated_ranges->Equals(created_ranges));
#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.
bool using_created_ranges = (registered_ranges == created_ranges);
bool equal_ranges = registered_ranges->Equals(recreated_ranges.get());
debug::Alias(&using_created_ranges);
debug::Alias(&equal_ranges);
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);
debug::Alias(&created_range);
debug::Alias(&registered_range);
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() - 1;
size_t r_count = registered_ranges->size() - 1;
bool c_valid = recreated_ranges->HasValidChecksum();
bool r_valid = registered_ranges->HasValidChecksum();
CHECK(recreated_ranges->Equals(registered_ranges)) << name_;
debug::Alias(&h_type);
debug::Alias(&b_count);
debug::Alias(&c_count);
debug::Alias(&r_count);
debug::Alias(&c_valid);
debug::Alias(&r_valid);
CHECK(false) << name_;
}
}
CHECK(recreated_ranges->Equals(registered_ranges));
#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
...@@ -419,23 +338,9 @@ void Histogram::InitializeBucketRanges(Sample minimum, ...@@ -419,23 +338,9 @@ void Histogram::InitializeBucketRanges(Sample minimum,
ranges->set_range(bucket_index, current); ranges->set_range(bucket_index, current);
size_t bucket_count = ranges->bucket_count(); size_t bucket_count = ranges->bucket_count();
// Temporary for https://crbug.com/836238
double log_max_copy = log_max;
debug::Alias(&log_max_copy);
CHECK_EQ(maximum, static_cast<Sample>(std::round(exp(log_max_copy))));
uint32_t checksum = static_cast<uint32_t>(bucket_count + 1);
checksum = Crc32(checksum, 0);
checksum = Crc32(checksum, current);
debug::Alias(&minimum);
debug::Alias(&maximum);
debug::Alias(&bucket_count);
debug::Alias(&checksum);
debug::Alias(&current);
while (bucket_count > ++bucket_index) { while (bucket_count > ++bucket_index) {
double log_current; double log_current;
log_current = log(static_cast<double>(current)); log_current = log(static_cast<double>(current));
CHECK_EQ(current, static_cast<Sample>(std::round(exp(log_current))));
debug::Alias(&log_current); debug::Alias(&log_current);
// Calculate the count'th root of the range. // Calculate the count'th root of the range.
log_ratio = (log_max - log_current) / (bucket_count - bucket_index); log_ratio = (log_max - log_current) / (bucket_count - bucket_index);
...@@ -448,15 +353,9 @@ void Histogram::InitializeBucketRanges(Sample minimum, ...@@ -448,15 +353,9 @@ void Histogram::InitializeBucketRanges(Sample minimum,
else else
++current; // Just do a narrow bucket, and keep trying. ++current; // Just do a narrow bucket, and keep trying.
ranges->set_range(bucket_index, current); ranges->set_range(bucket_index, current);
checksum = Crc32(checksum, current);
} }
ranges->set_range(ranges->bucket_count(), HistogramBase::kSampleType_MAX); ranges->set_range(ranges->bucket_count(), HistogramBase::kSampleType_MAX);
ranges->ResetChecksum(); ranges->ResetChecksum();
checksum = Crc32(checksum, HistogramBase::kSampleType_MAX);
CHECK_EQ(checksum, ranges->checksum());
log_max_copy = log_max;
debug::Alias(&log_max_copy);
CHECK_EQ(maximum, static_cast<Sample>(std::round(exp(log_max_copy))));
} }
// static // static
...@@ -1102,32 +1001,14 @@ void LinearHistogram::InitializeBucketRanges(Sample minimum, ...@@ -1102,32 +1001,14 @@ void LinearHistogram::InitializeBucketRanges(Sample minimum,
double max = maximum; double max = maximum;
size_t bucket_count = ranges->bucket_count(); size_t bucket_count = ranges->bucket_count();
// Temporary for https://crbug.com/836238
bool is_enum = (minimum == 1 &&
static_cast<Sample>(bucket_count) == maximum - minimum + 2);
uint32_t checksum = static_cast<uint32_t>(bucket_count + 1);
checksum = Crc32(checksum, 0);
debug::Alias(&minimum);
debug::Alias(&maximum);
debug::Alias(&min);
debug::Alias(&max);
debug::Alias(&bucket_count);
debug::Alias(&checksum);
debug::Alias(&is_enum);
for (size_t i = 1; i < bucket_count; ++i) { for (size_t i = 1; i < bucket_count; ++i) {
double linear_range = double linear_range =
(min * (bucket_count - 1 - i) + max * (i - 1)) / (bucket_count - 2); (min * (bucket_count - 1 - i) + max * (i - 1)) / (bucket_count - 2);
uint32_t range = static_cast<Sample>(linear_range + 0.5); uint32_t range = static_cast<Sample>(linear_range + 0.5);
if (is_enum)
CHECK_EQ(static_cast<uint32_t>(i), range);
ranges->set_range(i, range); ranges->set_range(i, range);
checksum = Crc32(checksum, range);
} }
ranges->set_range(ranges->bucket_count(), HistogramBase::kSampleType_MAX); ranges->set_range(ranges->bucket_count(), HistogramBase::kSampleType_MAX);
ranges->ResetChecksum(); ranges->ResetChecksum();
checksum = Crc32(checksum, HistogramBase::kSampleType_MAX);
CHECK_EQ(checksum, ranges->checksum());
} }
// static // static
......
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