From patchwork Mon Nov 7 18:02:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Mayer X-Patchwork-Id: 9415659 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 310016048F for ; Mon, 7 Nov 2016 18:02:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2DCC2288D7 for ; Mon, 7 Nov 2016 18:02:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 225D528C1E; Mon, 7 Nov 2016 18:02:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7CC2A288D7 for ; Mon, 7 Nov 2016 18:02:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932937AbcKGSCj (ORCPT ); Mon, 7 Nov 2016 13:02:39 -0500 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 Received: from triton.mmayer.net ([70.71.160.251]) by shaw.ca with SMTP id 3oFecYVCKeeHN3oFfcgviy; Mon, 07 Nov 2016 11:02:37 -0700 X-Authority-Analysis: v=2.2 cv=abURpVgt c=1 sm=1 tr=0 a=6xzog4CasRozao6qlzTIAw==:117 a=6xzog4CasRozao6qlzTIAw==:17 a=L24OOQBejmoA:10 a=Q-fNiiVtAAAA:8 a=a91wP-H8uD_5sSSuCW8A:9 a=0bXxn9q0MV6snEgNplNhOjQmxlI=:19 a=Fp8MccfUoT0GBdDC_Lng:22 Received: by triton.mmayer.net (Postfix, from userid 501) id 86E552B1614B; Mon, 7 Nov 2016 10:02:34 -0800 (PST) From: Markus Mayer To: Viresh Kumar , "Rafael J . Wysocki" Cc: Power Management List , Broadcom Kernel List , Linux Kernel Mailing List , 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> X-Mailer: git-send-email 2.9.2 X-CMAE-Envelope: MS4wfO41ya3QcQT632RiOvARH8fMKBlHuxmrTBbB24bUQ23wOLkU4kXKgtvVIePJRsqf7D/4A1GEBiTlO1QZWacFY8VRXbZ4LKi/m1Pr2qaO6nKn3DF7T1l3 udoAgxdGJcJtbNm+2oNmV8/o4/Nv/l4j0cB76Ed9FUF4u65ilVCHDLdTw2IxfNH5xGKK+/xgrecRUQFE/p8gK8KRuvxD3VMPl/MuxDVqenJNURd+lGJ8ogpe 5KzAyBCxMsmH3sAvJYRL3teVVrO03Us5XyxFNLyR3Fslm7tJIIIfqu+9DKR8MPk4oHoTNa7fv1Y6lH6hS9TdIozc/Y/nUC47ZywRh9VYr69WRWCB3hD4EEAs JIcnaDQSKp6yjb1UZ2mgxikzp1+13w== Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Mayer Allow CPUfreq statistics to be cleared by writing anything to /sys/.../cpufreq/stats/reset. Signed-off-by: Markus Mayer Acked-by: Viresh Kumar --- 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 "