Remove HistogramBase::Sample type.
Rename HistogramBase::Sample to Sample32. Add size to type name so the size is known without needing to lookup the typedef. Bug: 40899968 Change-Id: Id26bae46a516d62034570f4614779497810836f4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6171182 Commit-Queue: Ramon Cano Aparicio <rcanoaparicio@google.com> Reviewed-by: Xiaoqian Dai <xdai@chromium.org> Reviewed-by: Alexei Svitkine <asvitkine@chromium.org> Reviewed-by: Vigen Issahhanjan <vigeni@google.com> Reviewed-by: Alexander Timin <altimin@chromium.org> Reviewed-by: Finnur Thorarinsson <finnur@chromium.org> Reviewed-by: Colin Blundell <blundell@chromium.org> Cr-Commit-Position: refs/heads/main@{#1408608}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
2cb2ff35bc
commit
4a39d12c4e
ash/wm
base
metrics
dummy_histogram.ccdummy_histogram.hhistogram.cchistogram.hhistogram_base.cchistogram_base.hhistogram_base_unittest.cchistogram_samples.hhistogram_threadsafe_unittest.ccpersistent_histogram_allocator.ccpersistent_sample_map.hsample_map_iterator.hsingle_sample_metrics.ccsparse_histogram.hsparse_histogram_unittest.cc
test
metrics
cc
base
metrics
chrome
browser
about_flags_unittest.ccchrome_back_forward_cache_browsertest.cc
page_load_metrics
integration_tests
printing
ui
installer
setup
chromecast
components/segmentation_platform/internal/signals
content/browser
extensions/browser/api/metrics_private
gpu/ipc/client
media/midi
services
network
tracing
public
cpp
third_party/blink/renderer
bindings
core
controller
core
frame
page
modules
indexeddb
service_worker
storage
platform
graphics
image-decoders
instrumentation
widget
ui/display/util
@ -44,7 +44,7 @@
|
||||
namespace ash {
|
||||
|
||||
using ::chromeos::WindowStateType;
|
||||
using Sample = base::HistogramBase::Sample;
|
||||
using Sample32 = base::HistogramBase::Sample32;
|
||||
|
||||
class PipWindowResizerTest : public AshTestBase,
|
||||
public ::testing::WithParamInterface<
|
||||
@ -663,7 +663,7 @@ TEST_P(PipWindowResizerTest, PipStartAndFinishFreeResizeUmaMetrics) {
|
||||
ASSERT_TRUE(resizer.get());
|
||||
|
||||
EXPECT_EQ(1, histograms().GetBucketCount(kAshPipEventsHistogramName,
|
||||
Sample(AshPipEvents::FREE_RESIZE)));
|
||||
Sample32(AshPipEvents::FREE_RESIZE)));
|
||||
histograms().ExpectTotalCount(kAshPipEventsHistogramName, 1);
|
||||
|
||||
resizer->Drag(CalculateDragPoint(*resizer, 100, 0), 0);
|
||||
@ -686,7 +686,7 @@ TEST_P(PipWindowResizerTest, PipPinchResizeTriggersResizeUmaMetrics) {
|
||||
Shell::Get()->toplevel_window_event_handler()->OnGestureEvent(&event);
|
||||
|
||||
EXPECT_EQ(1, histograms().GetBucketCount(kAshPipEventsHistogramName,
|
||||
Sample(AshPipEvents::FREE_RESIZE)));
|
||||
Sample32(AshPipEvents::FREE_RESIZE)));
|
||||
histograms().ExpectTotalCount(kAshPipEventsHistogramName, 1);
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ class AlwaysMaximizeTestState : public WindowState::State {
|
||||
|
||||
using WindowStateTest = AshTestBase;
|
||||
|
||||
using Sample = base::HistogramBase::Sample;
|
||||
using Sample32 = base::HistogramBase::Sample32;
|
||||
|
||||
// Test that a window gets properly snapped to the display's edges in a
|
||||
// multi monitor environment.
|
||||
@ -318,19 +318,19 @@ TEST_F(WindowStateTest, ChromePipWindowUmaMetrics) {
|
||||
window_state->OnWMEvent(&enter_pip);
|
||||
|
||||
EXPECT_EQ(1, histograms.GetBucketCount(kAshPipEventsHistogramName,
|
||||
Sample(AshPipEvents::PIP_START)));
|
||||
Sample32(AshPipEvents::PIP_START)));
|
||||
EXPECT_EQ(1,
|
||||
histograms.GetBucketCount(kAshPipEventsHistogramName,
|
||||
Sample(AshPipEvents::CHROME_PIP_START)));
|
||||
Sample32(AshPipEvents::CHROME_PIP_START)));
|
||||
histograms.ExpectTotalCount(kAshPipEventsHistogramName, 2);
|
||||
|
||||
const WMEvent enter_normal(WM_EVENT_NORMAL);
|
||||
window_state->OnWMEvent(&enter_normal);
|
||||
|
||||
EXPECT_EQ(1, histograms.GetBucketCount(kAshPipEventsHistogramName,
|
||||
Sample(AshPipEvents::PIP_END)));
|
||||
Sample32(AshPipEvents::PIP_END)));
|
||||
EXPECT_EQ(1, histograms.GetBucketCount(kAshPipEventsHistogramName,
|
||||
Sample(AshPipEvents::CHROME_PIP_END)));
|
||||
Sample32(AshPipEvents::CHROME_PIP_END)));
|
||||
histograms.ExpectTotalCount(kAshPipEventsHistogramName, 4);
|
||||
}
|
||||
|
||||
@ -345,20 +345,20 @@ TEST_F(WindowStateTest, AndroidPipWindowUmaMetrics) {
|
||||
window_state->OnWMEvent(&enter_pip);
|
||||
|
||||
EXPECT_EQ(1, histograms.GetBucketCount(kAshPipEventsHistogramName,
|
||||
Sample(AshPipEvents::PIP_START)));
|
||||
Sample32(AshPipEvents::PIP_START)));
|
||||
EXPECT_EQ(1,
|
||||
histograms.GetBucketCount(kAshPipEventsHistogramName,
|
||||
Sample(AshPipEvents::ANDROID_PIP_START)));
|
||||
Sample32(AshPipEvents::ANDROID_PIP_START)));
|
||||
histograms.ExpectTotalCount(kAshPipEventsHistogramName, 2);
|
||||
|
||||
const WMEvent enter_normal(WM_EVENT_NORMAL);
|
||||
window_state->OnWMEvent(&enter_normal);
|
||||
|
||||
EXPECT_EQ(1, histograms.GetBucketCount(kAshPipEventsHistogramName,
|
||||
Sample(AshPipEvents::PIP_END)));
|
||||
Sample32(AshPipEvents::PIP_END)));
|
||||
EXPECT_EQ(1,
|
||||
histograms.GetBucketCount(kAshPipEventsHistogramName,
|
||||
Sample(AshPipEvents::ANDROID_PIP_END)));
|
||||
Sample32(AshPipEvents::ANDROID_PIP_END)));
|
||||
histograms.ExpectTotalCount(kAshPipEventsHistogramName, 4);
|
||||
|
||||
// Check time count:
|
||||
@ -378,9 +378,9 @@ TEST_F(WindowStateTest, ChromePipWindowUmaMetricsCountsExitOnDestroy) {
|
||||
window.reset();
|
||||
|
||||
EXPECT_EQ(1, histograms.GetBucketCount(kAshPipEventsHistogramName,
|
||||
Sample(AshPipEvents::PIP_END)));
|
||||
Sample32(AshPipEvents::PIP_END)));
|
||||
EXPECT_EQ(1, histograms.GetBucketCount(kAshPipEventsHistogramName,
|
||||
Sample(AshPipEvents::CHROME_PIP_END)));
|
||||
Sample32(AshPipEvents::CHROME_PIP_END)));
|
||||
histograms.ExpectTotalCount(kAshPipEventsHistogramName, 4);
|
||||
}
|
||||
|
||||
@ -398,10 +398,10 @@ TEST_F(WindowStateTest, AndroidPipWindowUmaMetricsCountsExitOnDestroy) {
|
||||
window.reset();
|
||||
|
||||
EXPECT_EQ(1, histograms.GetBucketCount(kAshPipEventsHistogramName,
|
||||
Sample(AshPipEvents::PIP_END)));
|
||||
Sample32(AshPipEvents::PIP_END)));
|
||||
EXPECT_EQ(1,
|
||||
histograms.GetBucketCount(kAshPipEventsHistogramName,
|
||||
Sample(AshPipEvents::ANDROID_PIP_END)));
|
||||
Sample32(AshPipEvents::ANDROID_PIP_END)));
|
||||
histograms.ExpectTotalCount(kAshPipEventsHistogramName, 4);
|
||||
}
|
||||
|
||||
|
@ -79,8 +79,8 @@ HistogramType DummyHistogram::GetHistogramType() const {
|
||||
}
|
||||
|
||||
bool DummyHistogram::HasConstructionArguments(
|
||||
Sample expected_minimum,
|
||||
Sample expected_maximum,
|
||||
Sample32 expected_minimum,
|
||||
Sample32 expected_maximum,
|
||||
size_t expected_bucket_count) const {
|
||||
return true;
|
||||
}
|
||||
|
@ -27,15 +27,15 @@ class BASE_EXPORT DummyHistogram : public HistogramBase {
|
||||
DummyHistogram(const DummyHistogram&) = delete;
|
||||
DummyHistogram& operator=(const DummyHistogram&) = delete;
|
||||
|
||||
// HistogramBase:
|
||||
// HistogramBase
|
||||
void CheckName(std::string_view name) const override {}
|
||||
uint64_t name_hash() const override;
|
||||
HistogramType GetHistogramType() const override;
|
||||
bool HasConstructionArguments(Sample expected_minimum,
|
||||
Sample expected_maximum,
|
||||
bool HasConstructionArguments(Sample32 expected_minimum,
|
||||
Sample32 expected_maximum,
|
||||
size_t expected_bucket_count) const override;
|
||||
void Add(Sample value) override {}
|
||||
void AddCount(Sample value, int count) override {}
|
||||
void Add(Sample32 value) override {}
|
||||
void AddCount(Sample32 value, int count) override {}
|
||||
bool AddSamples(const HistogramSamples& samples) override;
|
||||
bool AddSamplesFromPickle(PickleIterator* iter) override;
|
||||
std::unique_ptr<HistogramSamples> SnapshotSamples() const override;
|
||||
|
@ -438,8 +438,8 @@ size_t Histogram::bucket_count() const {
|
||||
|
||||
// static
|
||||
bool Histogram::InspectConstructionArguments(std::string_view name,
|
||||
Sample* minimum,
|
||||
Sample* maximum,
|
||||
Sample32* minimum,
|
||||
Sample32* maximum,
|
||||
size_t* bucket_count) {
|
||||
bool check_okay = true;
|
||||
|
||||
@ -465,7 +465,7 @@ bool Histogram::InspectConstructionArguments(std::string_view name,
|
||||
}
|
||||
if (*bucket_count > kBucketCount_MAX) {
|
||||
UmaHistogramSparse("Histogram.TooManyBuckets.1000",
|
||||
static_cast<Sample>(HashMetricName(name)));
|
||||
static_cast<Sample32>(HashMetricName(name)));
|
||||
|
||||
// Blink.UseCounter legitimately has more than 1000 entries in its enum.
|
||||
if (!StartsWith(name, "Blink.UseCounter")) {
|
||||
@ -500,7 +500,7 @@ bool Histogram::InspectConstructionArguments(std::string_view name,
|
||||
|
||||
if (!check_okay) {
|
||||
UmaHistogramSparse("Histogram.BadConstructionArguments",
|
||||
static_cast<Sample>(HashMetricName(name)));
|
||||
static_cast<Sample32>(HashMetricName(name)));
|
||||
}
|
||||
|
||||
return check_okay;
|
||||
@ -514,8 +514,8 @@ HistogramType Histogram::GetHistogramType() const {
|
||||
return HISTOGRAM;
|
||||
}
|
||||
|
||||
bool Histogram::HasConstructionArguments(Sample expected_minimum,
|
||||
Sample expected_maximum,
|
||||
bool Histogram::HasConstructionArguments(Sample32 expected_minimum,
|
||||
Sample32 expected_maximum,
|
||||
size_t expected_bucket_count) const {
|
||||
return (expected_bucket_count == bucket_count() &&
|
||||
expected_minimum == declared_min() &&
|
||||
@ -687,8 +687,8 @@ HistogramBase* Histogram::DeserializeInfoImpl(PickleIterator* iter) {
|
||||
|
||||
// static
|
||||
HistogramBase* Histogram::FactoryGetInternal(std::string_view name,
|
||||
Sample minimum,
|
||||
Sample maximum,
|
||||
Sample32 minimum,
|
||||
Sample32 maximum,
|
||||
size_t bucket_count,
|
||||
int32_t flags) {
|
||||
bool valid_arguments =
|
||||
@ -708,10 +708,10 @@ HistogramBase* Histogram::FactoryTimeGetInternal(std::string_view name,
|
||||
TimeDelta maximum,
|
||||
size_t bucket_count,
|
||||
int32_t flags) {
|
||||
DCHECK_LT(minimum.InMilliseconds(), std::numeric_limits<Sample>::max());
|
||||
DCHECK_LT(maximum.InMilliseconds(), std::numeric_limits<Sample>::max());
|
||||
return FactoryGetInternal(name, static_cast<Sample>(minimum.InMilliseconds()),
|
||||
static_cast<Sample>(maximum.InMilliseconds()),
|
||||
DCHECK_LT(minimum.InMilliseconds(), std::numeric_limits<Sample32>::max());
|
||||
DCHECK_LT(maximum.InMilliseconds(), std::numeric_limits<Sample32>::max());
|
||||
return FactoryGetInternal(name, static_cast<Sample32>(minimum.InMilliseconds()),
|
||||
static_cast<Sample32>(maximum.InMilliseconds()),
|
||||
bucket_count, flags);
|
||||
}
|
||||
|
||||
@ -722,10 +722,10 @@ HistogramBase* Histogram::FactoryMicrosecondsTimeGetInternal(
|
||||
TimeDelta maximum,
|
||||
size_t bucket_count,
|
||||
int32_t flags) {
|
||||
DCHECK_LT(minimum.InMicroseconds(), std::numeric_limits<Sample>::max());
|
||||
DCHECK_LT(maximum.InMicroseconds(), std::numeric_limits<Sample>::max());
|
||||
return FactoryGetInternal(name, static_cast<Sample>(minimum.InMicroseconds()),
|
||||
static_cast<Sample>(maximum.InMicroseconds()),
|
||||
DCHECK_LT(minimum.InMicroseconds(), std::numeric_limits<Sample32>::max());
|
||||
DCHECK_LT(maximum.InMicroseconds(), std::numeric_limits<Sample32>::max());
|
||||
return FactoryGetInternal(name, static_cast<Sample32>(minimum.InMicroseconds()),
|
||||
static_cast<Sample32>(maximum.InMicroseconds()),
|
||||
bucket_count, flags);
|
||||
}
|
||||
|
||||
@ -813,8 +813,8 @@ class LinearHistogram::Factory : public Histogram::Factory {
|
||||
LinearHistogram::~LinearHistogram() = default;
|
||||
|
||||
HistogramBase* LinearHistogram::FactoryGet(std::string_view name,
|
||||
Sample minimum,
|
||||
Sample maximum,
|
||||
Sample32 minimum,
|
||||
Sample32 maximum,
|
||||
size_t bucket_count,
|
||||
int32_t flags) {
|
||||
return FactoryGetInternal(name, minimum, maximum, bucket_count, flags);
|
||||
@ -829,8 +829,8 @@ HistogramBase* LinearHistogram::FactoryTimeGet(std::string_view name,
|
||||
}
|
||||
|
||||
HistogramBase* LinearHistogram::FactoryGet(const std::string& name,
|
||||
Sample minimum,
|
||||
Sample maximum,
|
||||
Sample32 minimum,
|
||||
Sample32 maximum,
|
||||
size_t bucket_count,
|
||||
int32_t flags) {
|
||||
return FactoryGetInternal(name, minimum, maximum, bucket_count, flags);
|
||||
@ -845,8 +845,8 @@ HistogramBase* LinearHistogram::FactoryTimeGet(const std::string& name,
|
||||
}
|
||||
|
||||
HistogramBase* LinearHistogram::FactoryGet(const char* name,
|
||||
Sample minimum,
|
||||
Sample maximum,
|
||||
Sample32 minimum,
|
||||
Sample32 maximum,
|
||||
size_t bucket_count,
|
||||
int32_t flags) {
|
||||
return FactoryGetInternal(name, minimum, maximum, bucket_count, flags);
|
||||
@ -873,8 +873,8 @@ std::unique_ptr<HistogramBase> LinearHistogram::PersistentCreate(
|
||||
|
||||
HistogramBase* LinearHistogram::FactoryGetWithRangeDescription(
|
||||
std::string_view name,
|
||||
Sample minimum,
|
||||
Sample maximum,
|
||||
Sample32 minimum,
|
||||
Sample32 maximum,
|
||||
size_t bucket_count,
|
||||
int32_t flags,
|
||||
const DescriptionPair descriptions[]) {
|
||||
@ -928,8 +928,8 @@ std::string LinearHistogram::GetAsciiBucketRange(size_t i) const {
|
||||
}
|
||||
|
||||
// static
|
||||
void LinearHistogram::InitializeBucketRanges(Sample minimum,
|
||||
Sample maximum,
|
||||
void LinearHistogram::InitializeBucketRanges(Sample32 minimum,
|
||||
Sample32 maximum,
|
||||
BucketRanges* ranges) {
|
||||
double min = minimum;
|
||||
double max = maximum;
|
||||
@ -938,7 +938,7 @@ void LinearHistogram::InitializeBucketRanges(Sample minimum,
|
||||
for (size_t i = 1; i < bucket_count; ++i) {
|
||||
double linear_range =
|
||||
(min * (bucket_count - 1 - i) + max * (i - 1)) / (bucket_count - 2);
|
||||
auto range = static_cast<Sample>(linear_range + 0.5);
|
||||
auto range = static_cast<Sample32>(linear_range + 0.5);
|
||||
ranges->set_range(i, range);
|
||||
}
|
||||
ranges->set_range(ranges->bucket_count(), HistogramBase::kSampleType_MAX);
|
||||
@ -947,8 +947,8 @@ void LinearHistogram::InitializeBucketRanges(Sample minimum,
|
||||
|
||||
// static
|
||||
HistogramBase* LinearHistogram::FactoryGetInternal(std::string_view name,
|
||||
Sample minimum,
|
||||
Sample maximum,
|
||||
Sample32 minimum,
|
||||
Sample32 maximum,
|
||||
size_t bucket_count,
|
||||
int32_t flags) {
|
||||
return FactoryGetWithRangeDescription(name, minimum, maximum, bucket_count,
|
||||
@ -961,10 +961,10 @@ HistogramBase* LinearHistogram::FactoryTimeGetInternal(std::string_view name,
|
||||
TimeDelta maximum,
|
||||
size_t bucket_count,
|
||||
int32_t flags) {
|
||||
DCHECK_LT(minimum.InMilliseconds(), std::numeric_limits<Sample>::max());
|
||||
DCHECK_LT(maximum.InMilliseconds(), std::numeric_limits<Sample>::max());
|
||||
return FactoryGetInternal(name, static_cast<Sample>(minimum.InMilliseconds()),
|
||||
static_cast<Sample>(maximum.InMilliseconds()),
|
||||
DCHECK_LT(minimum.InMilliseconds(), std::numeric_limits<Sample32>::max());
|
||||
DCHECK_LT(maximum.InMilliseconds(), std::numeric_limits<Sample32>::max());
|
||||
return FactoryGetInternal(name, static_cast<Sample32>(minimum.InMilliseconds()),
|
||||
static_cast<Sample32>(maximum.InMilliseconds()),
|
||||
bucket_count, flags);
|
||||
}
|
||||
|
||||
@ -1207,7 +1207,7 @@ HistogramBase* BooleanHistogram::DeserializeInfoImpl(PickleIterator* iter) {
|
||||
class CustomHistogram::Factory : public Histogram::Factory {
|
||||
public:
|
||||
Factory(std::string_view name,
|
||||
const std::vector<Sample>* custom_ranges,
|
||||
const std::vector<Sample32>* custom_ranges,
|
||||
int32_t flags)
|
||||
: Histogram::Factory(name, CUSTOM_HISTOGRAM, 0, 0, 0, flags) {
|
||||
custom_ranges_ = custom_ranges;
|
||||
@ -1240,26 +1240,26 @@ class CustomHistogram::Factory : public Histogram::Factory {
|
||||
}
|
||||
|
||||
private:
|
||||
raw_ptr<const std::vector<Sample>> custom_ranges_;
|
||||
raw_ptr<const std::vector<Sample32>> custom_ranges_;
|
||||
};
|
||||
|
||||
HistogramBase* CustomHistogram::FactoryGet(
|
||||
std::string_view name,
|
||||
const std::vector<Sample>& custom_ranges,
|
||||
const std::vector<Sample32>& custom_ranges,
|
||||
int32_t flags) {
|
||||
return FactoryGetInternal(name, custom_ranges, flags);
|
||||
}
|
||||
|
||||
HistogramBase* CustomHistogram::FactoryGet(
|
||||
const std::string& name,
|
||||
const std::vector<Sample>& custom_ranges,
|
||||
const std::vector<Sample32>& custom_ranges,
|
||||
int32_t flags) {
|
||||
return FactoryGetInternal(name, custom_ranges, flags);
|
||||
}
|
||||
|
||||
HistogramBase* CustomHistogram::FactoryGet(
|
||||
const char* name,
|
||||
const std::vector<Sample>& custom_ranges,
|
||||
const std::vector<Sample32>& custom_ranges,
|
||||
int32_t flags) {
|
||||
return FactoryGetInternal(name, custom_ranges, flags);
|
||||
}
|
||||
@ -1281,9 +1281,9 @@ HistogramType CustomHistogram::GetHistogramType() const {
|
||||
|
||||
// static
|
||||
std::vector<Sample32> CustomHistogram::ArrayToCustomEnumRanges(
|
||||
base::span<const Sample> values) {
|
||||
std::vector<Sample> all_values;
|
||||
for (Sample value : values) {
|
||||
base::span<const Sample32> values) {
|
||||
std::vector<Sample32> all_values;
|
||||
for (Sample32 value : values) {
|
||||
all_values.push_back(value);
|
||||
|
||||
// Ensure that a guard bucket is added. If we end up with duplicate
|
||||
@ -1330,9 +1330,9 @@ HistogramBase* CustomHistogram::DeserializeInfoImpl(PickleIterator* iter) {
|
||||
}
|
||||
|
||||
// First and last ranges are not serialized.
|
||||
std::vector<Sample> sample_ranges(bucket_count - 1);
|
||||
std::vector<Sample32> sample_ranges(bucket_count - 1);
|
||||
|
||||
for (Sample& sample : sample_ranges) {
|
||||
for (Sample32& sample : sample_ranges) {
|
||||
if (!iter->ReadInt(&sample)) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -1354,7 +1354,7 @@ HistogramBase* CustomHistogram::DeserializeInfoImpl(PickleIterator* iter) {
|
||||
// static
|
||||
HistogramBase* CustomHistogram::FactoryGetInternal(
|
||||
std::string_view name,
|
||||
const std::vector<Sample>& custom_ranges,
|
||||
const std::vector<Sample32>& custom_ranges,
|
||||
int32_t flags) {
|
||||
CHECK(ValidateCustomRanges(custom_ranges));
|
||||
|
||||
@ -1363,9 +1363,9 @@ HistogramBase* CustomHistogram::FactoryGetInternal(
|
||||
|
||||
// static
|
||||
bool CustomHistogram::ValidateCustomRanges(
|
||||
const std::vector<Sample>& custom_ranges) {
|
||||
const std::vector<Sample32>& custom_ranges) {
|
||||
bool has_valid_range = false;
|
||||
for (Sample sample : custom_ranges) {
|
||||
for (Sample32 sample : custom_ranges) {
|
||||
if (sample < 0 || sample > HistogramBase::kSampleType_MAX - 1) {
|
||||
return false;
|
||||
}
|
||||
|
@ -465,7 +465,7 @@ class BASE_EXPORT LinearHistogram : public Histogram {
|
||||
// cause overflows of the 31-bit counters, usually with an enum as the value.
|
||||
class BASE_EXPORT ScaledLinearHistogram {
|
||||
using AtomicCount = Histogram::AtomicCount;
|
||||
using Sample32 = Histogram::Sample;
|
||||
using Sample32 = Histogram::Sample32;
|
||||
|
||||
public:
|
||||
// Currently only works with "exact" linear histograms: minimum=1, maximum=N,
|
||||
|
@ -137,7 +137,7 @@ void HistogramBase::AddKiB(Sample32 value, int count) {
|
||||
}
|
||||
|
||||
void HistogramBase::AddTimeMillisecondsGranularity(const TimeDelta& time) {
|
||||
Add(saturated_cast<Sample>(time.InMilliseconds()));
|
||||
Add(saturated_cast<Sample32>(time.InMilliseconds()));
|
||||
}
|
||||
|
||||
void HistogramBase::AddTimeMicrosecondsGranularity(const TimeDelta& time) {
|
||||
@ -145,7 +145,7 @@ void HistogramBase::AddTimeMicrosecondsGranularity(const TimeDelta& time) {
|
||||
// clocks. High-resolution metrics cannot make use of low-resolution data and
|
||||
// reporting it merely adds noise to the metric. https://crbug.com/807615#c16
|
||||
if (TimeTicks::IsHighResolution()) {
|
||||
Add(saturated_cast<Sample>(time.InMicroseconds()));
|
||||
Add(saturated_cast<Sample32>(time.InMicroseconds()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,9 +95,6 @@ BASE_EXPORT HistogramBase* DeserializeHistogramInfo(base::PickleIterator* iter);
|
||||
class BASE_EXPORT HistogramBase {
|
||||
public:
|
||||
typedef int32_t Sample32; // Used for samples.
|
||||
// Temporary alias for backward compatibility.
|
||||
// TODO(crbug.com/40899968): Remove this alias.
|
||||
typedef Sample32 Sample;
|
||||
typedef subtle::Atomic32 AtomicCount; // Used to count samples.
|
||||
typedef int32_t Count; // Used to manipulate counts in temporaries.
|
||||
|
||||
|
@ -218,7 +218,7 @@ TEST_F(HistogramBaseTest, AddTimeMillisecondsGranularityOverflow) {
|
||||
1, sample_max, 100, 0);
|
||||
int64_t large_negative = std::numeric_limits<int64_t>::min();
|
||||
add_count = 0;
|
||||
while (large_negative < std::numeric_limits<HistogramBase::Sample>::min()) {
|
||||
while (large_negative < std::numeric_limits<HistogramBase::Sample32>::min()) {
|
||||
histogram->AddTimeMillisecondsGranularity(Milliseconds(large_negative));
|
||||
++add_count;
|
||||
large_negative /= 7;
|
||||
|
@ -297,7 +297,7 @@ class BASE_EXPORT SampleCountIterator {
|
||||
HistogramBase::Count* count) = 0;
|
||||
static_assert(std::numeric_limits<HistogramBase::Sample32>::max() <
|
||||
std::numeric_limits<int64_t>::max(),
|
||||
"Get() |max| must be able to hold Histogram::Sample max + 1");
|
||||
"Get() |max| must be able to hold Histogram::Sample32 max + 1");
|
||||
|
||||
// Get the index of current histogram bucket.
|
||||
// For histograms that don't use predefined buckets, it returns false.
|
||||
|
@ -82,7 +82,7 @@ class SnapshotDeltaThread : public SimpleThread {
|
||||
// but the randomness does not really matter as thread-safety is what is
|
||||
// being tested here and there is already a lot of non-determinism
|
||||
// surrounding scheduling.
|
||||
Histogram::Sample sample = rand() % histogram_max_;
|
||||
Histogram::Sample32 sample = rand() % histogram_max_;
|
||||
histogram->Add(sample);
|
||||
|
||||
// Take a snapshot of the histogram. Because of the multithreading
|
||||
@ -102,7 +102,7 @@ class SnapshotDeltaThread : public SimpleThread {
|
||||
private:
|
||||
// Stores an actual |sample| that was emitted for |histogram|. This is done
|
||||
// to compare what was found in histogram snapshots (see StoreSnapshot()).
|
||||
void StoreActualSample(HistogramBase* histogram, Histogram::Sample sample) {
|
||||
void StoreActualSample(HistogramBase* histogram, Histogram::Sample32 sample) {
|
||||
subtle::NoBarrier_AtomicIncrement(real_total_samples_count_, 1);
|
||||
switch (histogram->GetHistogramType()) {
|
||||
case HISTOGRAM: {
|
||||
|
@ -410,7 +410,7 @@ std::unique_ptr<HistogramBase> PersistentHistogramAllocator::AllocateHistogram(
|
||||
bucket_ranges->persistent_reference();
|
||||
if (!ranges_ref) {
|
||||
size_t ranges_count = bucket_count + 1;
|
||||
size_t ranges_bytes = ranges_count * sizeof(HistogramBase::Sample);
|
||||
size_t ranges_bytes = ranges_count * sizeof(HistogramBase::Sample32);
|
||||
ranges_ref =
|
||||
memory_allocator_->Allocate(ranges_bytes, kTypeIdRangesArray);
|
||||
if (ranges_ref) {
|
||||
|
@ -76,12 +76,12 @@ class BASE_EXPORT PersistentSampleMap : public HistogramSamples {
|
||||
// Gets a pointer to a "count" corresponding to a given |value|. Returns NULL
|
||||
// if sample does not exist.
|
||||
std::atomic<HistogramBase::Count>* GetSampleCountStorage(
|
||||
HistogramBase::Sample value) const;
|
||||
HistogramBase::Sample32 value) const;
|
||||
|
||||
// Gets a pointer to a "count" corresponding to a given |value|, creating
|
||||
// the sample (initialized to zero) if it does not already exist.
|
||||
std::atomic<HistogramBase::Count>* GetOrCreateSampleCountStorage(
|
||||
HistogramBase::Sample value);
|
||||
HistogramBase::Sample32 value);
|
||||
|
||||
private:
|
||||
// Gets the object that manages persistent records. This returns the
|
||||
|
@ -51,7 +51,7 @@ class SampleMapIterator : public SampleCountIterator {
|
||||
SkipEmptyBuckets();
|
||||
}
|
||||
|
||||
void Get(HistogramBase::Sample* min,
|
||||
void Get(HistogramBase::Sample32* min,
|
||||
int64_t* max,
|
||||
HistogramBase::Count* count) override {
|
||||
DCHECK(!Done());
|
||||
|
@ -71,7 +71,7 @@ DefaultSingleSampleMetric::~DefaultSingleSampleMetric() {
|
||||
histogram_->Add(sample_);
|
||||
}
|
||||
|
||||
void DefaultSingleSampleMetric::SetSample(HistogramBase::Sample sample) {
|
||||
void DefaultSingleSampleMetric::SetSample(HistogramBase::Sample32 sample) {
|
||||
DCHECK_GE(sample, 0);
|
||||
sample_ = sample;
|
||||
}
|
||||
|
@ -47,11 +47,11 @@ class BASE_EXPORT SparseHistogram : public HistogramBase {
|
||||
// HistogramBase:
|
||||
uint64_t name_hash() const override;
|
||||
HistogramType GetHistogramType() const override;
|
||||
bool HasConstructionArguments(Sample expected_minimum,
|
||||
Sample expected_maximum,
|
||||
bool HasConstructionArguments(Sample32 expected_minimum,
|
||||
Sample32 expected_maximum,
|
||||
size_t expected_bucket_count) const override;
|
||||
void Add(Sample value) override;
|
||||
void AddCount(Sample value, int count) override;
|
||||
void Add(Sample32 value) override;
|
||||
void AddCount(Sample32 value, int count) override;
|
||||
bool AddSamples(const HistogramSamples& samples) override;
|
||||
bool AddSamplesFromPickle(base::PickleIterator* iter) override;
|
||||
std::unique_ptr<HistogramSamples> SnapshotSamples() const override;
|
||||
|
@ -430,7 +430,7 @@ TEST_P(SparseHistogramTest, FactoryTime) {
|
||||
|
||||
TEST_P(SparseHistogramTest, ExtremeValues) {
|
||||
struct Cases {
|
||||
Histogram::Sample sample;
|
||||
HistogramBase::Sample32 sample;
|
||||
int64_t expected_max;
|
||||
};
|
||||
static const auto cases = std::to_array<Cases>({
|
||||
@ -452,7 +452,7 @@ TEST_P(SparseHistogramTest, ExtremeValues) {
|
||||
std::unique_ptr<SampleCountIterator> it = snapshot->Iterator();
|
||||
ASSERT_FALSE(it->Done());
|
||||
|
||||
base::Histogram::Sample min;
|
||||
base::HistogramBase::Sample32 min;
|
||||
int64_t max;
|
||||
base::Histogram::Count count;
|
||||
it->Get(&min, &max, &count);
|
||||
|
@ -224,7 +224,7 @@ TEST_F(HistogramTesterTest, MissingHistogramMeansEmptyBuckets) {
|
||||
TEST_F(HistogramTesterTest, BucketsAre) {
|
||||
// Auxiliary functions for keeping the lines short.
|
||||
auto a = [](std::vector<Bucket> b) { return b; };
|
||||
auto b = [](base::Histogram::Sample min, base::Histogram::Count count) {
|
||||
auto b = [](base::Histogram::Sample32 min, base::Histogram::Count count) {
|
||||
return Bucket(min, count);
|
||||
};
|
||||
using ::testing::Not;
|
||||
@ -263,7 +263,7 @@ TEST_F(HistogramTesterTest, BucketsAre) {
|
||||
TEST_F(HistogramTesterTest, BucketsInclude) {
|
||||
// Auxiliary function for the "actual" values to shorten lines.
|
||||
auto a = [](std::vector<Bucket> b) { return b; };
|
||||
auto b = [](base::Histogram::Sample min, base::Histogram::Count count) {
|
||||
auto b = [](base::Histogram::Sample32 min, base::Histogram::Count count) {
|
||||
return Bucket(min, count);
|
||||
};
|
||||
using ::testing::Not;
|
||||
|
@ -62,8 +62,8 @@ ScopedUMAHistogramAreaTimerBase::ScopedUMAHistogramAreaTimerBase() : area_(0) {
|
||||
ScopedUMAHistogramAreaTimerBase::~ScopedUMAHistogramAreaTimerBase() = default;
|
||||
|
||||
bool ScopedUMAHistogramAreaTimerBase::GetHistogramValues(
|
||||
Sample* time_microseconds,
|
||||
Sample* pixels_per_ms) const {
|
||||
Sample32* time_microseconds,
|
||||
Sample32* pixels_per_ms) const {
|
||||
return GetHistogramValues(
|
||||
timer_.Elapsed(), area_.ValueOrDefault(std::numeric_limits<int>::max()),
|
||||
time_microseconds, pixels_per_ms);
|
||||
@ -73,16 +73,16 @@ bool ScopedUMAHistogramAreaTimerBase::GetHistogramValues(
|
||||
bool ScopedUMAHistogramAreaTimerBase::GetHistogramValues(
|
||||
base::TimeDelta elapsed,
|
||||
int area,
|
||||
Sample* time_microseconds,
|
||||
Sample* pixels_per_ms) {
|
||||
Sample32* time_microseconds,
|
||||
Sample32* pixels_per_ms) {
|
||||
elapsed = std::max(elapsed, base::Microseconds(kMinimumTimeMicroseconds));
|
||||
double area_per_time = area / elapsed.InMillisecondsF();
|
||||
// It is not clear how NaN can get here, but we've gotten crashes from
|
||||
// saturated_cast. http://crbug.com/486214
|
||||
if (std::isnan(area_per_time))
|
||||
return false;
|
||||
*time_microseconds = base::saturated_cast<Sample>(elapsed.InMicroseconds());
|
||||
*pixels_per_ms = base::saturated_cast<Sample>(area_per_time);
|
||||
*time_microseconds = base::saturated_cast<Sample32>(elapsed.InMicroseconds());
|
||||
*pixels_per_ms = base::saturated_cast<Sample32>(area_per_time);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -100,20 +100,20 @@ class CC_BASE_EXPORT ScopedUMAHistogramAreaTimerBase {
|
||||
void SetArea(const base::CheckedNumeric<int>& area) { area_ = area; }
|
||||
|
||||
protected:
|
||||
using Sample = base::HistogramBase::Sample;
|
||||
using Sample32 = base::HistogramBase::Sample32;
|
||||
|
||||
ScopedUMAHistogramAreaTimerBase();
|
||||
~ScopedUMAHistogramAreaTimerBase();
|
||||
|
||||
// Returns true if histograms should be recorded (i.e. values are valid).
|
||||
bool GetHistogramValues(Sample* time_microseconds,
|
||||
Sample* pixels_per_ms) const;
|
||||
bool GetHistogramValues(Sample32* time_microseconds,
|
||||
Sample32* pixels_per_ms) const;
|
||||
|
||||
private:
|
||||
static bool GetHistogramValues(base::TimeDelta elapsed,
|
||||
int area,
|
||||
Sample* time_microseconds,
|
||||
Sample* pixels_per_ms);
|
||||
Sample32* time_microseconds,
|
||||
Sample32* pixels_per_ms);
|
||||
|
||||
base::ElapsedTimer timer_;
|
||||
base::CheckedNumeric<int> area_;
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
using Sample = base::HistogramBase::Sample;
|
||||
using Sample32 = base::HistogramBase::Sample32;
|
||||
|
||||
namespace cc {
|
||||
|
||||
@ -16,10 +16,10 @@ class ScopedUMAHistogramAreaTimerBaseTest : public ::testing::Test {
|
||||
protected:
|
||||
void ExpectValidHistogramValues(base::TimeDelta elapsed,
|
||||
int area,
|
||||
Sample expected_time_microseconds,
|
||||
Sample expected_pixels_per_ms) {
|
||||
Sample time_microseconds;
|
||||
Sample pixels_per_ms;
|
||||
Sample32 expected_time_microseconds,
|
||||
Sample32 expected_pixels_per_ms) {
|
||||
Sample32 time_microseconds;
|
||||
Sample32 pixels_per_ms;
|
||||
ScopedUMAHistogramAreaTimerBase::GetHistogramValues(
|
||||
elapsed, area, &time_microseconds, &pixels_per_ms);
|
||||
EXPECT_EQ(expected_time_microseconds, time_microseconds);
|
||||
@ -49,7 +49,7 @@ TEST_F(ScopedUMAHistogramAreaTimerBaseTest, ZeroTimeAndArea) {
|
||||
|
||||
TEST_F(ScopedUMAHistogramAreaTimerBaseTest, VeryLargeTime) {
|
||||
ExpectValidHistogramValues(base::Hours(24), 1000,
|
||||
std::numeric_limits<Sample>::max(), 0);
|
||||
std::numeric_limits<Sample32>::max(), 0);
|
||||
}
|
||||
|
||||
TEST_F(ScopedUMAHistogramAreaTimerBaseTest, VeryLargeArea) {
|
||||
@ -57,7 +57,7 @@ TEST_F(ScopedUMAHistogramAreaTimerBaseTest, VeryLargeArea) {
|
||||
2000000000);
|
||||
ExpectValidHistogramValues(base::Microseconds(1000),
|
||||
std::numeric_limits<int>::max(), 1000,
|
||||
std::numeric_limits<Sample>::max());
|
||||
std::numeric_limits<Sample32>::max());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -450,25 +450,25 @@ TEST_F(CompositorFrameReporterTest,
|
||||
|
||||
struct {
|
||||
const char* name;
|
||||
const base::HistogramBase::Sample latency_ms;
|
||||
const base::HistogramBase::Sample32 latency_ms;
|
||||
} expected_latencies[] = {
|
||||
{"EventLatency.TouchPressed.TotalLatency",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[0]).InMicroseconds())},
|
||||
{"EventLatency.TouchMoved.TotalLatency",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[1]).InMicroseconds())},
|
||||
{"EventLatency.TouchMoved.TotalLatency",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[2]).InMicroseconds())},
|
||||
{"EventLatency.TotalLatency",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[0]).InMicroseconds())},
|
||||
{"EventLatency.TotalLatency",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[1]).InMicroseconds())},
|
||||
{"EventLatency.TotalLatency",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[2]).InMicroseconds())},
|
||||
};
|
||||
for (const auto& expected_latency : expected_latencies) {
|
||||
@ -571,34 +571,34 @@ TEST_F(CompositorFrameReporterTest,
|
||||
viz_breakdown.presentation_feedback.timestamp;
|
||||
struct {
|
||||
const char* name;
|
||||
const base::HistogramBase::Sample latency_ms;
|
||||
const base::HistogramBase::Sample32 latency_ms;
|
||||
} expected_latencies[] = {
|
||||
{"EventLatency.GestureScrollBegin.Wheel.TotalLatency2",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[0]).InMicroseconds())},
|
||||
{"EventLatency.FirstGestureScrollUpdate.Wheel.TotalLatency2",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[1]).InMicroseconds())},
|
||||
{"EventLatency.GestureScrollUpdate.Wheel.TotalLatency2",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[2]).InMicroseconds())},
|
||||
{"EventLatency.InertialGestureScrollUpdate.Wheel.TotalLatency2",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[3]).InMicroseconds())},
|
||||
{"EventLatency.GestureScrollBegin.Touchscreen.TotalLatency2",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[4]).InMicroseconds())},
|
||||
{"EventLatency.FirstGestureScrollUpdate.Touchscreen.TotalLatency2",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[5]).InMicroseconds())},
|
||||
{"EventLatency.GestureScrollUpdate.Touchscreen.TotalLatency",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[6]).InMicroseconds())},
|
||||
{"EventLatency.GestureScrollUpdate.Touchscreen.TotalLatency2",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[6]).InMicroseconds())},
|
||||
{"EventLatency.InertialGestureScrollUpdate.Touchscreen.TotalLatency2",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[7]).InMicroseconds())},
|
||||
};
|
||||
for (const auto& expected_latency : expected_latencies) {
|
||||
@ -674,19 +674,19 @@ TEST_F(CompositorFrameReporterTest,
|
||||
viz_breakdown.presentation_feedback.timestamp;
|
||||
struct {
|
||||
const char* name;
|
||||
const base::HistogramBase::Sample latency_ms;
|
||||
const base::HistogramBase::Sample32 latency_ms;
|
||||
} expected_latencies[] = {
|
||||
{"EventLatency.GesturePinchBegin.Touchpad.TotalLatency",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[0]).InMicroseconds())},
|
||||
{"EventLatency.GesturePinchUpdate.Touchpad.TotalLatency",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[1]).InMicroseconds())},
|
||||
{"EventLatency.GesturePinchBegin.Touchscreen.TotalLatency",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[2]).InMicroseconds())},
|
||||
{"EventLatency.GesturePinchUpdate.Touchscreen.TotalLatency",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[3]).InMicroseconds())},
|
||||
};
|
||||
for (const auto& expected_latency : expected_latencies) {
|
||||
|
@ -1260,25 +1260,25 @@ TEST_F(CompositorFrameReportingControllerTest,
|
||||
|
||||
struct {
|
||||
const char* name;
|
||||
const base::HistogramBase::Sample latency_ms;
|
||||
const base::HistogramBase::Sample32 latency_ms;
|
||||
} expected_latencies[] = {
|
||||
{"EventLatency.TouchPressed.TotalLatency",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[0]).InMicroseconds())},
|
||||
{"EventLatency.TouchMoved.TotalLatency",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[1]).InMicroseconds())},
|
||||
{"EventLatency.TouchMoved.TotalLatency",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[2]).InMicroseconds())},
|
||||
{"EventLatency.TotalLatency",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[0]).InMicroseconds())},
|
||||
{"EventLatency.TotalLatency",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[1]).InMicroseconds())},
|
||||
{"EventLatency.TotalLatency",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[2]).InMicroseconds())},
|
||||
};
|
||||
for (const auto& expected_latency : expected_latencies) {
|
||||
@ -1369,34 +1369,34 @@ TEST_F(CompositorFrameReportingControllerTest,
|
||||
details.presentation_feedback.timestamp;
|
||||
struct {
|
||||
const char* name;
|
||||
const base::HistogramBase::Sample latency_ms;
|
||||
const base::HistogramBase::Sample32 latency_ms;
|
||||
} expected_latencies[] = {
|
||||
{"EventLatency.GestureScrollBegin.Wheel.TotalLatency2",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[0]).InMicroseconds())},
|
||||
{"EventLatency.FirstGestureScrollUpdate.Wheel.TotalLatency2",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[1]).InMicroseconds())},
|
||||
{"EventLatency.GestureScrollUpdate.Wheel.TotalLatency2",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[2]).InMicroseconds())},
|
||||
{"EventLatency.InertialGestureScrollUpdate.Wheel.TotalLatency2",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[3]).InMicroseconds())},
|
||||
{"EventLatency.GestureScrollBegin.Touchscreen.TotalLatency2",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[4]).InMicroseconds())},
|
||||
{"EventLatency.FirstGestureScrollUpdate.Touchscreen.TotalLatency2",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[5]).InMicroseconds())},
|
||||
{"EventLatency.GestureScrollUpdate.Touchscreen.TotalLatency",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[6]).InMicroseconds())},
|
||||
{"EventLatency.GestureScrollUpdate.Touchscreen.TotalLatency2",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[6]).InMicroseconds())},
|
||||
{"EventLatency.InertialGestureScrollUpdate.Touchscreen.TotalLatency2",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[7]).InMicroseconds())},
|
||||
};
|
||||
for (const auto& expected_latency : expected_latencies) {
|
||||
@ -1530,19 +1530,19 @@ TEST_F(CompositorFrameReportingControllerTest,
|
||||
details.presentation_feedback.timestamp;
|
||||
struct {
|
||||
const char* name;
|
||||
const base::HistogramBase::Sample latency_ms;
|
||||
const base::HistogramBase::Sample32 latency_ms;
|
||||
} expected_latencies[] = {
|
||||
{"EventLatency.GesturePinchBegin.Touchpad.TotalLatency",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[0]).InMicroseconds())},
|
||||
{"EventLatency.GesturePinchUpdate.Touchpad.TotalLatency",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[1]).InMicroseconds())},
|
||||
{"EventLatency.GesturePinchBegin.Touchscreen.TotalLatency",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[2]).InMicroseconds())},
|
||||
{"EventLatency.GesturePinchUpdate.Touchscreen.TotalLatency",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[3]).InMicroseconds())},
|
||||
};
|
||||
for (const auto& expected_latency : expected_latencies) {
|
||||
@ -1599,25 +1599,25 @@ TEST_F(CompositorFrameReportingControllerTest,
|
||||
|
||||
struct {
|
||||
const char* name;
|
||||
const base::HistogramBase::Sample latency_ms;
|
||||
const base::HistogramBase::Sample32 latency_ms;
|
||||
} expected_latencies[] = {
|
||||
{"EventLatency.TouchPressed.TotalLatency",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[0]).InMicroseconds())},
|
||||
{"EventLatency.TouchMoved.TotalLatency",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[1]).InMicroseconds())},
|
||||
{"EventLatency.TouchMoved.TotalLatency",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[2]).InMicroseconds())},
|
||||
{"EventLatency.TotalLatency",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[0]).InMicroseconds())},
|
||||
{"EventLatency.TotalLatency",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[1]).InMicroseconds())},
|
||||
{"EventLatency.TotalLatency",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
(presentation_time - event_times[2]).InMicroseconds())},
|
||||
};
|
||||
for (const auto& expected_latency : expected_latencies) {
|
||||
|
@ -28,8 +28,8 @@ namespace about_flags {
|
||||
|
||||
namespace {
|
||||
|
||||
using Sample = base::HistogramBase::Sample;
|
||||
using SwitchToIdMap = std::map<std::string, Sample>;
|
||||
using Sample32 = base::HistogramBase::Sample32;
|
||||
using SwitchToIdMap = std::map<std::string, Sample32>;
|
||||
|
||||
// Get all associated switches corresponding to defined about_flags.cc entries.
|
||||
std::set<std::string> GetAllPublicSwitchesAndFeaturesForTesting() {
|
||||
@ -240,9 +240,9 @@ class AboutFlagsHistogramTest : public ::testing::Test {
|
||||
// This is a helper function to check that all IDs in enum LoginCustomFlags in
|
||||
// histograms.xml are unique.
|
||||
void SetSwitchToHistogramIdMapping(const std::string& switch_name,
|
||||
const Sample switch_histogram_id,
|
||||
std::map<std::string, Sample>* out_map) {
|
||||
const std::pair<std::map<std::string, Sample>::iterator, bool> status =
|
||||
const Sample32 switch_histogram_id,
|
||||
std::map<std::string, Sample32>* out_map) {
|
||||
const std::pair<std::map<std::string, Sample32>::iterator, bool> status =
|
||||
out_map->insert(std::make_pair(switch_name, switch_histogram_id));
|
||||
if (!status.second) {
|
||||
EXPECT_TRUE(status.first->second == switch_histogram_id)
|
||||
@ -255,7 +255,7 @@ class AboutFlagsHistogramTest : public ::testing::Test {
|
||||
// This method generates a hint for the user for what string should be added
|
||||
// to the enum LoginCustomFlags to make in consistent.
|
||||
std::string GetHistogramEnumEntryText(const std::string& switch_name,
|
||||
Sample value) {
|
||||
Sample32 value) {
|
||||
return base::StringPrintf(
|
||||
"<int value=\"%d\" label=\"%s\"/>", value, switch_name.c_str());
|
||||
}
|
||||
@ -285,7 +285,7 @@ TEST_F(AboutFlagsHistogramTest, CheckHistograms) {
|
||||
&metadata_switches_ids);
|
||||
continue;
|
||||
}
|
||||
const Sample uma_id = flags_ui::GetSwitchUMAId(entry.second);
|
||||
const Sample32 uma_id = flags_ui::GetSwitchUMAId(entry.second);
|
||||
EXPECT_EQ(uma_id, entry.first)
|
||||
<< "tools/metrics/histograms/enums.xml enum LoginCustomFlags "
|
||||
"entry '"
|
||||
@ -302,7 +302,7 @@ TEST_F(AboutFlagsHistogramTest, CheckHistograms) {
|
||||
// Skip empty placeholders.
|
||||
if (flag.empty())
|
||||
continue;
|
||||
const Sample uma_id = flags_ui::GetSwitchUMAId(flag);
|
||||
const Sample32 uma_id = flags_ui::GetSwitchUMAId(flag);
|
||||
EXPECT_NE(flags_ui::testing::kBadSwitchFormatHistogramId, uma_id)
|
||||
<< "Command-line switch '" << flag
|
||||
<< "' from about_flags.cc has UMA ID equal to reserved value "
|
||||
|
@ -682,7 +682,7 @@ class ChromeBackForwardCacheBrowserWithEmbedTestBase
|
||||
blink::scheduler::WebSchedulerTrackedFeature feature,
|
||||
base::Location location) {
|
||||
content::FetchHistogramsFromChildProcesses();
|
||||
base::HistogramBase::Sample32 sample = base::HistogramBase::Sample(feature);
|
||||
base::HistogramBase::Sample32 sample = base::HistogramBase::Sample32(feature);
|
||||
base::Bucket expected_blocklisted(sample, 1);
|
||||
|
||||
EXPECT_THAT(histogram_tester_->GetAllSamples(
|
||||
@ -763,7 +763,7 @@ class ChromeBackForwardCacheBrowserWithEmbedPdfTest
|
||||
static constexpr uint8_t kReasonHaveInnerContents = 32;
|
||||
|
||||
content::FetchHistogramsFromChildProcesses();
|
||||
base::HistogramBase::Sample32 sample = base::HistogramBase::Sample(
|
||||
base::HistogramBase::Sample32 sample = base::HistogramBase::Sample32(
|
||||
UseOopif() ? kReasonBlocklistedFeatures : kReasonHaveInnerContents);
|
||||
base::Bucket expected_not_restored(sample, 1);
|
||||
|
||||
|
@ -147,7 +147,7 @@ class MetricIntegrationTest : public InProcessBrowserTest {
|
||||
|
||||
// Checks that the UMA bucket count precisely matches the provided value.
|
||||
void ExpectUniqueUMABucketCount(std::string_view metric_name,
|
||||
base::Histogram::Sample sample,
|
||||
base::Histogram::Sample32 sample,
|
||||
base::Histogram::Count count);
|
||||
|
||||
// Checks that we have a single UMA entry.
|
||||
|
@ -782,7 +782,7 @@ class BackForwardCachePrintBrowserTest : public PrintBrowserTest {
|
||||
void ExpectBlocklistedFeature(
|
||||
blink::scheduler::WebSchedulerTrackedFeature feature,
|
||||
base::Location location) {
|
||||
base::HistogramBase::Sample32 sample = base::HistogramBase::Sample(feature);
|
||||
base::HistogramBase::Sample32 sample = base::HistogramBase::Sample32(feature);
|
||||
AddSampleToBuckets(&expected_blocklisted_features_, sample);
|
||||
|
||||
EXPECT_THAT(
|
||||
|
@ -230,7 +230,7 @@ class LensOverlayLiveTest : public signin::test::LiveTest {
|
||||
histogram_name,
|
||||
base::BindLambdaForTesting(
|
||||
[&](const char* histogram_name, uint64_t name_hash,
|
||||
base::HistogramBase::Sample sample) { run_loop.Quit(); }));
|
||||
base::HistogramBase::Sample32 sample) { run_loop.Quit(); }));
|
||||
run_loop.Run();
|
||||
}
|
||||
|
||||
|
@ -41,8 +41,8 @@ constexpr int kTitleTagTitleSource =
|
||||
constexpr int kInferredTitleSource =
|
||||
static_cast<int>(TileTitleSource::INFERRED);
|
||||
|
||||
using Sample = base::HistogramBase::Sample;
|
||||
using Samples = std::vector<Sample>;
|
||||
using Sample32 = base::HistogramBase::Sample32;
|
||||
using Samples = std::vector<Sample32>;
|
||||
|
||||
// Helper function that uses sensible defaults for irrelevant fields of
|
||||
// NTPTileImpression.
|
||||
|
@ -1626,10 +1626,10 @@ int SetupMain() {
|
||||
PROCESS_MEMORY_COUNTERS pmc;
|
||||
if (::GetProcessMemoryInfo(::GetCurrentProcess(), &pmc, sizeof(pmc))) {
|
||||
UMA_HISTOGRAM_MEMORY_KB("Setup.Install.PeakPagefileUsage",
|
||||
base::saturated_cast<base::HistogramBase::Sample>(
|
||||
base::saturated_cast<base::HistogramBase::Sample32>(
|
||||
pmc.PeakPagefileUsage / 1024));
|
||||
UMA_HISTOGRAM_MEMORY_KB("Setup.Install.PeakWorkingSetSize",
|
||||
base::saturated_cast<base::HistogramBase::Sample>(
|
||||
base::saturated_cast<base::HistogramBase::Sample32>(
|
||||
pmc.PeakWorkingSetSize / 1024));
|
||||
}
|
||||
|
||||
|
@ -93,8 +93,8 @@ class GroupedHistogram : public base::Histogram {
|
||||
// TODO(crbug.com/40824087): min/max parameters are redundant with "ranges"
|
||||
// and can probably be removed.
|
||||
GroupedHistogram(const char* metric_to_override,
|
||||
Sample minimum,
|
||||
Sample maximum,
|
||||
Sample32 minimum,
|
||||
Sample32 maximum,
|
||||
const base::BucketRanges* ranges)
|
||||
: Histogram(metric_to_override, ranges),
|
||||
minimum_(minimum),
|
||||
@ -108,7 +108,7 @@ class GroupedHistogram : public base::Histogram {
|
||||
}
|
||||
|
||||
// base::Histogram implementation:
|
||||
void Add(Sample value) override {
|
||||
void Add(Sample32 value) override {
|
||||
Histogram::Add(value);
|
||||
|
||||
// Note: This is very inefficient. Fetching the app name (which has a lock)
|
||||
@ -129,8 +129,8 @@ class GroupedHistogram : public base::Histogram {
|
||||
private:
|
||||
// Saved construction arguments for reconstructing the Histogram later (with
|
||||
// a suffixed app name).
|
||||
Sample minimum_;
|
||||
Sample maximum_;
|
||||
Sample32 minimum_;
|
||||
Sample32 maximum_;
|
||||
uint32_t bucket_count_;
|
||||
};
|
||||
|
||||
@ -139,8 +139,8 @@ class GroupedHistogram : public base::Histogram {
|
||||
// It acts similarly to Histogram::FactoryGet but checks that
|
||||
// the histogram is being newly created and does not already exist.
|
||||
void PreregisterHistogram(const char* name,
|
||||
GroupedHistogram::Sample minimum,
|
||||
GroupedHistogram::Sample maximum,
|
||||
GroupedHistogram::Sample32 minimum,
|
||||
GroupedHistogram::Sample32 maximum,
|
||||
size_t bucket_count,
|
||||
int32_t flags) {
|
||||
std::string_view name_piece(name);
|
||||
|
@ -50,7 +50,7 @@ class CastRuntimeHistogramFlattener final : public base::HistogramFlattener {
|
||||
|
||||
for (std::unique_ptr<base::SampleCountIterator> it = samples.Iterator();
|
||||
!it->Done(); it->Next()) {
|
||||
base::Histogram::Sample min;
|
||||
base::Histogram::Sample32 min;
|
||||
int64_t max = 0;
|
||||
base::Histogram::Count count;
|
||||
it->Get(&min, &max, &count);
|
||||
|
@ -36,7 +36,7 @@ class HistogramSignalHandler {
|
||||
// Called when a histogram signal tracked by segmentation platform is
|
||||
// updated and written to database.
|
||||
virtual void OnHistogramSignalUpdated(const std::string& histogram_name,
|
||||
base::HistogramBase::Sample) = 0;
|
||||
base::HistogramBase::Sample32) = 0;
|
||||
~Observer() override = default;
|
||||
|
||||
protected:
|
||||
|
@ -41,7 +41,7 @@ class MockObserver : public HistogramSignalHandler::Observer {
|
||||
~MockObserver() override = default;
|
||||
MOCK_METHOD(void,
|
||||
OnHistogramSignalUpdated,
|
||||
(const std::string&, base::HistogramBase::Sample),
|
||||
(const std::string&, base::HistogramBase::Sample32),
|
||||
(override));
|
||||
};
|
||||
|
||||
|
@ -2564,7 +2564,7 @@ IN_PROC_BROWSER_TEST_F(BackForwardCacheBrowserTest,
|
||||
|
||||
ExpectBucketCount(
|
||||
"BackForwardCache.UnexpectedRendererToBrowserMessage.InterfaceName",
|
||||
base::HistogramBase::Sample(
|
||||
base::HistogramBase::Sample32(
|
||||
static_cast<int32_t>(base::HashMetricName(mojom::Echo::Name_))),
|
||||
1);
|
||||
}
|
||||
@ -2649,7 +2649,7 @@ IN_PROC_BROWSER_TEST_F(
|
||||
|
||||
ExpectBucketCount(
|
||||
"BackForwardCache.UnexpectedRendererToBrowserMessage.InterfaceName",
|
||||
base::HistogramBase::Sample(
|
||||
base::HistogramBase::Sample32(
|
||||
static_cast<int32_t>(base::HashMetricName(mojom::Echo::Name_))),
|
||||
1);
|
||||
|
||||
|
@ -306,7 +306,7 @@ MetricsPrivateGetHistogramFunction::GetHistogram(const std::string& name) {
|
||||
|
||||
for (std::unique_ptr<base::SampleCountIterator> it = samples->Iterator();
|
||||
!it->Done(); it->Next()) {
|
||||
base::HistogramBase::Sample min = 0;
|
||||
base::HistogramBase::Sample32 min = 0;
|
||||
int64_t max = 0;
|
||||
base::HistogramBase::Count count = 0;
|
||||
it->Get(&min, &max, &count);
|
||||
|
@ -706,9 +706,9 @@ CommandBufferProxyImpl::GetUMAHistogramEnsureWorkVisibleDuration() {
|
||||
//
|
||||
// Histogram values are in microseconds.
|
||||
|
||||
std::vector<base::HistogramBase::Sample> intervals;
|
||||
constexpr base::HistogramBase::Sample k15Milliseconds = 15 * 1000;
|
||||
constexpr base::HistogramBase::Sample k30Seconds = 30 * 1000 * 1000;
|
||||
std::vector<base::HistogramBase::Sample32> intervals;
|
||||
constexpr base::HistogramBase::Sample32 k15Milliseconds = 15 * 1000;
|
||||
constexpr base::HistogramBase::Sample32 k30Seconds = 30 * 1000 * 1000;
|
||||
constexpr int kFirstPartCount = 60;
|
||||
constexpr int kSecondPartCount = 120;
|
||||
intervals.reserve(kFirstPartCount + kSecondPartCount);
|
||||
|
@ -78,7 +78,7 @@ bool IsValidWebMIDIData(const std::vector<uint8_t>& data) {
|
||||
if (data[i] == kEndOfSysExByte) {
|
||||
in_sysex = false;
|
||||
UMA_HISTOGRAM_COUNTS_1M("Media.Midi.SysExMessageSizeUpTo1MB",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
i - sysex_start_offset + 1));
|
||||
} else if (!IsDataByte(current)) {
|
||||
return false; // Error: |current| should have been data byte.
|
||||
|
@ -15,7 +15,7 @@ namespace midi {
|
||||
|
||||
namespace {
|
||||
|
||||
using Sample = base::HistogramBase::Sample;
|
||||
using Sample32 = base::HistogramBase::Sample32;
|
||||
using midi::mojom::PortState;
|
||||
using midi::mojom::Result;
|
||||
|
||||
|
@ -37,7 +37,7 @@ constexpr char kPreflightWarningHistogramName[] =
|
||||
|
||||
base::Bucket MakeBucket(mojom::CorsError error,
|
||||
base::HistogramBase::Count count) {
|
||||
return base::Bucket(static_cast<base::HistogramBase::Sample>(error), count);
|
||||
return base::Bucket(static_cast<base::HistogramBase::Sample32>(error), count);
|
||||
}
|
||||
|
||||
std::vector<std::pair<std::string, std::string>> MakeHeaderPairs(
|
||||
|
@ -477,7 +477,7 @@ class WebBundleURLLoaderFactory::BundleDataSource
|
||||
DCHECK(!finished_loading_);
|
||||
base::UmaHistogramCustomCounts(
|
||||
"SubresourceWebBundles.ReceivedSize",
|
||||
base::saturated_cast<base::Histogram::Sample>(buffer_.size()), 1,
|
||||
base::saturated_cast<base::Histogram::Sample32>(buffer_.size()), 1,
|
||||
50000000, 50);
|
||||
DCHECK(data_completed_closure_);
|
||||
// Defer calling |data_completed_closure_| not to run
|
||||
|
@ -60,11 +60,11 @@ bool BackgroundTracingAgentImpl::DoEmitNamedTrigger(
|
||||
|
||||
void BackgroundTracingAgentImpl::OnHistogramChanged(
|
||||
const std::string& rule_id,
|
||||
base::Histogram::Sample histogram_lower_value,
|
||||
base::Histogram::Sample histogram_upper_value,
|
||||
base::Histogram::Sample32 histogram_lower_value,
|
||||
base::Histogram::Sample32 histogram_upper_value,
|
||||
const char* histogram_name,
|
||||
uint64_t name_hash,
|
||||
base::Histogram::Sample actual_value) {
|
||||
base::Histogram::Sample32 actual_value) {
|
||||
if (actual_value < histogram_lower_value ||
|
||||
actual_value > histogram_upper_value) {
|
||||
return;
|
||||
|
@ -46,11 +46,11 @@ class COMPONENT_EXPORT(BACKGROUND_TRACING_CPP) BackgroundTracingAgentImpl
|
||||
|
||||
private:
|
||||
void OnHistogramChanged(const std::string& rule_id,
|
||||
base::Histogram::Sample reference_lower_value,
|
||||
base::Histogram::Sample reference_upper_value,
|
||||
base::Histogram::Sample32 reference_lower_value,
|
||||
base::Histogram::Sample32 reference_upper_value,
|
||||
const char* histogram_name,
|
||||
uint64_t name_hash,
|
||||
base::Histogram::Sample actual_value);
|
||||
base::Histogram::Sample32 actual_value);
|
||||
|
||||
mojo::Remote<mojom::BackgroundTracingAgentClient> client_;
|
||||
base::Time histogram_last_changed_;
|
||||
|
@ -258,7 +258,7 @@ void CustomEventRecorder::LogHistograms() {
|
||||
void CustomEventRecorder::OnMetricsSampleCallback(
|
||||
const char* histogram_name,
|
||||
uint64_t name_hash,
|
||||
base::HistogramBase::Sample sample) {
|
||||
base::HistogramBase::Sample32 sample) {
|
||||
TRACE_EVENT_INSTANT(
|
||||
kHistogramSamplesCategory, "HistogramSample",
|
||||
[&](perfetto::EventContext ctx) {
|
||||
|
@ -51,7 +51,7 @@ class COMPONENT_EXPORT(TRACING_CPP) CustomEventRecorder
|
||||
// the trace config, all the histograms will be monitored.
|
||||
static void OnMetricsSampleCallback(const char* histogram_name,
|
||||
uint64_t name_hash,
|
||||
base::HistogramBase::Sample sample);
|
||||
base::HistogramBase::Sample32 sample);
|
||||
bool IsPrivacyFilteringEnabled();
|
||||
|
||||
private:
|
||||
|
@ -288,21 +288,21 @@ void V8MetricsRecorder::AddMainThreadEvent(
|
||||
CustomCountHistogram, collection_rate_histogram, \
|
||||
("V8.GC.Cycle" priority ".CollectionRate.Full", 1, 100, 20)); \
|
||||
collection_rate_histogram.Count( \
|
||||
base::saturated_cast<base::Histogram::Sample>( \
|
||||
base::saturated_cast<base::Histogram::Sample32>( \
|
||||
100 * event.collection_rate_in_percent)); \
|
||||
\
|
||||
DEFINE_THREAD_SAFE_STATIC_LOCAL( \
|
||||
CustomCountHistogram, collection_weight_histogram, \
|
||||
("V8.GC.Cycle" priority ".CollectionWeight.Full", 1, 1000, 20)); \
|
||||
collection_weight_histogram.Count( \
|
||||
base::saturated_cast<base::Histogram::Sample>( \
|
||||
base::saturated_cast<base::Histogram::Sample32>( \
|
||||
1000 * event.collection_weight_in_percent)); \
|
||||
DEFINE_THREAD_SAFE_STATIC_LOCAL( \
|
||||
CustomCountHistogram, main_thread_collection_weight_histogram, \
|
||||
("V8.GC.Cycle" priority ".CollectionWeight.MainThread.Full", 1, 1000, \
|
||||
20)); \
|
||||
main_thread_collection_weight_histogram.Count( \
|
||||
base::saturated_cast<base::Histogram::Sample>( \
|
||||
base::saturated_cast<base::Histogram::Sample32>( \
|
||||
1000 * event.main_thread_collection_weight_in_percent)); \
|
||||
}
|
||||
|
||||
@ -400,14 +400,14 @@ void V8MetricsRecorder::AddMainThreadEvent(
|
||||
CustomCountHistogram, collection_rate_cpp_histogram, \
|
||||
("V8.GC.Cycle" priority ".CollectionRate.Full.Cpp", 1, 100, 20)); \
|
||||
collection_rate_cpp_histogram.Count( \
|
||||
base::saturated_cast<base::Histogram::Sample>( \
|
||||
base::saturated_cast<base::Histogram::Sample32>( \
|
||||
100 * event.collection_rate_cpp_in_percent)); \
|
||||
\
|
||||
DEFINE_THREAD_SAFE_STATIC_LOCAL( \
|
||||
CustomCountHistogram, collection_weight_cpp_histogram, \
|
||||
("V8.GC.Cycle" priority ".CollectionWeight.Full.Cpp", 1, 1000, 20)); \
|
||||
collection_weight_cpp_histogram.Count( \
|
||||
base::saturated_cast<base::Histogram::Sample>( \
|
||||
base::saturated_cast<base::Histogram::Sample32>( \
|
||||
1000 * event.collection_weight_cpp_in_percent)); \
|
||||
\
|
||||
DEFINE_THREAD_SAFE_STATIC_LOCAL( \
|
||||
@ -415,7 +415,7 @@ void V8MetricsRecorder::AddMainThreadEvent(
|
||||
("V8.GC.Cycle" priority ".CollectionWeight.MainThread.Full.Cpp", 1, \
|
||||
1000, 20)); \
|
||||
main_thread_collection_weight_cpp_histogram.Count( \
|
||||
base::saturated_cast<base::Histogram::Sample>( \
|
||||
base::saturated_cast<base::Histogram::Sample32>( \
|
||||
1000 * event.main_thread_collection_weight_cpp_in_percent)); \
|
||||
}
|
||||
|
||||
@ -528,7 +528,7 @@ void V8MetricsRecorder::AddMainThreadEvent(
|
||||
CustomCountHistogram, collection_rate_histogram, \
|
||||
("V8.GC.Cycle" priority ".CollectionRate.Young", 1, 100, 20)); \
|
||||
collection_rate_histogram.Count( \
|
||||
base::saturated_cast<base::Histogram::Sample>( \
|
||||
base::saturated_cast<base::Histogram::Sample32>( \
|
||||
100 * event.collection_rate_in_percent)); \
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ void HighestPmfReporter::OnReportMetrics() {
|
||||
|
||||
void HighestPmfReporter::ReportMetrics() {
|
||||
base::UmaHistogramMemoryMB(kHighestPmfMetricNames[report_count_],
|
||||
base::saturated_cast<base::Histogram::Sample>(
|
||||
base::saturated_cast<base::Histogram::Sample32>(
|
||||
current_highest_pmf_ / 1024 / 1024));
|
||||
}
|
||||
|
||||
|
@ -23,8 +23,8 @@
|
||||
|
||||
namespace {
|
||||
|
||||
inline base::HistogramBase::Sample ToSample(int64_t value) {
|
||||
return base::saturated_cast<base::HistogramBase::Sample>(value);
|
||||
inline base::HistogramBase::Sample32 ToSample(int64_t value) {
|
||||
return base::saturated_cast<base::HistogramBase::Sample32>(value);
|
||||
}
|
||||
|
||||
inline int64_t ApplyBucket(int64_t value) {
|
||||
|
@ -918,8 +918,8 @@ TEST_F(LocalFrameUkmAggregatorSimTest, VisualUpdateDelay) {
|
||||
Compositor().BeginFrame();
|
||||
histogram_tester.ExpectTotalCount("Blink.VisualUpdateDelay.UpdateTime.PreFCP",
|
||||
1);
|
||||
base::HistogramBase::Sample delay =
|
||||
base::saturated_cast<base::HistogramBase::Sample>(
|
||||
base::HistogramBase::Sample32 delay =
|
||||
base::saturated_cast<base::HistogramBase::Sample32>(
|
||||
(Compositor().LastFrameTime() -
|
||||
local_root_aggregator().LastFrameRequestTimeForTest())
|
||||
.InMicroseconds());
|
||||
|
@ -302,10 +302,10 @@ TEST_P(MainThreadScrollingReasonsTest, ReportBackgroundAttachmentFixed) {
|
||||
"Renderer4.MainThreadGestureScrollReason2"),
|
||||
testing::ElementsAre(
|
||||
base::Bucket(
|
||||
base::HistogramBase::Sample(
|
||||
base::HistogramBase::Sample32(
|
||||
cc::MainThreadScrollingReason::kScrollingOnMainForAnyReason),
|
||||
1),
|
||||
base::Bucket(base::HistogramBase::Sample(
|
||||
base::Bucket(base::HistogramBase::Sample32(
|
||||
cc::MainThreadScrollingReason::BucketIndexForTesting(
|
||||
expected_reason)),
|
||||
1)));
|
||||
|
@ -551,7 +551,7 @@ IDBRequest* IDBObjectStore::DoPut(ScriptState* script_state,
|
||||
// Records 1KB to 1GB.
|
||||
UMA_HISTOGRAM_COUNTS_1M(
|
||||
"WebCore.IndexedDB.PutValueSize2",
|
||||
base::saturated_cast<base::HistogramBase::Sample>(
|
||||
base::saturated_cast<base::HistogramBase::Sample32>(
|
||||
value_wrapper.DataLengthBeforeWrapInBytes() / 1024));
|
||||
|
||||
IDBRequest* request = IDBRequest::Create(
|
||||
|
@ -888,13 +888,13 @@ void ServiceWorkerGlobalScope::CountCacheStorageInstalledScript(
|
||||
|
||||
base::UmaHistogramCustomCounts(
|
||||
"ServiceWorker.CacheStorageInstalledScript.ScriptSize",
|
||||
base::saturated_cast<base::Histogram::Sample>(script_size), 1000, 5000000,
|
||||
base::saturated_cast<base::Histogram::Sample32>(script_size), 1000, 5000000,
|
||||
50);
|
||||
|
||||
if (script_metadata_size) {
|
||||
base::UmaHistogramCustomCounts(
|
||||
"ServiceWorker.CacheStorageInstalledScript.CachedMetadataSize",
|
||||
base::saturated_cast<base::Histogram::Sample>(script_metadata_size),
|
||||
base::saturated_cast<base::Histogram::Sample32>(script_metadata_size),
|
||||
1000, 50000000, 50);
|
||||
}
|
||||
}
|
||||
@ -1348,18 +1348,18 @@ void ServiceWorkerGlobalScope::SetIsInstalling(bool is_installing) {
|
||||
// stored in Cache storage during installation.
|
||||
base::UmaHistogramCounts1000(
|
||||
"ServiceWorker.CacheStorageInstalledScript.Count",
|
||||
base::saturated_cast<base::Histogram::Sample>(
|
||||
base::saturated_cast<base::Histogram::Sample32>(
|
||||
cache_storage_installed_script_count_));
|
||||
base::UmaHistogramCustomCounts(
|
||||
"ServiceWorker.CacheStorageInstalledScript.ScriptTotalSize",
|
||||
base::saturated_cast<base::Histogram::Sample>(
|
||||
base::saturated_cast<base::Histogram::Sample32>(
|
||||
cache_storage_installed_script_total_size_),
|
||||
1000, 50000000, 50);
|
||||
|
||||
if (cache_storage_installed_script_metadata_total_size_) {
|
||||
base::UmaHistogramCustomCounts(
|
||||
"ServiceWorker.CacheStorageInstalledScript.CachedMetadataTotalSize",
|
||||
base::saturated_cast<base::Histogram::Sample>(
|
||||
base::saturated_cast<base::Histogram::Sample32>(
|
||||
cache_storage_installed_script_metadata_total_size_),
|
||||
1000, 50000000, 50);
|
||||
}
|
||||
|
@ -667,7 +667,7 @@ void CachedStorageArea::EnsureLoaded() {
|
||||
// always above what we see in practice, since histograms can't change.
|
||||
UMA_HISTOGRAM_CUSTOM_COUNTS(
|
||||
"LocalStorage.MojoSizeInKB",
|
||||
base::saturated_cast<base::Histogram::Sample>(local_storage_size_kb), 1,
|
||||
base::saturated_cast<base::Histogram::Sample32>(local_storage_size_kb), 1,
|
||||
6 * 1024, 50);
|
||||
if (local_storage_size_kb < 100) {
|
||||
UMA_HISTOGRAM_TIMES("LocalStorage.MojoTimeToPrimeForUnder100KB",
|
||||
|
@ -108,7 +108,7 @@ void BitmapImageMetrics::CountDecodedImageDensity(const String& type,
|
||||
}
|
||||
|
||||
density_histogram->CountMany(
|
||||
base::saturated_cast<base::Histogram::Sample>(density_centi_bpp),
|
||||
base::saturated_cast<base::Histogram::Sample32>(density_centi_bpp),
|
||||
image_size_kib);
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ class ParkableImageBaseTest : public ::testing::Test {
|
||||
//
|
||||
// Checks the counts for all 3 metrics, but only checks the value for
|
||||
// "Memory.ParkableImage.Write.Size", since the others can't be easily tested.
|
||||
void ExpectWriteStatistics(base::HistogramBase::Sample sample,
|
||||
void ExpectWriteStatistics(base::HistogramBase::Sample32 sample,
|
||||
base::HistogramBase::Count expected_count) {
|
||||
histogram_tester_.ExpectTotalCount("Memory.ParkableImage.Write.Latency",
|
||||
expected_count);
|
||||
@ -170,7 +170,7 @@ class ParkableImageBaseTest : public ::testing::Test {
|
||||
//
|
||||
// Checks the counts for both metrics, but not their values, since they can't
|
||||
// be easily tested.
|
||||
void ExpectReadStatistics(base::HistogramBase::Sample sample,
|
||||
void ExpectReadStatistics(base::HistogramBase::Sample32 sample,
|
||||
base::HistogramBase::Count expected_count) {
|
||||
histogram_tester_.ExpectTotalCount("Memory.ParkableImage.Read.Latency",
|
||||
expected_count);
|
||||
|
@ -876,7 +876,7 @@ void InspectImage(
|
||||
|
||||
void TestAvifBppHistogram(const char* image_name,
|
||||
const char* histogram_name = nullptr,
|
||||
base::HistogramBase::Sample sample = 0) {
|
||||
base::HistogramBase::Sample32 sample = 0) {
|
||||
TestBppHistogram(CreateAVIFDecoder, "Avif", image_name, histogram_name,
|
||||
sample);
|
||||
}
|
||||
|
@ -878,7 +878,7 @@ void InspectImage(
|
||||
|
||||
void TestAvifBppHistogram(const char* image_name,
|
||||
const char* histogram_name = nullptr,
|
||||
base::HistogramBase::Sample sample = 0) {
|
||||
base::HistogramBase::Sample32 sample = 0) {
|
||||
TestBppHistogram(CreateAVIFDecoder, "Avif", image_name, histogram_name,
|
||||
sample);
|
||||
}
|
||||
|
@ -708,7 +708,7 @@ void ImageDecoder::UpdateBppHistogram(gfx::Size size, size_t image_size_bytes) {
|
||||
density_histogram = &density_14plus_mp_histogram;
|
||||
}
|
||||
|
||||
density_histogram->Count(base::saturated_cast<base::Histogram::Sample>(
|
||||
density_histogram->Count(base::saturated_cast<base::Histogram::Sample32>(
|
||||
density_centi_bpp.ValueOrDie()));
|
||||
}
|
||||
|
||||
|
@ -536,7 +536,7 @@ void TestBppHistogram(DecoderCreator create_decoder,
|
||||
const char* image_type,
|
||||
const char* image_name,
|
||||
const char* histogram_name,
|
||||
base::HistogramBase::Sample sample) {
|
||||
base::HistogramBase::Sample32 sample) {
|
||||
base::HistogramTester histogram_tester;
|
||||
std::unique_ptr<ImageDecoder> decoder = create_decoder();
|
||||
decoder->SetData(ReadFileToSharedBuffer(image_name), true);
|
||||
|
@ -127,7 +127,7 @@ void TestBppHistogram(DecoderCreator create_decoder,
|
||||
const char* image_type,
|
||||
const char* image_name,
|
||||
const char* histogram_name,
|
||||
base::HistogramBase::Sample sample);
|
||||
base::HistogramBase::Sample32 sample);
|
||||
|
||||
} // namespace blink
|
||||
|
||||
|
@ -106,7 +106,7 @@ void ReadYUV(size_t max_decoded_bytes,
|
||||
|
||||
void TestJpegBppHistogram(const char* image_name,
|
||||
const char* histogram_name = nullptr,
|
||||
base::HistogramBase::Sample sample = 0) {
|
||||
base::HistogramBase::Sample32 sample = 0) {
|
||||
TestBppHistogram(CreateJPEGDecoder, "Jpeg", image_name, histogram_name,
|
||||
sample);
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ void TestInvalidImage(const char* webp_file, bool parse_error_expected) {
|
||||
|
||||
void TestWebPBppHistogram(const char* image_name,
|
||||
const char* histogram_name = nullptr,
|
||||
base::HistogramBase::Sample sample = 0) {
|
||||
base::HistogramBase::Sample32 sample = 0) {
|
||||
TestBppHistogram(CreateWEBPDecoder, "WebP", image_name, histogram_name,
|
||||
sample);
|
||||
}
|
||||
|
@ -11,8 +11,8 @@
|
||||
namespace blink {
|
||||
|
||||
CustomCountHistogram::CustomCountHistogram(const char* name,
|
||||
base::HistogramBase::Sample min,
|
||||
base::HistogramBase::Sample max,
|
||||
base::HistogramBase::Sample32 min,
|
||||
base::HistogramBase::Sample32 max,
|
||||
int32_t bucket_count) {
|
||||
histogram_ = base::Histogram::FactoryGet(
|
||||
name, min, max, bucket_count,
|
||||
@ -22,17 +22,17 @@ CustomCountHistogram::CustomCountHistogram(const char* name,
|
||||
CustomCountHistogram::CustomCountHistogram(base::HistogramBase* histogram)
|
||||
: histogram_(histogram) {}
|
||||
|
||||
void CustomCountHistogram::Count(base::HistogramBase::Sample sample) {
|
||||
void CustomCountHistogram::Count(base::HistogramBase::Sample32 sample) {
|
||||
histogram_->Add(sample);
|
||||
}
|
||||
|
||||
void CustomCountHistogram::CountMany(base::HistogramBase::Sample sample,
|
||||
void CustomCountHistogram::CountMany(base::HistogramBase::Sample32 sample,
|
||||
int count) {
|
||||
histogram_->AddCount(sample, count);
|
||||
}
|
||||
|
||||
void CustomCountHistogram::CountMicroseconds(base::TimeDelta delta) {
|
||||
Count(base::saturated_cast<base::HistogramBase::Sample>(
|
||||
Count(base::saturated_cast<base::HistogramBase::Sample32>(
|
||||
delta.InMicroseconds()));
|
||||
}
|
||||
|
||||
|
@ -28,11 +28,11 @@ class PLATFORM_EXPORT CustomCountHistogram {
|
||||
public:
|
||||
// Min values should be >=1 as emitted 0s still go into the underflow bucket.
|
||||
CustomCountHistogram(const char* name,
|
||||
base::HistogramBase::Sample min,
|
||||
base::HistogramBase::Sample max,
|
||||
base::HistogramBase::Sample32 min,
|
||||
base::HistogramBase::Sample32 max,
|
||||
int32_t bucket_count);
|
||||
void Count(base::HistogramBase::Sample);
|
||||
void CountMany(base::HistogramBase::Sample, int count);
|
||||
void Count(base::HistogramBase::Sample32);
|
||||
void CountMany(base::HistogramBase::Sample32, int count);
|
||||
void CountMicroseconds(base::TimeDelta);
|
||||
|
||||
protected:
|
||||
@ -79,9 +79,9 @@ class ScopedHighResUsHistogramTimer
|
||||
static bool ShouldRecord() { return base::TimeTicks::IsHighResolution(); }
|
||||
};
|
||||
|
||||
static constexpr base::HistogramBase::Sample kTimeBasedHistogramMinSample = 1;
|
||||
static constexpr base::HistogramBase::Sample kTimeBasedHistogramMaxSample =
|
||||
static_cast<base::Histogram::Sample>(base::Seconds(10).InMicroseconds());
|
||||
static constexpr base::HistogramBase::Sample32 kTimeBasedHistogramMinSample = 1;
|
||||
static constexpr base::HistogramBase::Sample32 kTimeBasedHistogramMaxSample =
|
||||
static_cast<base::Histogram::Sample32>(base::Seconds(10).InMicroseconds());
|
||||
static constexpr int32_t kTimeBasedHistogramBucketCount = 50;
|
||||
|
||||
#define SCOPED_BLINK_UMA_HISTOGRAM_TIMER_IMPL(name, allow_cross_thread) \
|
||||
|
@ -13,8 +13,8 @@ namespace blink {
|
||||
class TestCustomCountHistogram : public CustomCountHistogram {
|
||||
public:
|
||||
TestCustomCountHistogram(const char* name,
|
||||
base::HistogramBase::Sample min,
|
||||
base::HistogramBase::Sample max,
|
||||
base::HistogramBase::Sample32 min,
|
||||
base::HistogramBase::Sample32 max,
|
||||
int32_t bucket_count)
|
||||
: CustomCountHistogram(name, min, max, bucket_count) {}
|
||||
|
||||
|
@ -3047,7 +3047,7 @@ class InputHandlerProxyMainThreadScrollingReasonTest
|
||||
touch_end_.touches_length = 1;
|
||||
}
|
||||
|
||||
base::HistogramBase::Sample GetBucketSample(uint32_t reason) {
|
||||
base::HistogramBase::Sample32 GetBucketSample(uint32_t reason) {
|
||||
uint32_t bucket = 0;
|
||||
while (reason >>= 1)
|
||||
bucket++;
|
||||
|
@ -222,7 +222,7 @@ TEST(DisplayUtilTest, GetColorSpaceFromEdid) {
|
||||
.ToString());
|
||||
histogram_tester.ExpectBucketCount(
|
||||
"DrmUtil.GetColorSpaceFromEdid.ChecksOutcome",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
EdidColorSpaceChecksOutcome::kSuccess),
|
||||
1);
|
||||
|
||||
@ -247,7 +247,7 @@ TEST(DisplayUtilTest, GetColorSpaceFromEdid) {
|
||||
.ToString());
|
||||
histogram_tester.ExpectBucketCount(
|
||||
"DrmUtil.GetColorSpaceFromEdid.ChecksOutcome",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
EdidColorSpaceChecksOutcome::kSuccess),
|
||||
2);
|
||||
|
||||
@ -272,7 +272,7 @@ TEST(DisplayUtilTest, GetColorSpaceFromEdid) {
|
||||
.ToString());
|
||||
histogram_tester.ExpectBucketCount(
|
||||
"DrmUtil.GetColorSpaceFromEdid.ChecksOutcome",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
EdidColorSpaceChecksOutcome::kSuccess),
|
||||
3);
|
||||
|
||||
@ -297,7 +297,7 @@ TEST(DisplayUtilTest, GetColorSpaceFromEdid) {
|
||||
.ToString());
|
||||
histogram_tester.ExpectBucketCount(
|
||||
"DrmUtil.GetColorSpaceFromEdid.ChecksOutcome",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
EdidColorSpaceChecksOutcome::kSuccess),
|
||||
4);
|
||||
|
||||
@ -309,7 +309,7 @@ TEST(DisplayUtilTest, GetColorSpaceFromEdid) {
|
||||
EXPECT_FALSE(no_gamma_color_space.IsValid());
|
||||
histogram_tester.ExpectBucketCount(
|
||||
"DrmUtil.GetColorSpaceFromEdid.ChecksOutcome",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
EdidColorSpaceChecksOutcome::kErrorBadGamma),
|
||||
1);
|
||||
histogram_tester.ExpectTotalCount(
|
||||
@ -351,7 +351,7 @@ TEST(DisplayUtilTest, GetInvalidColorSpaceFromEdid) {
|
||||
GetColorSpaceFromEdid(display::EdidParser(std::move(empty_edid))));
|
||||
histogram_tester.ExpectBucketCount(
|
||||
"DrmUtil.GetColorSpaceFromEdid.ChecksOutcome",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
EdidColorSpaceChecksOutcome::kErrorPrimariesAreaTooSmall),
|
||||
1);
|
||||
|
||||
@ -362,7 +362,7 @@ TEST(DisplayUtilTest, GetInvalidColorSpaceFromEdid) {
|
||||
EXPECT_FALSE(invalid_color_space.IsValid());
|
||||
histogram_tester.ExpectBucketCount(
|
||||
"DrmUtil.GetColorSpaceFromEdid.ChecksOutcome",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
EdidColorSpaceChecksOutcome::kErrorPrimariesAreaTooSmall),
|
||||
2);
|
||||
|
||||
@ -372,7 +372,7 @@ TEST(DisplayUtilTest, GetInvalidColorSpaceFromEdid) {
|
||||
EXPECT_FALSE(sst210_color_space.IsValid()) << sst210_color_space.ToString();
|
||||
histogram_tester.ExpectBucketCount(
|
||||
"DrmUtil.GetColorSpaceFromEdid.ChecksOutcome",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
EdidColorSpaceChecksOutcome::kErrorBadCoordinates),
|
||||
1);
|
||||
|
||||
@ -384,7 +384,7 @@ TEST(DisplayUtilTest, GetInvalidColorSpaceFromEdid) {
|
||||
<< sst210_color_space_2.ToString();
|
||||
histogram_tester.ExpectBucketCount(
|
||||
"DrmUtil.GetColorSpaceFromEdid.ChecksOutcome",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
EdidColorSpaceChecksOutcome::kErrorPrimariesAreaTooSmall),
|
||||
3);
|
||||
|
||||
@ -397,7 +397,7 @@ TEST(DisplayUtilTest, GetInvalidColorSpaceFromEdid) {
|
||||
<< broken_blue_color_space.ToString();
|
||||
histogram_tester.ExpectBucketCount(
|
||||
"DrmUtil.GetColorSpaceFromEdid.ChecksOutcome",
|
||||
static_cast<base::HistogramBase::Sample>(
|
||||
static_cast<base::HistogramBase::Sample32>(
|
||||
EdidColorSpaceChecksOutcome::kErrorBluePrimaryIsBroken),
|
||||
1);
|
||||
histogram_tester.ExpectTotalCount(
|
||||
|
Reference in New Issue
Block a user