mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	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>
This commit is contained in:
		
							parent
							
								
									66d5c7c60a
								
							
						
					
					
						commit
						e7e6f462c1
					
				
					 2 changed files with 18 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -5,7 +5,7 @@
 | 
			
		|||
import gdb
 | 
			
		||||
import sys
 | 
			
		||||
 | 
			
		||||
from linux import utils, lists
 | 
			
		||||
from linux import utils, lists, constants
 | 
			
		||||
 | 
			
		||||
clk_core_type = utils.CachedType("struct clk_core")
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -16,27 +16,34 @@ def clk_core_for_each_child(hlist_head):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class LxClkSummary(gdb.Command):
 | 
			
		||||
    """Print Linux kernel log buffer."""
 | 
			
		||||
    """Print clk tree summary
 | 
			
		||||
 | 
			
		||||
Output is a subset of /sys/kernel/debug/clk/clk_summary
 | 
			
		||||
 | 
			
		||||
No calls are made during printing, instead a (c) if printed after values which
 | 
			
		||||
are cached and potentially out of date"""
 | 
			
		||||
 | 
			
		||||
    def __init__(self):
 | 
			
		||||
        super(LxClkSummary, self).__init__("lx-clk-summary", gdb.COMMAND_DATA)
 | 
			
		||||
 | 
			
		||||
    def show_subtree(self, clk, level):
 | 
			
		||||
        gdb.write("%*s%-*s %7d %8d %8d\n" % (
 | 
			
		||||
        gdb.write("%*s%-*s %7d %8d %8d %11lu%s\n" % (
 | 
			
		||||
                level * 3 + 1, "",
 | 
			
		||||
                30 - level * 3,
 | 
			
		||||
                clk['name'].string(),
 | 
			
		||||
                clk['enable_count'],
 | 
			
		||||
                clk['prepare_count'],
 | 
			
		||||
                clk['protect_count']))
 | 
			
		||||
                clk['protect_count'],
 | 
			
		||||
                clk['rate'],
 | 
			
		||||
                '(c)' if clk['flags'] & constants.LX_CLK_GET_RATE_NOCACHE else '   '))
 | 
			
		||||
 | 
			
		||||
        for child in clk_core_for_each_child(clk['children']):
 | 
			
		||||
            self.show_subtree(child, level + 1)
 | 
			
		||||
 | 
			
		||||
    def invoke(self, arg, from_tty):
 | 
			
		||||
        gdb.write("                                 enable  prepare  protect\n")
 | 
			
		||||
        gdb.write("   clock                          count    count    count\n")
 | 
			
		||||
        gdb.write("---------------------------------------------------------\n")
 | 
			
		||||
        gdb.write("                                 enable  prepare  protect               \n")
 | 
			
		||||
        gdb.write("   clock                          count    count    count        rate   \n")
 | 
			
		||||
        gdb.write("------------------------------------------------------------------------\n")
 | 
			
		||||
        for clk in clk_core_for_each_child(gdb.parse_and_eval("clk_root_list")):
 | 
			
		||||
            self.show_subtree(clk, 0)
 | 
			
		||||
        for clk in clk_core_for_each_child(gdb.parse_and_eval("clk_orphan_list")):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,6 +12,7 @@
 | 
			
		|||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <linux/clk-provider.h>
 | 
			
		||||
#include <linux/fs.h>
 | 
			
		||||
#include <linux/hrtimer.h>
 | 
			
		||||
#include <linux/mount.h>
 | 
			
		||||
| 
						 | 
				
			
			@ -38,6 +39,9 @@
 | 
			
		|||
 | 
			
		||||
import gdb
 | 
			
		||||
 | 
			
		||||
/* linux/clk-provider.h */
 | 
			
		||||
LX_GDBPARSED(CLK_GET_RATE_NOCACHE)
 | 
			
		||||
 | 
			
		||||
/* linux/fs.h */
 | 
			
		||||
LX_VALUE(SB_RDONLY)
 | 
			
		||||
LX_VALUE(SB_SYNCHRONOUS)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue