aboutsummaryrefslogtreecommitdiff
path: root/drivers/devfreq
diff options
context:
space:
mode:
authoranarkia1976 <stefano.villa1976@gmail.com>2015-06-15 09:05:41 +0200
committerMoyster <oysterized@gmail.com>2016-09-13 13:22:59 +0200
commitc1dbf8dc1a42609a9a2e2f6974b7cb69d1742279 (patch)
tree7ff13e1fd23b4506c0ef56ec4559ccf7f7c0e6d2 /drivers/devfreq
parenta41db80dc4eab68864abbd9c5fc2fdf75fae5813 (diff)
devfreq: gpu: added simple time_in_state stats
* All Credits to @andip71 * Modded to similar cpu stats table
Diffstat (limited to 'drivers/devfreq')
-rw-r--r--drivers/devfreq/devfreq.c21
1 files changed, 21 insertions, 0 deletions
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),
{ },
};