Count time and transitions between devfreq frequencies in separate struct devfreq_stats for improved code readability and maintenance.
Showing the changes to include/linux (1 of 2 files). Show all
Unified · Split
| @@ -107,6 +107,20 @@ struct devfreq_dev_profile { · 106 unmodified lines | |||
| 107 | unsigned int max_state; | 107 | unsigned int max_state; |
| 108 | }; | 108 | }; |
| 109 | 109 | ||
| 110 | /** | ||
| 111 | * struct devfreq_stats - Statistics of devfreq device behavior | ||
| 112 | * @total_trans: Number of devfreq transitions. | ||
| 113 | * @trans_table: Statistics of devfreq transitions. | ||
| 114 | * @time_in_state: Statistics of devfreq states. | ||
| 115 | * @last_update: The last time stats were updated. | ||
| 116 | */ | ||
| 117 | struct devfreq_stats { | ||
| 118 | unsigned int total_trans; | ||
| 119 | unsigned int *trans_table; | ||
| 120 | u64 *time_in_state; | ||
| 121 | u64 last_update; | ||
| 122 | }; | ||
| 123 | |||
| 110 | /** | 124 | /** |
| 111 | * struct devfreq - Device devfreq structure | 125 | * struct devfreq - Device devfreq structure |
| 112 | * @node: list node - contains the devices with devfreq that have been | 126 | * @node: list node - contains the devices with devfreq that have been |
| @@ -132,10 +146,7 @@ struct devfreq_dev_profile { · 19 unmodified lines | |||
| 132 | * @suspend_freq: frequency of a device set during suspend phase. | 146 | * @suspend_freq: frequency of a device set during suspend phase. |
| 133 | * @resume_freq: frequency of a device set in resume phase. | 147 | * @resume_freq: frequency of a device set in resume phase. |
| 134 | * @suspend_count: suspend requests counter for a device. | 148 | * @suspend_count: suspend requests counter for a device. |
| 135 | * @total_trans: Number of devfreq transitions | 149 | * @stats: Statistics of devfreq device behavior |
| 136 | * @trans_table: Statistics of devfreq transitions | ||
| 137 | * @time_in_state: Statistics of devfreq states | ||
| 138 | * @last_stat_updated: The last time stat updated | ||
| 139 | * @transition_notifier_list: list head of DEVFREQ_TRANSITION_NOTIFIER notifier | 150 | * @transition_notifier_list: list head of DEVFREQ_TRANSITION_NOTIFIER notifier |
| 140 | * @nb_min: Notifier block for DEV_PM_QOS_MIN_FREQUENCY | 151 | * @nb_min: Notifier block for DEV_PM_QOS_MIN_FREQUENCY |
| 141 | * @nb_max: Notifier block for DEV_PM_QOS_MAX_FREQUENCY | 152 | * @nb_max: Notifier block for DEV_PM_QOS_MAX_FREQUENCY |
| @@ -174,11 +185,8 @@ struct devfreq { · 32 unmodified lines | |||
| 174 | unsigned long resume_freq; | 185 | unsigned long resume_freq; |
| 175 | atomic_t suspend_count; | 186 | atomic_t suspend_count; |
| 176 | 187 | ||
| 177 | /* information for device frequency transition */ | 188 | /* information for device frequency transitions */ |
| 178 | unsigned int total_trans; | 189 | struct devfreq_stats stats; |
| 179 | unsigned int *trans_table; | ||
| 180 | u64 *time_in_state; | ||
| 181 | u64 last_stat_updated; | ||
| 182 | 190 | ||
| 183 | struct srcu_notifier_head transition_notifier_list; | 191 | struct srcu_notifier_head transition_notifier_list; |
| 184 | 192 | ||