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

// Copyright 2022 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.h"

#include <string>

#include "base/metrics/histogram_functions.h"
#include "base/strings/strcat.h"
#include "chrome/browser/metrics/power/process_metrics_recorder_util.h"
#include "chrome/browser/performance_manager/public/user_tuning/battery_saver_mode_manager.h"

namespace {

constexpr const char* kBatteryDischargeRateMilliwattsHistogramName =;
constexpr const char* kBatteryDischargeRateRelativeHistogramName =;
constexpr const char* kBatteryDischargeModeHistogramName =;
#if BUILDFLAG(IS_WIN)
constexpr const char* kHasPreciseBatteryDischargeGranularity =
    "Power.HasPreciseBatteryDischargeGranularity";
constexpr const char* kBatteryDischargeRatePreciseMilliwattsHistogramName =
    "Power.BatteryDischargeRatePreciseMilliwatts";
constexpr const char* kBatteryDischargeRateMilliwattsTenMinutesHistogramName =
    "Power.BatteryDischargeRateMilliwatts6.TenMinutes";
constexpr const char* kBatteryDischargeModeTenMinutesHistogramName =
    "Power.BatteryDischargeMode5.TenMinutes";
#endif  // BUILDFLAG(IS_WIN)

}  // namespace

void ReportAggregatedProcessMetricsHistograms(
    const ProcessMonitor::Metrics& aggregated_process_metrics,
    const std::vector<const char*>& suffixes) {}

int64_t CalculateDischargeRateMilliwatts(
    const base::BatteryLevelProvider::BatteryState& previous_battery_state,
    const base::BatteryLevelProvider::BatteryState& new_battery_state,
    base::TimeDelta interval_duration) {}

int64_t CalculateDischargeRateRelative(
    const base::BatteryLevelProvider::BatteryState& previous_battery_state,
    const base::BatteryLevelProvider::BatteryState& new_battery_state,
    base::TimeDelta interval_duration) {}

BatteryDischarge GetBatteryDischargeDuringInterval(
    const std::optional<base::BatteryLevelProvider::BatteryState>&
        previous_battery_state,
    const std::optional<base::BatteryLevelProvider::BatteryState>&
        new_battery_state,
    base::TimeDelta interval_duration) {}

void ReportBatteryHistograms(
    base::TimeDelta interval_duration,
    BatteryDischarge battery_discharge,
    bool is_initial_interval,
    const std::vector<const char*>& scenario_suffixes) {}

#if BUILDFLAG(IS_WIN)
void ReportBatteryHistogramsTenMinutesInterval(
    base::TimeDelta interval_duration,
    BatteryDischarge battery_discharge) {
  base::UmaHistogramEnumeration(kBatteryDischargeModeTenMinutesHistogramName,
                                battery_discharge.mode);
  if (battery_discharge.mode == BatteryDischargeMode::kDischarging) {
    DCHECK(battery_discharge.rate_milliwatts.has_value());
    base::UmaHistogramCounts100000(
        kBatteryDischargeRateMilliwattsTenMinutesHistogramName,
        *battery_discharge.rate_milliwatts);
  }
}
#endif  // BUILDFLAG(IS_WIN)