Commit 4eb39392 authored by Brian White's avatar Brian White Committed by Commit Bot

Check theory that entire mmap page is getting zeroed.

This is a temporary change that will be reverted once crashes can be
analyzed to confirm the working theory.

Bug: 836875
Change-Id: Iaeffbd6c78b604af66b33991392990d71648d4a9
Reviewed-on: https://chromium-review.googlesource.com/1050071
Commit-Queue: Brian White <bcwhite@chromium.org>
Reviewed-by: default avatarAlexei Svitkine <asvitkine@chromium.org>
Cr-Commit-Position: refs/heads/master@{#557159}
parent fe80a89d
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/synchronization/lock.h" #include "base/synchronization/lock.h"
#include "base/sys_info.h"
#include "base/values.h" #include "base/values.h"
#include "build/build_config.h" #include "build/build_config.h"
...@@ -548,6 +549,34 @@ void Histogram::ValidateHistogramContents() const { ...@@ -548,6 +549,34 @@ void Histogram::ValidateHistogramContents() const {
CHECK(unlogged_samples_->bucket_ranges()); CHECK(unlogged_samples_->bucket_ranges());
CHECK(logged_samples_); CHECK(logged_samples_);
CHECK(logged_samples_->bucket_ranges()); CHECK(logged_samples_->bucket_ranges());
#if !defined(OS_NACL)
if (0U == logged_samples_->id() && (flags() & kIsPersistent)) {
// ID should never be zero. If it is, then it's probably because the
// entire memory page was cleared. Check that this is true.
// TODO(bcwhite): Remove this.
// https://bugs.chromium.org/p/chromium/issues/detail?id=836875
const size_t page_size = SysInfo::VMAllocationGranularity();
const int* address = reinterpret_cast<const int*>(
reinterpret_cast<uintptr_t>(logged_samples_->meta()) &
~(page_size - 1));
// Check a couple places so there is evidence in a crash report as to
// where it was non-zero.
CHECK_EQ(0, address[0]);
CHECK_EQ(0, address[1]);
CHECK_EQ(0, address[2]);
CHECK_EQ(0, address[4]);
CHECK_EQ(0, address[8]);
CHECK_EQ(0, address[16]);
CHECK_EQ(0, address[32]);
CHECK_EQ(0, address[64]);
CHECK_EQ(0, address[128]);
CHECK_EQ(0, address[256]);
CHECK_EQ(0, address[512]);
// Now check every address.
for (size_t i = 0; i < page_size / sizeof(int); ++i)
CHECK_EQ(0, address[i]);
}
#endif
CHECK_NE(0U, logged_samples_->id()); CHECK_NE(0U, logged_samples_->id());
} }
......
...@@ -159,6 +159,11 @@ class BASE_EXPORT HistogramSamples { ...@@ -159,6 +159,11 @@ class BASE_EXPORT HistogramSamples {
return subtle::NoBarrier_Load(&meta_->redundant_count); return subtle::NoBarrier_Load(&meta_->redundant_count);
} }
// Temporarily visible for crash debugging. Should be protected.
// TODO(bcwhite): Move this back where it belongs.
// https://bugs.chromium.org/p/chromium/issues/detail?id=836875
Metadata* meta() { return meta_; }
protected: protected:
enum NegativeSampleReason { enum NegativeSampleReason {
SAMPLES_HAVE_LOGGED_BUT_NOT_SAMPLE, SAMPLES_HAVE_LOGGED_BUT_NOT_SAMPLE,
...@@ -196,8 +201,6 @@ class BASE_EXPORT HistogramSamples { ...@@ -196,8 +201,6 @@ class BASE_EXPORT HistogramSamples {
return meta_->single_sample; return meta_->single_sample;
} }
Metadata* meta() { return meta_; }
private: private:
// Depending on derived class meta values can come from local stoarge or // Depending on derived class meta values can come from local stoarge or
// external storage in which case HistogramSamples class cannot take ownership // external storage in which case HistogramSamples class cannot take ownership
......
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