From d89137ed24cd315d98cf6b6a394c8a3521091312 Mon Sep 17 00:00:00 2001 From: Tej Singh Date: Mon, 26 Mar 2018 14:51:40 -0700 Subject: Temperature atom: Use int instead of float. Changes the temperature atom to use an int instead of a float because metrics and anomaly detection assume the data will be an int or a long. Bug: b/74011562 Test: statsd temperature CTS test Change-Id: I6e5845a40c28aefd30c2be9709c6f9de1783cf02 --- cmds/statsd/src/atoms.proto | 7 ++++--- cmds/statsd/src/external/ResourceThermalManagerPuller.cpp | 4 +++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto index f74188f5e69f..725c951e9265 100644 --- a/cmds/statsd/src/atoms.proto +++ b/cmds/statsd/src/atoms.proto @@ -1903,7 +1903,8 @@ message FullBatteryCapacity { } /** - * Pulls the temperature of various parts of the device, in Celsius. + * Pulls the temperature of various parts of the device. + * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303. * * Pulled from: * frameworks/base/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp @@ -1915,6 +1916,6 @@ message Temperature { // The name of the temperature source. Eg. CPU0 optional string sensor_name = 2; - // Temperature in degrees C. - optional float temperature_C = 3; + // Temperature in tenths of a degree C. + optional int32 temperature_dC = 3; } diff --git a/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp b/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp index b3acdfcfce33..33a17deabc5a 100644 --- a/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp +++ b/cmds/statsd/src/external/ResourceThermalManagerPuller.cpp @@ -120,7 +120,9 @@ bool ResourceThermalManagerPuller::PullInternal(vector>* da wallClockTimestampNs, elapsedTimestampNs); ptr->write((static_cast(temps[i].type))); ptr->write(temps[i].name); - ptr->write(temps[i].currentValue); + // Convert the temperature to an int. + int32_t temp = static_cast(temps[i].currentValue * 10); + ptr->write(temp); ptr->init(); data->push_back(ptr); } -- cgit v1.2.3-59-g8ed1b