diff options
author | Sayanna Chandula <sayanna@google.com> | 2022-10-26 13:38:49 -0700 |
---|---|---|
committer | Sayanna Chandula <sayanna@google.com> | 2022-11-15 07:39:54 -0800 |
commit | 3a5fbf5f113af4a9d510da5239014226333ec71b (patch) | |
tree | b01c51ab95e91c8774e78bbf9e37ba631dc7c937 | |
parent | 4c8bb5fcf30b024c2db6275eac9179ca79b5db9f (diff) | |
download | pixel-3a5fbf5f113af4a9d510da5239014226333ec71b.tar.gz |
thermal: add traces for tskin mitigation
Add traces for temperatures, PI parameters and cdev votes
Bug: 230664512
Test: Build and boot on device. Check traces for hal
adb shell atrace --stream hal > trace.txt
Change-Id: I6070346bd21bbb5d07ff151ca1aea718cd889cf0
Signed-off-by: Sayanna Chandula <sayanna@google.com>
-rw-r--r-- | thermal/thermal-helper.cpp | 5 | ||||
-rw-r--r-- | thermal/utils/thermal_throttling.cpp | 43 |
2 files changed, 48 insertions, 0 deletions
diff --git a/thermal/thermal-helper.cpp b/thermal/thermal-helper.cpp index 85ccc5d5..c3451f4a 100644 --- a/thermal/thermal-helper.cpp +++ b/thermal/thermal-helper.cpp @@ -446,6 +446,7 @@ void ThermalHelper::updateCoolingDevices(const std::vector<std::string> &updated } } if (cooling_devices_.writeCdevFile(target_cdev, std::to_string(max_state))) { + ATRACE_INT(target_cdev.c_str(), max_state); LOG(INFO) << "Successfully update cdev " << target_cdev << " sysfs to " << max_state; } else { LOG(ERROR) << "Failed to update cdev " << target_cdev << " sysfs to " << max_state; @@ -815,7 +816,9 @@ bool ThermalHelper::readThermalSensor(std::string_view sensor_name, float *temp, !isnan(sensor_status.thermal_cached.temp)) { *temp = sensor_status.thermal_cached.temp; sensor_log->append(StringPrintf("%s:%0.f ", sensor_name.data(), *temp)); + LOG(VERBOSE) << "read " << sensor_name.data() << " from buffer, value:" << *temp; + ATRACE_INT((sensor_name.data() + std::string("-cached")).c_str(), static_cast<int>(*temp)); return true; } @@ -873,6 +876,8 @@ bool ThermalHelper::readThermalSensor(std::string_view sensor_name, float *temp, StringPrintf("%s:%0.f(%s) ", sensor_name.data(), *temp, sub_sensor_log.data())); } + ATRACE_INT(sensor_name.data(), static_cast<int>(*temp)); + { std::unique_lock<std::shared_mutex> _lock(sensor_status_map_mutex_); sensor_status.thermal_cached.temp = *temp; diff --git a/thermal/utils/thermal_throttling.cpp b/thermal/utils/thermal_throttling.cpp index fcaee8f9..0a5f926b 100644 --- a/thermal/utils/thermal_throttling.cpp +++ b/thermal/utils/thermal_throttling.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#define ATRACE_TAG (ATRACE_TAG_THERMAL | ATRACE_TAG_HAL) #include "thermal_throttling.h" @@ -168,6 +169,7 @@ float ThermalThrottling::updatePowerBudget(const Temperature_2_0 &temp, bool target_changed = false; float budget_transient = 0.0; auto &throttling_status = thermal_throttling_status_map_.at(temp.name); + std::string sensor_name = temp.name; if (curr_severity == ThrottlingSeverity::NONE) { return power_budget; @@ -231,6 +233,23 @@ float ThermalThrottling::updatePowerBudget(const Temperature_2_0 &temp, << " i=" << throttling_status.i_budget << " d=" << d << " budget transient=" << budget_transient << " control target=" << target_state; + ATRACE_INT((sensor_name + std::string("-power_budget")).c_str(), + static_cast<int>(power_budget)); + ATRACE_INT((sensor_name + std::string("-s_power")).c_str(), + static_cast<int>(sensor_info.throttling_info->s_power[target_state])); + ATRACE_INT((sensor_name + std::string("-time_elapsed_ms")).c_str(), + static_cast<int>(time_elapsed_ms.count())); + ATRACE_INT((sensor_name + std::string("-budget_transient")).c_str(), + static_cast<int>(budget_transient)); + ATRACE_INT((sensor_name + std::string("-i")).c_str(), + static_cast<int>(throttling_status.i_budget)); + ATRACE_INT((sensor_name + std::string("-target_state")).c_str(), + static_cast<int>(target_state)); + + ATRACE_INT((sensor_name + std::string("-err")).c_str(), static_cast<int>(err)); + ATRACE_INT((sensor_name + std::string("-p")).c_str(), static_cast<int>(p)); + ATRACE_INT((sensor_name + std::string("-temp")).c_str(), static_cast<int>(temp.value)); + throttling_status.prev_power_budget = power_budget; return power_budget; @@ -253,8 +272,13 @@ float ThermalThrottling::computeExcludedPower( "(%s: %0.2f mW, cdev_weight: %f)", excluded_power_info_pair.first.c_str(), last_updated_avg_power, excluded_power_info_pair.second[static_cast<size_t>(curr_severity)])); + + ATRACE_INT((excluded_power_info_pair.first + std::string("-avg_power")).c_str(), + static_cast<int>(last_updated_avg_power)); } } + + ATRACE_INT("excluded_power", static_cast<int>(excluded_power)); return excluded_power; } @@ -326,6 +350,10 @@ bool ThermalThrottling::allocatePowerToCdev( power_data_invalid = true; break; } + + ATRACE_INT((binded_cdev_info_pair.second.power_rail + std::string("-avg_power")) + .c_str(), + static_cast<int>(last_updated_avg_power)); } else { power_data_invalid = true; break; @@ -531,6 +559,13 @@ bool ThermalThrottling::throttlingReleaseUpdate( << binded_cdev_info_pair.second.power_thresholds[static_cast<int>(severity)] << ", avg power = " << avg_power; + ATRACE_INT( + (binded_cdev_info_pair.second.power_rail + std::string("-power_threshold")).c_str(), + static_cast<int>( + binded_cdev_info_pair.second.power_thresholds[static_cast<int>(severity)])); + ATRACE_INT((binded_cdev_info_pair.second.power_rail + std::string("-avg_power")).c_str(), + avg_power); + switch (binded_cdev_info_pair.second.release_logic) { case ReleaseLogic::INCREASE: if (!is_over_budget) { @@ -649,6 +684,14 @@ void ThermalThrottling::computeCoolingDevicesRequest( << " cdev_floor_with_power_link=" << cdev_floor << " cdev_ceiling=" << cdev_ceiling; + ATRACE_INT((cdev_request_pair.first + std::string("-pid_request")).c_str(), + pid_cdev_request); + ATRACE_INT((cdev_request_pair.first + std::string("-hardlimit_request")).c_str(), + hardlimit_cdev_request); + ATRACE_INT((cdev_request_pair.first + std::string("-release_step")).c_str(), release_step); + ATRACE_INT((cdev_request_pair.first + std::string("-cdev_floor")).c_str(), cdev_floor); + ATRACE_INT((cdev_request_pair.first + std::string("-cdev_ceiling")).c_str(), cdev_ceiling); + auto request_state = std::max(pid_cdev_request, hardlimit_cdev_request); if (release_step) { if (release_step >= request_state) { |