| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "ThermalManager.h" | 8 #include "ThermalManager.h" |
| 9 | 9 |
| 10 #include "SkOSFile.h" | 10 #include "SkOSFile.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 88 |
| 89 ThermalManager::TripPoint::TripPoint(SkString thermalZoneRoot, SkString pointNam
e, | 89 ThermalManager::TripPoint::TripPoint(SkString thermalZoneRoot, SkString pointNam
e, |
| 90 int32_t threshold) | 90 int32_t threshold) |
| 91 : fThermalZoneRoot(thermalZoneRoot) | 91 : fThermalZoneRoot(thermalZoneRoot) |
| 92 , fPointName(pointName) { | 92 , fPointName(pointName) { |
| 93 SkString fullPath(thermalZoneRoot); | 93 SkString fullPath(thermalZoneRoot); |
| 94 fullPath.appendf("/%s", pointName.c_str()); | 94 fullPath.appendf("/%s", pointName.c_str()); |
| 95 fPoint = OpenFileAndReadInt32(fullPath.c_str()); | 95 fPoint = OpenFileAndReadInt32(fullPath.c_str()); |
| 96 fBase = GetTemp(fThermalZoneRoot); | 96 fBase = GetTemp(fThermalZoneRoot); |
| 97 fThreshold = threshold; | 97 fThreshold = threshold; |
| 98 fDisabled = fBase >= fPoint + fThreshold; // We disable any trip point whic
h start off | 98 fDisabled = fBase + fThreshold >= fPoint; // We disable any trip point whic
h start off |
| 99 // triggered | 99 // triggered |
| 100 if (!fDisabled) { | 100 if (!fDisabled) { |
| 101 SkDebugf("Trip point %s base - %d trip point-%d\n", fullPath.c_str(), | 101 SkDebugf("Trip point %s base - %d trip point-%d\n", fullPath.c_str(), |
| 102 fBase, fPoint); | 102 fBase, fPoint); |
| 103 } | 103 } |
| 104 } | 104 } |
| 105 | 105 |
| 106 bool ThermalManager::TripPoint::willTrip() { | 106 bool ThermalManager::TripPoint::willTrip() { |
| 107 int32_t currentTemp = GetTemp(fThermalZoneRoot); | 107 int32_t currentTemp = GetTemp(fThermalZoneRoot); |
| 108 bool wouldTrip = !fDisabled && currentTemp + fThreshold >= fPoint; | 108 bool wouldTrip = !fDisabled && currentTemp + fThreshold >= fPoint; |
| 109 | 109 |
| 110 if (wouldTrip) { | 110 if (wouldTrip) { |
| 111 SkDebugf("%s/%s would trip {%d,%d,%d,%d}\n", fThermalZoneRoot.c_str(), | 111 SkDebugf("%s/%s would trip {%d,%d,%d,%d}\n", fThermalZoneRoot.c_str(), |
| 112 fPointName.c_str(), fBase, currentTemp, fPoint, fThreshold); | 112 fPointName.c_str(), fBase, currentTemp, fPoint, fThreshold); |
| 113 } | 113 } |
| 114 return wouldTrip; | 114 return wouldTrip; |
| 115 } | 115 } |
| 116 | 116 |
| 117 #endif | 117 #endif |
| OLD | NEW |