Commit 451909df authored by rajendrant's avatar rajendrant Committed by Commit Bot

Convert contenttype data use metrics to use ScaledLinearHistogram

Bug: 782233
Change-Id: I4e0e8d06dd8d2be5613fd221a541fec67a9857c2
Reviewed-on: https://chromium-review.googlesource.com/1111471Reviewed-by: default avatarRyan Sturm <ryansturm@chromium.org>
Commit-Queue: rajendrant <rajendrant@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569697}
parent 84710832
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "components/data_use_measurement/core/data_use_measurement.h" #include "components/data_use_measurement/core/data_use_measurement.h"
#include "base/lazy_instance.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "base/metrics/sparse_histogram.h" #include "base/metrics/sparse_histogram.h"
...@@ -441,22 +442,12 @@ void DataUseMeasurement::RecordContentTypeHistogram( ...@@ -441,22 +442,12 @@ void DataUseMeasurement::RecordContentTypeHistogram(
: (!is_tab_visible ? DataUseUserData::VIDEO_TABBACKGROUND : (!is_tab_visible ? DataUseUserData::VIDEO_TABBACKGROUND
: DataUseUserData::VIDEO); : DataUseUserData::VIDEO);
} }
// Use the more primitive STATIC_HISTOGRAM_POINTER_BLOCK macro because the
// simple UMA_HISTOGRAM_ENUMERATION macros don't expose 'AddKiB'.
if (is_user_traffic) { if (is_user_traffic) {
STATIC_HISTOGRAM_POINTER_BLOCK( UMA_HISTOGRAM_SCALED_ENUMERATION("DataUse.ContentType.UserTrafficKB",
"DataUse.ContentType.UserTrafficKB", AddKiB(content_type, bytes), content_type, bytes, 1024);
base::LinearHistogram::FactoryGet(
"DataUse.ContentType.UserTrafficKB", 1, DataUseUserData::TYPE_MAX,
DataUseUserData::TYPE_MAX + 1,
base::HistogramBase::kUmaTargetedHistogramFlag));
} else { } else {
STATIC_HISTOGRAM_POINTER_BLOCK( UMA_HISTOGRAM_SCALED_ENUMERATION("DataUse.ContentType.ServicesKB",
"DataUse.ContentType.ServicesKB", AddKiB(content_type, bytes), content_type, bytes, 1024);
base::LinearHistogram::FactoryGet(
"DataUse.ContentType.ServicesKB", 1, DataUseUserData::TYPE_MAX,
DataUseUserData::TYPE_MAX + 1,
base::HistogramBase::kUmaTargetedHistogramFlag));
} }
} }
......
...@@ -88,7 +88,7 @@ class DataUseUserData : public base::SupportsUserData::Data { ...@@ -88,7 +88,7 @@ class DataUseUserData : public base::SupportsUserData::Data {
VIDEO_APPBACKGROUND = 10, VIDEO_APPBACKGROUND = 10,
VIDEO_TABBACKGROUND = 11, VIDEO_TABBACKGROUND = 11,
VIDEO = 12, VIDEO = 12,
TYPE_MAX = 13, kMaxValue = 13,
}; };
// The state of the application. Only available on Android and on other // The state of the application. Only available on Android and on other
......
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