From c1dbf8dc1a42609a9a2e2f6974b7cb69d1742279 Mon Sep 17 00:00:00 2001 From: anarkia1976 Date: Mon, 15 Jun 2015 09:05:41 +0200 Subject: devfreq: gpu: added simple time_in_state stats * All Credits to @andip71 * Modded to similar cpu stats table --- drivers/devfreq/devfreq.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'drivers/devfreq/devfreq.c') diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index faa879fd0..3b49b7948 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -941,6 +941,26 @@ static ssize_t show_trans_table(struct device *dev, struct device_attribute *att return len; } +static ssize_t show_time_in_state(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct devfreq *devfreq = to_devfreq(dev); + + ssize_t len = 0; + int i, err; + unsigned int max_state = devfreq->profile->max_state; + + err = devfreq_update_status(devfreq, devfreq->previous_freq); + if (err) + return 0; + + for (i = 0; i < max_state; i++) { + len += sprintf(buf + len, "%u %u\n", devfreq->profile->freq_table[i], + jiffies_to_msecs(devfreq->time_in_state[i])); + } + return len; +} + static struct device_attribute devfreq_attrs[] = { __ATTR(governor, S_IRUGO | S_IWUSR, show_governor, store_governor), __ATTR(available_governors, S_IRUGO, show_available_governors, NULL), @@ -952,6 +972,7 @@ static struct device_attribute devfreq_attrs[] = { __ATTR(min_freq, S_IRUGO | S_IWUSR, show_min_freq, store_min_freq), __ATTR(max_freq, S_IRUGO | S_IWUSR, show_max_freq, store_max_freq), __ATTR(trans_stat, S_IRUGO, show_trans_table, NULL), + __ATTR(time_in_state, S_IRUGO, show_time_in_state, NULL), { }, }; -- cgit v1.2.3