History

PM / devfreq: Move statistics to separate struct devfreq_stats

Count time and transitions between devfreq frequencies in separate struct devfreq_stats for improved code readability and maintenance.

Kamil Konieczny committed 6 years ago

Commit 1ebd0bc1 parent 14a34392 files · +40 −30Browse files

Showing the changes to include/linux (1 of 2 files). Show all

Unified · Split

include/linux/devfreq.h+17−9
@@ -107,6 +107,20 @@ struct devfreq_dev_profile { · 106 unmodified lines
107107 unsigned int max_state;
108108 };
109109
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+
110124 /**
111125 * struct devfreq - Device devfreq structure
112126 * @node: list node - contains the devices with devfreq that have been
@@ -132,10 +146,7 @@ struct devfreq_dev_profile { · 19 unmodified lines
132146 * @suspend_freq: frequency of a device set during suspend phase.
133147 * @resume_freq: frequency of a device set in resume phase.
134148 * @suspend_count: suspend requests counter for a device.
135− * @total_trans: Number of devfreq transitions
136− * @trans_table: Statistics of devfreq transitions
137− * @time_in_state: Statistics of devfreq states
138− * @last_stat_updated: The last time stat updated
149+ * @stats: Statistics of devfreq device behavior
139150 * @transition_notifier_list: list head of DEVFREQ_TRANSITION_NOTIFIER notifier
140151 * @nb_min: Notifier block for DEV_PM_QOS_MIN_FREQUENCY
141152 * @nb_max: Notifier block for DEV_PM_QOS_MAX_FREQUENCY
@@ -174,11 +185,8 @@ struct devfreq { · 32 unmodified lines
174185 unsigned long resume_freq;
175186 atomic_t suspend_count;
176187
177− /* information for device frequency transition */
178− unsigned int total_trans;
179− unsigned int *trans_table;
180− u64 *time_in_state;
181− u64 last_stat_updated;
188+ /* information for device frequency transitions */
189+ struct devfreq_stats stats;
182190
183191 struct srcu_notifier_head transition_notifier_list;
184192