Commit 718a0a85 authored by Paul Moy's avatar Paul Moy Committed by Commit Bot

ServiceConnection: add CPU temperature channels

Extend the existing CpuInfo mojom struct to include labels and
temperature readings from the device's temperature channels. This
provides another avenue for retrieving this data, separate from
the Chrome APIs. The goal is not to remove the Chrome APIs, but rather
provide an easier, unified way of getting this data for clients
already using cros_healthd. Those clients now only need to integrate
with one component as opposed to both cros_healthd and the Chrome
APIs.

Bug: chromium:1131602
Change-Id: Id531b2bab4b72ef60f272d21f4e92e0d321c44bc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2506451Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarMaksim Ivanov <emaxx@chromium.org>
Commit-Queue: Paul Moy <pmoy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#822516}
parent fe635a27
......@@ -159,6 +159,8 @@ constexpr char kFakeVersionReleaseChannel[] = "stable-channel";
// CPU test values:
constexpr uint32_t kFakeNumTotalThreads = 8;
constexpr char kFakeModelName[] = "fake_cpu_model_name";
constexpr int32_t kFakeCpuTemperature = -189;
constexpr char kFakeCpuTemperatureLabel[] = "Fake CPU temperature";
constexpr cros_healthd::CpuArchitectureEnum kFakeMojoArchitecture =
cros_healthd::CpuArchitectureEnum::kX86_64;
constexpr em::CpuInfo::Architecture kFakeProtoArchitecture =
......@@ -551,9 +553,17 @@ std::vector<cros_healthd::PhysicalCpuInfoPtr> CreatePhysicalCpu() {
return physical_cpus;
}
std::vector<cros_healthd::CpuTemperatureChannelPtr> CreateTemperatureChannel() {
std::vector<cros_healthd::CpuTemperatureChannelPtr> cpu_temps;
cpu_temps.push_back(cros_healthd::CpuTemperatureChannel::New(
kFakeCpuTemperatureLabel, kFakeCpuTemperature));
return cpu_temps;
}
cros_healthd::CpuResultPtr CreateCpuResult() {
return cros_healthd::CpuResult::NewCpuInfo(cros_healthd::CpuInfo::New(
kFakeNumTotalThreads, kFakeMojoArchitecture, CreatePhysicalCpu()));
kFakeNumTotalThreads, kFakeMojoArchitecture, CreatePhysicalCpu(),
CreateTemperatureChannel()));
}
cros_healthd::TimezoneResultPtr CreateTimezoneResult() {
......
......@@ -286,6 +286,8 @@ struct CpuInfo {
CpuArchitectureEnum architecture;
// Information about the device's physical CPUs.
array<PhysicalCpuInfo> physical_cpus;
// Information about the CPU temperature channels.
array<CpuTemperatureChannel> temperature_channels;
};
// Information related to a particular physical CPU.
......@@ -325,6 +327,14 @@ struct CpuCStateInfo {
uint64 time_in_state_since_last_boot_us;
};
// Information about a single CPU temperature channel.
struct CpuTemperatureChannel {
// Temperature channel label, if found on the device.
string? label;
// CPU temperature in Celsius.
int32 temperature_celsius;
};
// Timezone probe result. Can either be populated with the TimezoneInfo or an
// error retrieving the information.
union TimezoneResult {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment