Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1515846
| Path | csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Viresh Kumar <viresh.kumar@linaro.org> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2 2/2] cpufreq: stats: clear statistics |
| Date | Mon, 07 Nov 2016 05:40:02 +0100 |
| Message-ID | <sAJSW-6w9-5@gated-at.bofh.it> (permalink) |
| References | <szQ0q-4l3-3@gated-at.bofh.it> <szQ0q-4l3-25@gated-at.bofh.it> |
| X-Original-To | Markus Mayer <code@mmayer.net> |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=p0kplGhLu5zgcdKNJ+lsRRG2AMGKUdlFLeA/pbz8CI0=; b=ghWVhzU+Gj2ncZ+iRxBy8lp6cNBNL7WskjAsILtjXeoypK6ozl4FG5LwO+rK/ftaIz KJoMmsElw/lgh9eKvJOOSxEIX8laP9RkH/Kr68OfiNy1OKsPCBT+QJxT6rvTXL8ZzvZn pyli+q6luoj31xRSXUfZ9kp+y2w1xjdTj+I2Y= |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=p0kplGhLu5zgcdKNJ+lsRRG2AMGKUdlFLeA/pbz8CI0=; b=DfXiB0GfNYgtd/2bl5593pwoJmi6p8/uBSiXn0yJpSAF6/zieYKEE9V9gdpA6wOdR7 d9aR/vtE2F6jneX5jCtItHEDjVbLWR9LnFzVABex4gBjPhuK6wKGMkOB7x63bQr0SDej NMLvHhPhQQ3zVDi0hC/4uYLSSMBCXHvKCjDVS+nvuS6ii30+IrX9737/XasWu9ig3xBH VKdRQtb/84MfMIDQkViVOcpuYKe9fcrZGM9a6bAlq9AUatykpi8Ge4eXakiiIaNDoEXP cHJbQZjqf8cktzKaN5H0IhOeajxYvGJmC2zGibc9TPDnTQ2GlD3/qvANFloyI29JAmqH VpSg== |
| X-Gm-Message-State | ABUngvfrPV6m7gIQKPG+U+fhIILweUzYq+duDICqw8kPh0EylrzLjQoUfb4uMU7xC2xrOpam |
| X-Received | by 10.99.4.213 with SMTP id 204mr7920898pge.77.1478493509526; Sun, 06 Nov 2016 20:38:29 -0800 (PST) |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| User-Agent | Mutt/1.5.24 (2015-08-30) |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 82 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | "Rafael J . Wysocki" <rjw@rjwysocki.net>, Power Management List <linux-pm@vger.kernel.org>, Broadcom Kernel List <bcm-kernel-feedback-list@broadcom.com>, Linux Kernel Mailing List <linux-kernel@vger.kernel.org>, Markus Mayer <mmayer@broadcom.com> |
| X-Original-Date | Mon, 7 Nov 2016 10:08:26 +0530 |
| X-Original-Message-ID | <20161107043826.GC21030@vireshk-i7> |
| X-Original-References | <20161104165536.20088-1-code@mmayer.net> <20161104165536.20088-3-code@mmayer.net> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1515846 |
Show key headers only | View raw
On 04-11-16, 09:55, Markus Mayer wrote:
> From: Markus Mayer <mmayer@broadcom.com>
>
> Allow CPUfreq statistics to be cleared by writing anything to
> /sys/.../cpufreq/stats/reset.
>
> Signed-off-by: Markus Mayer <mmayer@broadcom.com>
> ---
> Documentation/cpu-freq/cpufreq-stats.txt | 6 ++++++
> drivers/cpufreq/cpufreq_stats.c | 22 ++++++++++++++++++++++
> 2 files changed, 28 insertions(+)
>
> diff --git a/Documentation/cpu-freq/cpufreq-stats.txt b/Documentation/cpu-freq/cpufreq-stats.txt
> index 8d9773f..3c355f6 100644
> --- a/Documentation/cpu-freq/cpufreq-stats.txt
> +++ b/Documentation/cpu-freq/cpufreq-stats.txt
> @@ -44,11 +44,17 @@ the stats driver insertion.
> total 0
> drwxr-xr-x 2 root root 0 May 14 16:06 .
> drwxr-xr-x 3 root root 0 May 14 15:58 ..
> +--w------- 1 root root 4096 May 14 16:06 reset
> -r--r--r-- 1 root root 4096 May 14 16:06 time_in_state
> -r--r--r-- 1 root root 4096 May 14 16:06 total_trans
> -r--r--r-- 1 root root 4096 May 14 16:06 trans_table
> --------------------------------------------------------------------------------
>
> +- reset
> +Write-only attribute that can be used to reset the stat counters. This can be
> +useful for evaluating system behaviour under different governors without the
> +need for a reboot.
> +
> - time_in_state
> This gives the amount of time spent in each of the frequencies supported by
> this CPU. The cat output will have "<frequency> <time>" pair in each line, which
> diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
> index 06d3abd..66419e6 100644
> --- a/drivers/cpufreq/cpufreq_stats.c
> +++ b/drivers/cpufreq/cpufreq_stats.c
> @@ -41,6 +41,18 @@ static int cpufreq_stats_update(struct cpufreq_stats *stats)
> return 0;
> }
>
> +static void cpufreq_stats_clear_table(struct cpufreq_stats *stats)
> +{
> + unsigned int count = stats->max_state;
> +
> + memset(stats->time_in_state, 0, count * sizeof(u64));
> +#ifdef CONFIG_CPU_FREQ_STAT_DETAILS
> + memset(stats->trans_table, 0, count * count * sizeof(int));
> +#endif
> + stats->last_time = get_jiffies_64();
> + stats->total_trans = 0;
> +}
> +
> static ssize_t show_total_trans(struct cpufreq_policy *policy, char *buf)
> {
> return sprintf(buf, "%d\n", policy->stats->total_trans);
> @@ -64,6 +76,14 @@ static ssize_t show_time_in_state(struct cpufreq_policy *policy, char *buf)
> return len;
> }
>
> +static ssize_t store_reset(struct cpufreq_policy *policy, const char *buf,
> + size_t count)
> +{
> + /* We don't care what is written to the attribute. */
> + cpufreq_stats_clear_table(policy->stats);
> + return count;
> +}
> +
> #ifdef CONFIG_CPU_FREQ_STAT_DETAILS
> static ssize_t show_trans_table(struct cpufreq_policy *policy, char *buf)
> {
> @@ -113,10 +133,12 @@ cpufreq_freq_attr_ro(trans_table);
>
> cpufreq_freq_attr_ro(total_trans);
> cpufreq_freq_attr_ro(time_in_state);
> +cpufreq_freq_attr_wr_perm(reset, 0200);
Just drop the perm argument and this patch looks fine as well.
--
viresh
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH v2 0/2] cpufreq: stats: clear statistics Markus Mayer <code@mmayer.net> - 2016-11-04 18:00 +0100
[PATCH v2 2/2] cpufreq: stats: clear statistics Markus Mayer <code@mmayer.net> - 2016-11-04 18:00 +0100
Re: [PATCH v2 2/2] cpufreq: stats: clear statistics Viresh Kumar <viresh.kumar@linaro.org> - 2016-11-07 05:40 +0100
csiph-web