Embed a single sample in histogram metadata

Desktop / Chromium - bcwhite [chromium.org] - 21 April 2017 14:58 EDT

This uses the new DelayedPersistentAllocation to avoid allocating the full "counts" array when only one value is being stored. That one
value is kept in the HistogramSamples metadata. When a second value is recorded, the counts-array is created and the single-sample is moved; it is there-after unused.

This change only affects SampleVector. A future change may add the same support for PersistentSampleMap.

A quick test shows persistent memory use is reduced by 44% (from 924 KiB to 512 KiB) after a clean start and the loading of three pages: chrome://histograms https://www.google.com/ chrome://histograms (again)

BUG=705342

Review-Url: https://codereview.chromium.org/2811713003 Cr-Commit-Position: refs/heads/master@{#466401}

4162baf Embed a single sample in histogram metadata.
base/metrics/histogram.cc | 124 ++++-----
base/metrics/histogram.h | 46 ++--
base/metrics/histogram_samples.cc | 181 +++++++++++--
base/metrics/histogram_samples.h | 119 ++++++++-
base/metrics/histogram_unittest.cc | 6 +-
base/metrics/persistent_histogram_allocator.cc | 53 ++--
base/metrics/persistent_sample_map.cc | 3 +-
base/metrics/sample_map.cc | 3 +-
base/metrics/sample_vector.cc | 349 ++++++++++++++++++++-----
base/metrics/sample_vector.h | 114 ++++++--
base/metrics/sample_vector_unittest.cc | 275 ++++++++++++++++++-
11 files changed, 1044 insertions(+), 229 deletions(-)

Upstream: git.chromium.org


  • Share