chromium/chrome/browser/ui/performance_controls/performance_controls_metrics.h

// 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.

#ifndef CHROME_BROWSER_UI_PERFORMANCE_CONTROLS_PERFORMANCE_CONTROLS_METRICS_H_
#define CHROME_BROWSER_UI_PERFORMANCE_CONTROLS_PERFORMANCE_CONTROLS_METRICS_H_

#include "base/time/time.h"
#include "base/timer/timer.h"
#include "chrome/browser/performance_manager/public/user_tuning/performance_detection_manager.h"
#include "components/metrics/daily_event.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"

// Enums for histograms:
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
enum class BatterySaverBubbleActionType {};

enum class InterventionMessageTriggerResult {};

enum class InterventionBubbleActionType {};

enum class MemorySaverBubbleActionType {};

enum class MemorySaverChipState {};
// End of enums for histograms.

class PerformanceInterventionMetricsReporter {};

void RecordBatterySaverBubbleAction(BatterySaverBubbleActionType type);
void RecordBatterySaverIPHOpenSettings(bool success);
void RecordMemorySaverBubbleAction(MemorySaverBubbleActionType type);
void RecordMemorySaverIPHEnableMode(bool success);
void RecordMemorySaverChipState(MemorySaverChipState type);

void RecordInterventionMessageCount(
    performance_manager::user_tuning::PerformanceDetectionManager::ResourceType
        resource_type,
    PrefService* pref_service);
void RecordInterventionRateLimitedCount(
    performance_manager::user_tuning::PerformanceDetectionManager::ResourceType
        resource_type,
    PrefService* pref_service);
void RecordInterventionTriggerResult(
    performance_manager::user_tuning::PerformanceDetectionManager::ResourceType
        resource_type,
    InterventionMessageTriggerResult reason);
void RecordInterventionToolbarButtonClicked();
void RecordInterventionBubbleClosedReason(
    performance_manager::user_tuning::PerformanceDetectionManager::ResourceType
        resource_type,
    InterventionBubbleActionType type);
void RecordCpuHealthStatusAfterDiscard(
    base::TimeDelta time_after_discard,
    performance_manager::user_tuning::PerformanceDetectionManager::HealthLevel
        health_level);
void RecordCpuUsageBeforeDiscard(int cpu_usage);
void RecordSuggestedTabShownCount(int count);
void RecordTabRemovedFromTabList(int count_after_removal);
void RecordNumberOfDiscardedTabs(int count);

#endif  // CHROME_BROWSER_UI_PERFORMANCE_CONTROLS_PERFORMANCE_CONTROLS_METRICS_H_