* [PATCH] cpufreq-stats: fix time_in_state statistics
@ 2013-08-02 18:31 Andreas Schwab
2013-08-05 6:45 ` Viresh Kumar
0 siblings, 1 reply; 2+ messages in thread
From: Andreas Schwab @ 2013-08-02 18:31 UTC (permalink / raw)
To: cpufreq
The time_in_state numbers are in units of jiffies, not cputime.
Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
---
drivers/cpufreq/cpufreq_stats.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
index d37568c..10e6138 100644
--- a/drivers/cpufreq/cpufreq_stats.c
+++ b/drivers/cpufreq/cpufreq_stats.c
@@ -81,7 +81,7 @@ static ssize_t show_time_in_state(struct cpufreq_policy *policy, char *buf)
for (i = 0; i < stat->state_num; i++) {
len += sprintf(buf + len, "%u %llu\n", stat->freq_table[i],
(unsigned long long)
- cputime64_to_clock_t(stat->time_in_state[i]));
+ jiffies_64_to_clock_t(stat->time_in_state[i]));
}
return len;
}
--
1.8.3.4
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] cpufreq-stats: fix time_in_state statistics
2013-08-02 18:31 [PATCH] cpufreq-stats: fix time_in_state statistics Andreas Schwab
@ 2013-08-05 6:45 ` Viresh Kumar
0 siblings, 0 replies; 2+ messages in thread
From: Viresh Kumar @ 2013-08-05 6:45 UTC (permalink / raw)
To: Andreas Schwab, Rafael J. Wysocki; +Cc: cpufreq, Linux PM list
Please see MAINTAINERS file to get list of people/lists you need
to send your patch to.
On Sat, Aug 3, 2013 at 12:01 AM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> The time_in_state numbers are in units of jiffies, not cputime.
>
> Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
> ---
> drivers/cpufreq/cpufreq_stats.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
> index d37568c..10e6138 100644
> --- a/drivers/cpufreq/cpufreq_stats.c
> +++ b/drivers/cpufreq/cpufreq_stats.c
> @@ -81,7 +81,7 @@ static ssize_t show_time_in_state(struct cpufreq_policy *policy, char *buf)
> for (i = 0; i < stat->state_num; i++) {
> len += sprintf(buf + len, "%u %llu\n", stat->freq_table[i],
> (unsigned long long)
> - cputime64_to_clock_t(stat->time_in_state[i]));
> + jiffies_64_to_clock_t(stat->time_in_state[i]));
I tried to go to the history a bit but really couldn't make out what was
the real intention initially:
Following patches did this change:
- stat->time_in_state[stat->last_index] +=
- delta_time(stat->last_time, jiffies);
- stat->last_time = jiffies;
+ stat->time_in_state[stat->last_index] =
+ cputime64_add(stat->time_in_state[stat->last_index],
+ cputime_sub(cur_time, stat->last_time));
commit 58f1df25403988b73d7129fcd2c4d4c24017f1af
Author: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Date: Wed May 25 14:46:50 2005 -0700
[PATCH] cpufreq-stats driver updates
And it was then simplified by:
commit 648616343cdbe904c585a6c12e323d3b3c72e46f
Author: Martin Schwidefsky <schwidefsky@de.ibm.com>
Date: Thu Dec 15 14:56:09 2011 +0100
[S390] cputime: add sparse checking and cleanup
- stat->time_in_state[stat->last_index] =
- cputime64_add(stat->time_in_state[stat->last_index],
- cputime_sub(cur_time, stat->last_time));
+ stat->time_in_state[stat->last_index] +=
+ cur_time - stat->last_time;
And obviously cur_time is in jiffies... I am okay with your patch
if Rafael doesn't see any issues with it...
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-08-05 6:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-02 18:31 [PATCH] cpufreq-stats: fix time_in_state statistics Andreas Schwab
2013-08-05 6:45 ` Viresh Kumar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox