910e62b5创建于 1月15日历史提交
// 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.

module device.mojom;

import "mojo/public/mojom/base/time.mojom";

const double kDefaultOwnContributionEstimate = -1.0;

enum PressureSource {
  // TODO(crbug.com/40230901): Consider other sources.
  // For now, "cpu" is the only source.
  kCpu,
};

enum PressureState {
  // Current workloads are causing minimal pressure, allowing the
  // system to run at a lower clock frequency to preserve power.
  kNominal,
  // The system is doing fine, everything is smooth and it can
  // take on additional work without issues.
  kFair,
  // There is some serious pressure on the system, but it is
  // sustainable and the system is doing well, but it is getting
  // close to its limits.
  kSerious,
  // The system is now about to reach its limits, but it hasn’t
  // reached the limit yet.
  kCritical,
};

// Represents availability of compute resources.
struct PressureUpdate {
  PressureSource source;
  PressureData data;
  mojo_base.mojom.TimeTicks timestamp;
};

// Represents pressure combined data.
struct PressureData {
  // Global pressure value from probe from 0.0 to 1.0.
  double cpu_utilization = 0;
  // Contribution estimate of current process from 0.0 to 1.0.
  // If no data available or data out of range, the value is set to -1.0.
  double own_contribution_estimate = kDefaultOwnContributionEstimate;
};