blob: 3792b2e2f4a82fccf8330bd88aefd421d985e3d3 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * drivers/cpufreq/cpufreq_stats.c
3 *
4 * Copyright (C) 2003-2004 Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>.
Dave Jones0a829c52009-01-18 01:49:04 -05005 * (C) 2004 Zou Nan hai <nanhai.zou@intel.com>.
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#include <linux/cpu.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#include <linux/cpufreq.h>
Paul Gortmaker5c720d372011-05-27 13:23:32 -040014#include <linux/module.h>
Viresh Kumar5ff0a262013-08-06 22:53:03 +053015#include <linux/slab.h>
Frederic Weisbeckerbfc3f022014-03-05 16:33:42 +010016#include <linux/cputime.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070017
18static spinlock_t cpufreq_stats_lock;
19
Linus Torvalds1da177e2005-04-16 15:20:36 -070020struct cpufreq_stats {
21 unsigned int cpu;
22 unsigned int total_trans;
Viresh Kumarbb176f72013-06-19 14:19:33 +053023 unsigned long long last_time;
Linus Torvalds1da177e2005-04-16 15:20:36 -070024 unsigned int max_state;
25 unsigned int state_num;
26 unsigned int last_index;
Viresh Kumar1e7586a2012-10-26 00:51:21 +020027 u64 *time_in_state;
Linus Torvalds1da177e2005-04-16 15:20:36 -070028 unsigned int *freq_table;
29#ifdef CONFIG_CPU_FREQ_STAT_DETAILS
30 unsigned int *trans_table;
31#endif
32};
33
Viresh Kumar2aba0c12015-01-06 21:09:05 +053034static int cpufreq_stats_update(struct cpufreq_stats *stat)
Linus Torvalds1da177e2005-04-16 15:20:36 -070035{
Viresh Kumar95313472015-01-06 21:09:03 +053036 unsigned long long cur_time = get_jiffies_64();
Venkatesh Pallipadi58f1df22005-05-25 14:46:50 -070037
Linus Torvalds1da177e2005-04-16 15:20:36 -070038 spin_lock(&cpufreq_stats_lock);
Linus Torvalds1da177e2005-04-16 15:20:36 -070039 if (stat->time_in_state)
Martin Schwidefsky64861632011-12-15 14:56:09 +010040 stat->time_in_state[stat->last_index] +=
41 cur_time - stat->last_time;
Venkatesh Pallipadi58f1df22005-05-25 14:46:50 -070042 stat->last_time = cur_time;
Linus Torvalds1da177e2005-04-16 15:20:36 -070043 spin_unlock(&cpufreq_stats_lock);
44 return 0;
45}
46
Dave Jones0a829c52009-01-18 01:49:04 -050047static ssize_t show_total_trans(struct cpufreq_policy *policy, char *buf)
Linus Torvalds1da177e2005-04-16 15:20:36 -070048{
Viresh Kumara9aaf292015-01-13 11:34:00 +053049 return sprintf(buf, "%d\n", policy->stats->total_trans);
Linus Torvalds1da177e2005-04-16 15:20:36 -070050}
51
Dave Jones0a829c52009-01-18 01:49:04 -050052static ssize_t show_time_in_state(struct cpufreq_policy *policy, char *buf)
Linus Torvalds1da177e2005-04-16 15:20:36 -070053{
Viresh Kumara9aaf292015-01-13 11:34:00 +053054 struct cpufreq_stats *stat = policy->stats;
Linus Torvalds1da177e2005-04-16 15:20:36 -070055 ssize_t len = 0;
56 int i;
Viresh Kumara9aaf292015-01-13 11:34:00 +053057
Viresh Kumar2aba0c12015-01-06 21:09:05 +053058 cpufreq_stats_update(stat);
Linus Torvalds1da177e2005-04-16 15:20:36 -070059 for (i = 0; i < stat->state_num; i++) {
Dave Jones32ee8c32006-02-28 00:43:23 -050060 len += sprintf(buf + len, "%u %llu\n", stat->freq_table[i],
Dave Jones0a829c52009-01-18 01:49:04 -050061 (unsigned long long)
Andreas Schwaba857c0b2013-09-07 18:35:08 +020062 jiffies_64_to_clock_t(stat->time_in_state[i]));
Linus Torvalds1da177e2005-04-16 15:20:36 -070063 }
64 return len;
65}
66
67#ifdef CONFIG_CPU_FREQ_STAT_DETAILS
Dave Jones0a829c52009-01-18 01:49:04 -050068static ssize_t show_trans_table(struct cpufreq_policy *policy, char *buf)
Linus Torvalds1da177e2005-04-16 15:20:36 -070069{
Viresh Kumara9aaf292015-01-13 11:34:00 +053070 struct cpufreq_stats *stat = policy->stats;
Linus Torvalds1da177e2005-04-16 15:20:36 -070071 ssize_t len = 0;
72 int i, j;
73
Viresh Kumar2aba0c12015-01-06 21:09:05 +053074 cpufreq_stats_update(stat);
Venkatesh Pallipadi58f1df22005-05-25 14:46:50 -070075 len += snprintf(buf + len, PAGE_SIZE - len, " From : To\n");
76 len += snprintf(buf + len, PAGE_SIZE - len, " : ");
Linus Torvalds1da177e2005-04-16 15:20:36 -070077 for (i = 0; i < stat->state_num; i++) {
78 if (len >= PAGE_SIZE)
79 break;
Venkatesh Pallipadi58f1df22005-05-25 14:46:50 -070080 len += snprintf(buf + len, PAGE_SIZE - len, "%9u ",
81 stat->freq_table[i]);
82 }
83 if (len >= PAGE_SIZE)
Cesar Eduardo Barros25aca342008-02-16 08:41:25 -020084 return PAGE_SIZE;
Venkatesh Pallipadi58f1df22005-05-25 14:46:50 -070085
86 len += snprintf(buf + len, PAGE_SIZE - len, "\n");
87
88 for (i = 0; i < stat->state_num; i++) {
89 if (len >= PAGE_SIZE)
90 break;
91
92 len += snprintf(buf + len, PAGE_SIZE - len, "%9u: ",
Linus Torvalds1da177e2005-04-16 15:20:36 -070093 stat->freq_table[i]);
94
Viresh Kumarbb176f72013-06-19 14:19:33 +053095 for (j = 0; j < stat->state_num; j++) {
Linus Torvalds1da177e2005-04-16 15:20:36 -070096 if (len >= PAGE_SIZE)
97 break;
Venkatesh Pallipadi58f1df22005-05-25 14:46:50 -070098 len += snprintf(buf + len, PAGE_SIZE - len, "%9u ",
Linus Torvalds1da177e2005-04-16 15:20:36 -070099 stat->trans_table[i*stat->max_state+j]);
100 }
Cesar Eduardo Barros25aca342008-02-16 08:41:25 -0200101 if (len >= PAGE_SIZE)
102 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103 len += snprintf(buf + len, PAGE_SIZE - len, "\n");
104 }
Cesar Eduardo Barros25aca342008-02-16 08:41:25 -0200105 if (len >= PAGE_SIZE)
106 return PAGE_SIZE;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107 return len;
108}
Viresh Kumardf18e502013-02-04 11:38:52 +0000109cpufreq_freq_attr_ro(trans_table);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700110#endif
111
Viresh Kumardf18e502013-02-04 11:38:52 +0000112cpufreq_freq_attr_ro(total_trans);
113cpufreq_freq_attr_ro(time_in_state);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114
115static struct attribute *default_attrs[] = {
Viresh Kumardf18e502013-02-04 11:38:52 +0000116 &total_trans.attr,
117 &time_in_state.attr,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118#ifdef CONFIG_CPU_FREQ_STAT_DETAILS
Viresh Kumardf18e502013-02-04 11:38:52 +0000119 &trans_table.attr,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700120#endif
121 NULL
122};
123static struct attribute_group stats_attr_group = {
124 .attrs = default_attrs,
125 .name = "stats"
126};
127
Dave Jones0a829c52009-01-18 01:49:04 -0500128static int freq_table_get_index(struct cpufreq_stats *stat, unsigned int freq)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700129{
130 int index;
131 for (index = 0; index < stat->max_state; index++)
132 if (stat->freq_table[index] == freq)
133 return index;
134 return -1;
135}
136
Viresh Kumar2d135942014-01-07 07:10:12 +0530137static void __cpufreq_stats_free_table(struct cpufreq_policy *policy)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138{
Viresh Kumara9aaf292015-01-13 11:34:00 +0530139 struct cpufreq_stats *stat = policy->stats;
Viresh Kumarb8eed8a2013-01-14 13:23:03 +0000140
Viresh Kumara9aaf292015-01-13 11:34:00 +0530141 /* Already freed */
Viresh Kumar2d135942014-01-07 07:10:12 +0530142 if (!stat)
143 return;
144
145 pr_debug("%s: Free stat table\n", __func__);
146
147 sysfs_remove_group(&policy->kobj, &stats_attr_group);
148 kfree(stat->time_in_state);
149 kfree(stat);
Viresh Kumara9aaf292015-01-13 11:34:00 +0530150 policy->stats = NULL;
steven finney98586ed2011-05-02 11:29:17 -0700151}
152
Viresh Kumar2d135942014-01-07 07:10:12 +0530153static void cpufreq_stats_free_table(unsigned int cpu)
steven finney98586ed2011-05-02 11:29:17 -0700154{
Viresh Kumar2d135942014-01-07 07:10:12 +0530155 struct cpufreq_policy *policy;
Dirk Brandewie633d47d2013-02-06 09:02:12 -0800156
Viresh Kumar2d135942014-01-07 07:10:12 +0530157 policy = cpufreq_cpu_get(cpu);
viresh kumar187da1d2013-03-22 10:13:52 +0000158 if (!policy)
Dirk Brandewie633d47d2013-02-06 09:02:12 -0800159 return;
160
Viresh Kumarf93dbbb2015-01-06 21:09:04 +0530161 __cpufreq_stats_free_table(policy);
viresh kumar187da1d2013-03-22 10:13:52 +0000162
viresh kumar187da1d2013-03-22 10:13:52 +0000163 cpufreq_cpu_put(policy);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700164}
165
Saravana Kannanad4c2302014-02-27 17:58:36 -0800166static int __cpufreq_stats_create_table(struct cpufreq_policy *policy)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700167{
Stratos Karafotis041526f2014-04-25 23:15:38 +0300168 unsigned int i, count = 0, ret = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700169 struct cpufreq_stats *stat;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700170 unsigned int alloc_size;
171 unsigned int cpu = policy->cpu;
Stratos Karafotis041526f2014-04-25 23:15:38 +0300172 struct cpufreq_frequency_table *pos, *table;
Saravana Kannanad4c2302014-02-27 17:58:36 -0800173
174 table = cpufreq_frequency_get_table(cpu);
175 if (unlikely(!table))
176 return 0;
177
Viresh Kumarb8c67442015-01-06 21:09:01 +0530178 /* stats already initialized */
Viresh Kumara9aaf292015-01-13 11:34:00 +0530179 if (policy->stats)
Viresh Kumarb8c67442015-01-06 21:09:01 +0530180 return -EEXIST;
181
Viresh Kumard5b73cd2013-08-06 22:53:06 +0530182 stat = kzalloc(sizeof(*stat), GFP_KERNEL);
Dave Jones0a829c52009-01-18 01:49:04 -0500183 if ((stat) == NULL)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700184 return -ENOMEM;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700185
Saravana Kannanb24a5b62014-02-27 17:58:34 -0800186 ret = sysfs_create_group(&policy->kobj, &stats_attr_group);
Dave Jones0a829c52009-01-18 01:49:04 -0500187 if (ret)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700188 goto error_out;
189
190 stat->cpu = cpu;
Viresh Kumara9aaf292015-01-13 11:34:00 +0530191 policy->stats = stat;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700192
Stratos Karafotis041526f2014-04-25 23:15:38 +0300193 cpufreq_for_each_valid_entry(pos, table)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700194 count++;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700195
Viresh Kumar1e7586a2012-10-26 00:51:21 +0200196 alloc_size = count * sizeof(int) + count * sizeof(u64);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700197
198#ifdef CONFIG_CPU_FREQ_STAT_DETAILS
199 alloc_size += count * count * sizeof(int);
200#endif
201 stat->max_state = count;
Dave Jonese98df502005-10-20 15:17:43 -0700202 stat->time_in_state = kzalloc(alloc_size, GFP_KERNEL);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700203 if (!stat->time_in_state) {
204 ret = -ENOMEM;
Saravana Kannan0b7528d2014-02-27 17:58:35 -0800205 goto error_alloc;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700206 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700207 stat->freq_table = (unsigned int *)(stat->time_in_state + count);
208
209#ifdef CONFIG_CPU_FREQ_STAT_DETAILS
210 stat->trans_table = stat->freq_table + count;
211#endif
Stratos Karafotis041526f2014-04-25 23:15:38 +0300212 i = 0;
213 cpufreq_for_each_valid_entry(pos, table)
214 if (freq_table_get_index(stat, pos->frequency) == -1)
215 stat->freq_table[i++] = pos->frequency;
216 stat->state_num = i;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700217 spin_lock(&cpufreq_stats_lock);
Venkatesh Pallipadi58f1df22005-05-25 14:46:50 -0700218 stat->last_time = get_jiffies_64();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700219 stat->last_index = freq_table_get_index(stat, policy->cur);
220 spin_unlock(&cpufreq_stats_lock);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700221 return 0;
Saravana Kannan0b7528d2014-02-27 17:58:35 -0800222error_alloc:
223 sysfs_remove_group(&policy->kobj, &stats_attr_group);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700224error_out:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700225 kfree(stat);
Viresh Kumara9aaf292015-01-13 11:34:00 +0530226 policy->stats = NULL;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700227 return ret;
228}
229
Viresh Kumarb3f9ff82014-01-07 07:10:13 +0530230static void cpufreq_stats_create_table(unsigned int cpu)
231{
232 struct cpufreq_policy *policy;
Viresh Kumarb3f9ff82014-01-07 07:10:13 +0530233
234 /*
235 * "likely(!policy)" because normally cpufreq_stats will be registered
236 * before cpufreq driver
237 */
238 policy = cpufreq_cpu_get(cpu);
239 if (likely(!policy))
240 return;
241
Saravana Kannanad4c2302014-02-27 17:58:36 -0800242 __cpufreq_stats_create_table(policy);
Viresh Kumarb3f9ff82014-01-07 07:10:13 +0530243
244 cpufreq_cpu_put(policy);
245}
246
Viresh Kumarb8eed8a2013-01-14 13:23:03 +0000247static void cpufreq_stats_update_policy_cpu(struct cpufreq_policy *policy)
248{
Viresh Kumara9aaf292015-01-13 11:34:00 +0530249 policy->stats->cpu = policy->cpu;
Viresh Kumarb8eed8a2013-01-14 13:23:03 +0000250}
251
Dave Jones0a829c52009-01-18 01:49:04 -0500252static int cpufreq_stat_notifier_policy(struct notifier_block *nb,
253 unsigned long val, void *data)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700254{
Viresh Kumarfcd7af92014-01-07 07:10:10 +0530255 int ret = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700256 struct cpufreq_policy *policy = data;
Viresh Kumarb8eed8a2013-01-14 13:23:03 +0000257
258 if (val == CPUFREQ_UPDATE_POLICY_CPU) {
259 cpufreq_stats_update_policy_cpu(policy);
260 return 0;
261 }
262
Viresh Kumarfcd7af92014-01-07 07:10:10 +0530263 if (val == CPUFREQ_CREATE_POLICY)
Saravana Kannanad4c2302014-02-27 17:58:36 -0800264 ret = __cpufreq_stats_create_table(policy);
Viresh Kumar2d135942014-01-07 07:10:12 +0530265 else if (val == CPUFREQ_REMOVE_POLICY)
266 __cpufreq_stats_free_table(policy);
Viresh Kumarfcd7af92014-01-07 07:10:10 +0530267
268 return ret;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700269}
270
Dave Jones0a829c52009-01-18 01:49:04 -0500271static int cpufreq_stat_notifier_trans(struct notifier_block *nb,
272 unsigned long val, void *data)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700273{
274 struct cpufreq_freqs *freq = data;
Viresh Kumara9aaf292015-01-13 11:34:00 +0530275 struct cpufreq_policy *policy = cpufreq_cpu_get(freq->cpu);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700276 struct cpufreq_stats *stat;
277 int old_index, new_index;
278
Viresh Kumara9aaf292015-01-13 11:34:00 +0530279 if (!policy) {
280 pr_err("%s: No policy found\n", __func__);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700281 return 0;
Viresh Kumara9aaf292015-01-13 11:34:00 +0530282 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700283
Viresh Kumara9aaf292015-01-13 11:34:00 +0530284 if (val != CPUFREQ_POSTCHANGE)
285 goto put_policy;
286
287 if (!policy->stats) {
288 pr_debug("%s: No stats found\n", __func__);
289 goto put_policy;
290 }
291
292 stat = policy->stats;
Venkatesh Pallipadi8edc59d92006-12-19 12:58:55 -0800293
Shaohua Li6501faf2008-04-27 13:46:56 -0700294 old_index = stat->last_index;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700295 new_index = freq_table_get_index(stat, freq->new);
296
Konrad Rzeszutek Wilk46a310b2011-06-16 15:36:38 -0400297 /* We can't do stat->time_in_state[-1]= .. */
298 if (old_index == -1 || new_index == -1)
Viresh Kumara9aaf292015-01-13 11:34:00 +0530299 goto put_policy;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700300
Viresh Kumar2aba0c12015-01-06 21:09:05 +0530301 cpufreq_stats_update(stat);
Konrad Rzeszutek Wilk46a310b2011-06-16 15:36:38 -0400302
303 if (old_index == new_index)
Viresh Kumara9aaf292015-01-13 11:34:00 +0530304 goto put_policy;
Venkatesh Pallipadi8edc59d92006-12-19 12:58:55 -0800305
Linus Torvalds1da177e2005-04-16 15:20:36 -0700306 spin_lock(&cpufreq_stats_lock);
307 stat->last_index = new_index;
308#ifdef CONFIG_CPU_FREQ_STAT_DETAILS
309 stat->trans_table[old_index * stat->max_state + new_index]++;
310#endif
311 stat->total_trans++;
312 spin_unlock(&cpufreq_stats_lock);
Viresh Kumara9aaf292015-01-13 11:34:00 +0530313
314put_policy:
315 cpufreq_cpu_put(policy);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700316 return 0;
317}
318
319static struct notifier_block notifier_policy_block = {
320 .notifier_call = cpufreq_stat_notifier_policy
321};
322
323static struct notifier_block notifier_trans_block = {
324 .notifier_call = cpufreq_stat_notifier_trans
325};
326
Dave Jones0a829c52009-01-18 01:49:04 -0500327static int __init cpufreq_stats_init(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700328{
329 int ret;
330 unsigned int cpu;
Ashok Rajc32b6b82005-10-30 14:59:54 -0800331
Linus Torvalds1da177e2005-04-16 15:20:36 -0700332 spin_lock_init(&cpufreq_stats_lock);
Dave Jones0a829c52009-01-18 01:49:04 -0500333 ret = cpufreq_register_notifier(&notifier_policy_block,
334 CPUFREQ_POLICY_NOTIFIER);
335 if (ret)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700336 return ret;
337
Viresh Kumarb3f9ff82014-01-07 07:10:13 +0530338 for_each_online_cpu(cpu)
339 cpufreq_stats_create_table(cpu);
340
Dave Jones0a829c52009-01-18 01:49:04 -0500341 ret = cpufreq_register_notifier(&notifier_trans_block,
342 CPUFREQ_TRANSITION_NOTIFIER);
343 if (ret) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700344 cpufreq_unregister_notifier(&notifier_policy_block,
345 CPUFREQ_POLICY_NOTIFIER);
Konstantin Khlebnikov56836fb2012-12-15 00:22:02 +0100346 for_each_online_cpu(cpu)
347 cpufreq_stats_free_table(cpu);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700348 return ret;
349 }
350
Linus Torvalds1da177e2005-04-16 15:20:36 -0700351 return 0;
352}
Dave Jones0a829c52009-01-18 01:49:04 -0500353static void __exit cpufreq_stats_exit(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700354{
355 unsigned int cpu;
Ashok Rajc32b6b82005-10-30 14:59:54 -0800356
Linus Torvalds1da177e2005-04-16 15:20:36 -0700357 cpufreq_unregister_notifier(&notifier_policy_block,
358 CPUFREQ_POLICY_NOTIFIER);
359 cpufreq_unregister_notifier(&notifier_trans_block,
360 CPUFREQ_TRANSITION_NOTIFIER);
Viresh Kumar2d135942014-01-07 07:10:12 +0530361 for_each_online_cpu(cpu)
Satyam Sharma55395ae2007-10-02 13:28:15 -0700362 cpufreq_stats_free_table(cpu);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700363}
364
Dave Jones0a829c52009-01-18 01:49:04 -0500365MODULE_AUTHOR("Zou Nan hai <nanhai.zou@intel.com>");
Viresh Kumar00d0b292015-01-06 21:09:00 +0530366MODULE_DESCRIPTION("Export cpufreq stats via sysfs");
Dave Jones0a829c52009-01-18 01:49:04 -0500367MODULE_LICENSE("GPL");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700368
369module_init(cpufreq_stats_init);
370module_exit(cpufreq_stats_exit);