Upload upstream chromium 71.0.3578.0
[platform/framework/web/chromium-efl.git] / components / ukm / persisted_logs_metrics_impl.cc
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "components/ukm/persisted_logs_metrics_impl.h"
6
7 #include "base/metrics/histogram_macros.h"
8
9 namespace ukm {
10
11 PersistedLogsMetricsImpl::PersistedLogsMetricsImpl() = default;
12
13 PersistedLogsMetricsImpl::~PersistedLogsMetricsImpl() = default;
14
15 void PersistedLogsMetricsImpl::RecordLogReadStatus(
16     metrics::PersistedLogsMetrics::LogReadStatus status) {
17   UMA_HISTOGRAM_ENUMERATION("UKM.PersistentLogRecall.Status", status,
18                             metrics::PersistedLogsMetrics::END_RECALL_STATUS);
19 }
20
21 void PersistedLogsMetricsImpl::RecordCompressionRatio(size_t compressed_size,
22                                                       size_t original_size) {
23   UMA_HISTOGRAM_PERCENTAGE(
24       "UKM.ProtoCompressionRatio",
25       static_cast<int>(100 * compressed_size / original_size));
26 }
27
28 void PersistedLogsMetricsImpl::RecordDroppedLogSize(size_t size) {
29   UMA_HISTOGRAM_COUNTS_1M("UKM.UnsentLogs.DroppedSize", static_cast<int>(size));
30 }
31
32 void PersistedLogsMetricsImpl::RecordDroppedLogsNum(int dropped_logs_num) {
33   UMA_HISTOGRAM_COUNTS_10000("UKM.UnsentLogs.NumDropped", dropped_logs_num);
34 }
35
36 }  // namespace ukm