clk: debugfs: Support frequency stats accounting
Added frequency statistics accounting to common
clk debug framework. This change tracks the
frequency of the clocks which don't have the
CLK_GET_RATE_NOCACHE flag set. This is done by
monitoring the calls to clk_set_rate, clk_enable
and then clk_disable.
There is a new node called frequency_stats_table
created under DEBUG_FS/clk/<clk_debug_name>/ to
report the collected statistics. In addition,
the stats also gets printed as a part of the
clk_summary. Frequency gets reported in HZ and
the time_spent gets reported in msec units.
sample output of clk_summary:
clock enable_cnt prepare_cnt rate accuracy phase
----------------------------------------------------------------------------------------
clk24mhz 2 3 24000000 0 0
*[ default_freq 48188]
* 400000000 54
default_freq accounts the time for which the
clk was on without an explicit call to the
clk_set_rate API. The [] braces highlight the
latest frequency set through clk_set_rate API.
Frequency accounting can be started(or)stopped
by writing 1(or)0 to /d/clk/freq_stats_on.
Writing 1 also causes the counters to reset.
Enabling CONFIG_FREQ_STATS_ACCOUNTING includes
the feature.
Enabling CONFIG_BEGIN_ACCOUNTING_FROM_BOOT
starts accounting right from boot.
Change-Id: I7333d6afd1494c9a7288c5da70877a734d3a64af
Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>
3 files changed