mirror of
https://github.com/torvalds/linux.git
synced 2026-05-24 07:03:03 +02:00
thermal/debugfs: Compute maximum temperature for mitigation episode as a whole
Notice that the maximum temperature above the trip point must be the same for all of the trip points involved in a given mitigation episode, so it need not be computerd for each of them separately. It is sufficient to compute the maximum temperature for the mitigation episode as a whole and print it accordingly, so do that. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
This commit is contained in:
parent
993c87047d
commit
881c084fc9
|
|
@ -94,7 +94,6 @@ struct cdev_record {
|
|||
* @trip_temp: trip temperature at mitigation start
|
||||
* @trip_hyst: trip hysteresis at mitigation start
|
||||
* @count: the number of times the zone temperature was above the trip point
|
||||
* @max: maximum recorded temperature above the trip point
|
||||
* @min: minimum recorded temperature above the trip point
|
||||
* @avg: average temperature above the trip point
|
||||
*/
|
||||
|
|
@ -104,7 +103,6 @@ struct trip_stats {
|
|||
int trip_temp;
|
||||
int trip_hyst;
|
||||
int count;
|
||||
int max;
|
||||
int min;
|
||||
int avg;
|
||||
};
|
||||
|
|
@ -122,12 +120,14 @@ struct trip_stats {
|
|||
* @timestamp: first trip point crossed the way up
|
||||
* @duration: total duration of the mitigation episode
|
||||
* @node: a list element to be added to the list of tz events
|
||||
* @max_temp: maximum zone temperature during this episode
|
||||
* @trip_stats: per trip point statistics, flexible array
|
||||
*/
|
||||
struct tz_episode {
|
||||
ktime_t timestamp;
|
||||
ktime_t duration;
|
||||
struct list_head node;
|
||||
int max_temp;
|
||||
struct trip_stats trip_stats[];
|
||||
};
|
||||
|
||||
|
|
@ -561,11 +561,11 @@ static struct tz_episode *thermal_debugfs_tz_event_alloc(struct thermal_zone_dev
|
|||
INIT_LIST_HEAD(&tze->node);
|
||||
tze->timestamp = now;
|
||||
tze->duration = KTIME_MIN;
|
||||
tze->max_temp = INT_MIN;
|
||||
|
||||
for (i = 0; i < tz->num_trips; i++) {
|
||||
tze->trip_stats[i].trip_temp = THERMAL_TEMP_INVALID;
|
||||
tze->trip_stats[i].min = INT_MAX;
|
||||
tze->trip_stats[i].max = INT_MIN;
|
||||
}
|
||||
|
||||
return tze;
|
||||
|
|
@ -738,11 +738,13 @@ void thermal_debug_update_trip_stats(struct thermal_zone_device *tz)
|
|||
|
||||
tze = list_first_entry(&tz_dbg->tz_episodes, struct tz_episode, node);
|
||||
|
||||
if (tz->temperature > tze->max_temp)
|
||||
tze->max_temp = tz->temperature;
|
||||
|
||||
for (i = 0; i < tz_dbg->nr_trips; i++) {
|
||||
int trip_id = tz_dbg->trips_crossed[i];
|
||||
struct trip_stats *trip_stats = &tze->trip_stats[trip_id];
|
||||
|
||||
trip_stats->max = max(trip_stats->max, tz->temperature);
|
||||
trip_stats->min = min(trip_stats->min, tz->temperature);
|
||||
trip_stats->avg += (tz->temperature - trip_stats->avg) /
|
||||
++trip_stats->count;
|
||||
|
|
@ -798,10 +800,10 @@ static int tze_seq_show(struct seq_file *s, void *v)
|
|||
c = '=';
|
||||
}
|
||||
|
||||
seq_printf(s, ",-Mitigation at %llums, duration%c%llums\n",
|
||||
ktime_to_ms(tze->timestamp), c, duration_ms);
|
||||
seq_printf(s, ",-Mitigation at %llums, duration%c%llums, max. temp=%dm°C\n",
|
||||
ktime_to_ms(tze->timestamp), c, duration_ms, tze->max_temp);
|
||||
|
||||
seq_printf(s, "| trip | type | temp(m°C) | hyst(m°C) | duration(ms) | avg(m°C) | min(m°C) | max(m°C) |\n");
|
||||
seq_printf(s, "| trip | type | temp(m°C) | hyst(m°C) | duration(ms) | avg(m°C) | min(m°C) |\n");
|
||||
|
||||
for_each_trip_desc(tz, td) {
|
||||
const struct thermal_trip *trip = &td->trip;
|
||||
|
|
@ -842,15 +844,14 @@ static int tze_seq_show(struct seq_file *s, void *v)
|
|||
c = ' ';
|
||||
}
|
||||
|
||||
seq_printf(s, "| %*d | %*s | %*d | %*d | %c%*lld | %*d | %*d | %*d |\n",
|
||||
seq_printf(s, "| %*d | %*s | %*d | %*d | %c%*lld | %*d | %*d |\n",
|
||||
4 , trip_id,
|
||||
8, type,
|
||||
9, trip_stats->trip_temp,
|
||||
9, trip_stats->trip_hyst,
|
||||
c, 11, duration_ms,
|
||||
9, trip_stats->avg,
|
||||
9, trip_stats->min,
|
||||
9, trip_stats->max);
|
||||
9, trip_stats->min);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user