5#include "flutter/fml/cpu_affinity.h"
6#include "flutter/fml/build_config.h"
13#include "flutter/fml/platform/android/cpu_affinity.h"
35 : cpu_speeds_(
std::move(
data)) {
36 std::optional<int64_t> max_speed = std::nullopt;
37 std::optional<int64_t> min_speed = std::nullopt;
38 for (
const auto&
data : cpu_speeds_) {
39 if (!max_speed.has_value() ||
data.speed > max_speed.value()) {
40 max_speed =
data.speed;
42 if (!min_speed.has_value() ||
data.speed < min_speed.value()) {
43 min_speed =
data.speed;
46 if (!max_speed.has_value() || !min_speed.has_value() ||
47 min_speed.value() == max_speed.value()) {
50 const int64_t max_speed_value = max_speed.value();
51 const int64_t min_speed_value = min_speed.value();
53 for (
const auto&
data : cpu_speeds_) {
54 if (
data.speed == max_speed_value) {
55 performance_.push_back(
data.index);
57 not_performance_.push_back(
data.index);
59 if (
data.speed == min_speed_value) {
60 efficiency_.push_back(
data.index);
79 return not_performance_;
CPUSpeedTracker(std::vector< CpuIndexAndSpeed > data)
const std::vector< size_t > & GetIndices(CpuAffinity affinity) const
Return the set of CPU indices for the requested CPU affinity.
bool IsValid() const
The class is valid if it has more than one CPU index and a distinct set of efficiency or performance ...
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
@ kPerformance
Request CPU affinity for the performance cores.
@ kEfficiency
Request CPU affinity for the efficiency cores.
@ kNotPerformance
Request affinity for all non-performance cores.
std::optional< int64_t > ReadIntFromFile(const std::string &path)
std::optional< size_t > AndroidEfficiencyCoreCount()
Android specific implementation of EfficiencyCoreCount.
bool RequestAffinity(CpuAffinity affinity)
Request the given affinity for the current thread.
bool AndroidRequestAffinity(CpuAffinity affinity)
Android specific implementation of RequestAffinity.
std::optional< size_t > EfficiencyCoreCount()
Request count of efficiency cores.
std::shared_ptr< const fml::Mapping > data