From mboxrd@z Thu Jan 1 00:00:00 1970 From: Markus Mayer Subject: [PATCH v3] cpufreq: stats: clear statistics Date: Mon, 7 Nov 2016 10:02:23 -0800 Message-ID: <20161107180223.44536-1-code@mmayer.net> Return-path: Received: from smtp-out-so.shaw.ca ([64.59.136.137]:45839 "EHLO smtp-out-so.shaw.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932411AbcKGSCi (ORCPT ); Mon, 7 Nov 2016 13:02:38 -0500 Sender: linux-pm-owner@vger.kernel.org List-Id: linux-pm@vger.kernel.org To: Viresh Kumar , "Rafael J . Wysocki" Cc: Power Management List , Broadcom Kernel List , Linux Kernel Mailing List , Markus Mayer From: Markus Mayer Allow CPUfreq statistics to be cleared by writing anything to /sys/.../cpufreq/stats/reset. Signed-off-by: Markus Mayer --- Changes since v2: - changed name of write-only macro to cpufreq_freq_attr_wo() - removed "perm" parameter from write-only macro - squashed the two separate commits into a single one Changes since v1: - add new cpufreq_freq_attr_wr_perm() macro for write-only attributes (because this is a separate commit, this patch has turned into a series) - remove the Kconfig option, compiling the code unconditionally - remove show_reset() - cpufreq_stats_clear_table() takes a struct cpufreq_stats * as argument rather than a struct cpufreq_policy * Documentation/cpu-freq/cpufreq-stats.txt | 6 ++++++ drivers/cpufreq/cpufreq_stats.c | 22 ++++++++++++++++++++++ include/linux/cpufreq.h | 4 ++++ 3 files changed, 32 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 "