aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/gdb/linux/clk.py
diff options
context:
space:
mode:
authorLeonard Crestez <leonard.crestez@nxp.com>2019-05-14 18:46:17 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-05-14 22:52:52 -0400
commite7e6f462c1bee842b857b57826e47e4234728727 (patch)
tree131805ae0b51543fe9e4139093cc7d047b5854bc /scripts/gdb/linux/clk.py
parent66d5c7c60acfeb21d80ff03a349e3b6600caa117 (diff)
scripts/gdb: print cached rate in lx-clk-summary
The clk rate is always stored in clk_core but might be out of date and require calls to update from hardware. Deal with that case by printing a (c) suffix. Link: http://lkml.kernel.org/r/1a474318982a5f0125f2360c4161029b17f56bd1.1556881728.git.leonard.crestez@nxp.com Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com> Cc: Jan Kiszka <jan.kiszka@siemens.com> Cc: Jason Wessel <jason.wessel@windriver.com> Cc: Kieran Bingham <kbingham@kernel.org> Cc: Stephen Boyd <swboyd@chromium.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/gdb/linux/clk.py')
-rw-r--r--scripts/gdb/linux/clk.py21
1 files changed, 14 insertions, 7 deletions
diff --git a/scripts/gdb/linux/clk.py b/scripts/gdb/linux/clk.py
index 6bf71976b55d..061aecfa294e 100644
--- a/scripts/gdb/linux/clk.py
+++ b/scripts/gdb/linux/clk.py
@@ -5,7 +5,7 @@
5import gdb 5import gdb
6import sys 6import sys
7 7
8from linux import utils, lists 8from linux import utils, lists, constants
9 9
10clk_core_type = utils.CachedType("struct clk_core") 10clk_core_type = utils.CachedType("struct clk_core")
11 11
@@ -16,27 +16,34 @@ def clk_core_for_each_child(hlist_head):
16 16
17 17
18class LxClkSummary(gdb.Command): 18class LxClkSummary(gdb.Command):
19 """Print Linux kernel log buffer.""" 19 """Print clk tree summary
20
21Output is a subset of /sys/kernel/debug/clk/clk_summary
22
23No calls are made during printing, instead a (c) if printed after values which
24are cached and potentially out of date"""
20 25
21 def __init__(self): 26 def __init__(self):
22 super(LxClkSummary, self).__init__("lx-clk-summary", gdb.COMMAND_DATA) 27 super(LxClkSummary, self).__init__("lx-clk-summary", gdb.COMMAND_DATA)
23 28
24 def show_subtree(self, clk, level): 29 def show_subtree(self, clk, level):
25 gdb.write("%*s%-*s %7d %8d %8d\n" % ( 30 gdb.write("%*s%-*s %7d %8d %8d %11lu%s\n" % (
26 level * 3 + 1, "", 31 level * 3 + 1, "",
27 30 - level * 3, 32 30 - level * 3,
28 clk['name'].string(), 33 clk['name'].string(),
29 clk['enable_count'], 34 clk['enable_count'],
30 clk['prepare_count'], 35 clk['prepare_count'],
31 clk['protect_count'])) 36 clk['protect_count'],
37 clk['rate'],
38 '(c)' if clk['flags'] & constants.LX_CLK_GET_RATE_NOCACHE else ' '))
32 39
33 for child in clk_core_for_each_child(clk['children']): 40 for child in clk_core_for_each_child(clk['children']):
34 self.show_subtree(child, level + 1) 41 self.show_subtree(child, level + 1)
35 42
36 def invoke(self, arg, from_tty): 43 def invoke(self, arg, from_tty):
37 gdb.write(" enable prepare protect\n") 44 gdb.write(" enable prepare protect \n")
38 gdb.write(" clock count count count\n") 45 gdb.write(" clock count count count rate \n")
39 gdb.write("---------------------------------------------------------\n") 46 gdb.write("------------------------------------------------------------------------\n")
40 for clk in clk_core_for_each_child(gdb.parse_and_eval("clk_root_list")): 47 for clk in clk_core_for_each_child(gdb.parse_and_eval("clk_root_list")):
41 self.show_subtree(clk, 0) 48 self.show_subtree(clk, 0)
42 for clk in clk_core_for_each_child(gdb.parse_and_eval("clk_orphan_list")): 49 for clk in clk_core_for_each_child(gdb.parse_and_eval("clk_orphan_list")):