@@ -94,7 +94,6 @@ struct cdev_record {
9494 * @trip_temp: trip temperature at mitigation start
9595 * @trip_hyst: trip hysteresis at mitigation start
9696 * @count: the number of times the zone temperature was above the trip point
97- * @max: maximum recorded temperature above the trip point
9897 * @min: minimum recorded temperature above the trip point
9998 * @avg: average temperature above the trip point
10099 */
@@ -104,7 +103,6 @@ struct trip_stats {
104103 int trip_temp ;
105104 int trip_hyst ;
106105 int count ;
107- int max ;
108106 int min ;
109107 int avg ;
110108};
@@ -122,12 +120,14 @@ struct trip_stats {
122120 * @timestamp: first trip point crossed the way up
123121 * @duration: total duration of the mitigation episode
124122 * @node: a list element to be added to the list of tz events
123+ * @max_temp: maximum zone temperature during this episode
125124 * @trip_stats: per trip point statistics, flexible array
126125 */
127126struct tz_episode {
128127 ktime_t timestamp ;
129128 ktime_t duration ;
130129 struct list_head node ;
130+ int max_temp ;
131131 struct trip_stats trip_stats [];
132132};
133133
@@ -561,11 +561,11 @@ static struct tz_episode *thermal_debugfs_tz_event_alloc(struct thermal_zone_dev
561561 INIT_LIST_HEAD (& tze -> node );
562562 tze -> timestamp = now ;
563563 tze -> duration = KTIME_MIN ;
564+ tze -> max_temp = INT_MIN ;
564565
565566 for (i = 0 ; i < tz -> num_trips ; i ++ ) {
566567 tze -> trip_stats [i ].trip_temp = THERMAL_TEMP_INVALID ;
567568 tze -> trip_stats [i ].min = INT_MAX ;
568- tze -> trip_stats [i ].max = INT_MIN ;
569569 }
570570
571571 return tze ;
@@ -738,11 +738,13 @@ void thermal_debug_update_trip_stats(struct thermal_zone_device *tz)
738738
739739 tze = list_first_entry (& tz_dbg -> tz_episodes , struct tz_episode , node );
740740
741+ if (tz -> temperature > tze -> max_temp )
742+ tze -> max_temp = tz -> temperature ;
743+
741744 for (i = 0 ; i < tz_dbg -> nr_trips ; i ++ ) {
742745 int trip_id = tz_dbg -> trips_crossed [i ];
743746 struct trip_stats * trip_stats = & tze -> trip_stats [trip_id ];
744747
745- trip_stats -> max = max (trip_stats -> max , tz -> temperature );
746748 trip_stats -> min = min (trip_stats -> min , tz -> temperature );
747749 trip_stats -> avg += (tz -> temperature - trip_stats -> avg ) /
748750 ++ trip_stats -> count ;
@@ -798,10 +800,10 @@ static int tze_seq_show(struct seq_file *s, void *v)
798800 c = '=' ;
799801 }
800802
801- seq_printf (s , ",-Mitigation at %llums, duration%c%llums\n" ,
802- ktime_to_ms (tze -> timestamp ), c , duration_ms );
803+ seq_printf (s , ",-Mitigation at %llums, duration%c%llums, max. temp=%dm°C \n" ,
804+ ktime_to_ms (tze -> timestamp ), c , duration_ms , tze -> max_temp );
803805
804- seq_printf (s , "| trip | type | temp(m°C) | hyst(m°C) | duration(ms) | avg(m°C) | min(m°C) | max(m°C) | \n" );
806+ seq_printf (s , "| trip | type | temp(m°C) | hyst(m°C) | duration(ms) | avg(m°C) | min(m°C) |\n" );
805807
806808 for_each_trip_desc (tz , td ) {
807809 const struct thermal_trip * trip = & td -> trip ;
@@ -842,15 +844,14 @@ static int tze_seq_show(struct seq_file *s, void *v)
842844 c = ' ' ;
843845 }
844846
845- seq_printf (s , "| %*d | %*s | %*d | %*d | %c%*lld | %*d | %*d | %*d | \n" ,
847+ seq_printf (s , "| %*d | %*s | %*d | %*d | %c%*lld | %*d | %*d |\n" ,
846848 4 , trip_id ,
847849 8 , type ,
848850 9 , trip_stats -> trip_temp ,
849851 9 , trip_stats -> trip_hyst ,
850852 c , 11 , duration_ms ,
851853 9 , trip_stats -> avg ,
852- 9 , trip_stats -> min ,
853- 9 , trip_stats -> max );
854+ 9 , trip_stats -> min );
854855 }
855856
856857 return 0 ;
0 commit comments