chromium/chrome/browser/metrics/power/power_metrics_reporter.cc

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/metrics/power/power_metrics_reporter.h"

#include <optional>
#include <vector>

#include "base/functional/bind.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/strcat.h"
#include "base/strings/string_util.h"
#include "base/time/time.h"
#include "base/trace_event/named_trigger.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "chrome/browser/lifetime/browser_shutdown.h"
#include "chrome/browser/metrics/power/power_metrics.h"
#include "chrome/browser/metrics/power/power_metrics_constants.h"
#include "chrome/browser/metrics/power/process_metrics_recorder_util.h"
#include "chrome/browser/metrics/power/process_monitor.h"
#include "chrome/browser/metrics/usage_scenario/usage_scenario_data_store.h"
#include "services/metrics/public/cpp/metrics_utils.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_source_id.h"

namespace {

// Calculates the UKM bucket |value| falls in and returns it. This uses an
// exponential bucketing approach with an exponent base of 1.3, resulting in
// 17 buckets for an interval of 120 seconds.
int64_t GetBucketForSample(base::TimeDelta value) {}

// Returns the histogram suffix to be used given the MonitoredProcessType.
const char* GetMetricSuffixFromProcessType(MonitoredProcessType type) {}

}  // namespace

PowerMetricsReporter::PowerMetricsReporter(
    ProcessMonitor* process_monitor,
    UsageScenarioDataStore* long_usage_scenario_data_store,
    std::unique_ptr<base::BatteryLevelProvider> battery_level_provider)
    :{}

PowerMetricsReporter::~PowerMetricsReporter() = default;

// static
int64_t PowerMetricsReporter::GetBucketForSampleForTesting(
    base::TimeDelta value) {}

void PowerMetricsReporter::OnFirstBatteryStateSampled(
    const std::optional<base::BatteryLevelProvider::BatteryState>&
        battery_state) {}

void PowerMetricsReporter::StartNextLongInterval() {}

void PowerMetricsReporter::OnLongIntervalEnd() {}

void PowerMetricsReporter::OnMetricsSampled(
    MonitoredProcessType type,
    const ProcessMonitor::Metrics& metrics) {}

void PowerMetricsReporter::OnAggregatedMetricsSampled(
    const ProcessMonitor::Metrics& metrics) {}

void PowerMetricsReporter::OnBatteryAndAggregatedProcessMetricsSampled(
    const ProcessMonitor::Metrics& aggregated_process_metrics,
    base::TimeDelta interval_duration,
    const std::optional<base::BatteryLevelProvider::BatteryState>&
        new_battery_state) {}

void PowerMetricsReporter::ReportMetrics(
    const UsageScenarioDataStore::IntervalData& long_interval_data,
    base::TimeDelta interval_duration,
    const ProcessMonitor::Metrics& aggregated_process_metrics) {}

void PowerMetricsReporter::ReportBatterySpecificMetrics(
    const UsageScenarioDataStore::IntervalData& long_interval_data,
    base::TimeDelta interval_duration,
    const ProcessMonitor::Metrics& aggregated_process_metrics,
    BatteryDischarge battery_discharge) {}

void PowerMetricsReporter::ReportBatteryUKMs(
    const UsageScenarioDataStore::IntervalData& interval_data,
    const ProcessMonitor::Metrics& metrics,
    base::TimeDelta interval_duration,
    BatteryDischarge battery_discharge) {}