Created
August 10, 2016 13:07
-
-
Save graugans/914cde28cd07cf255ac11049847a761d to your computer and use it in GitHub Desktop.
dump-clocks.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if ! mount|grep -sq '/sys/kernel/debug'; then | |
mount -t debugfs none /sys/kernel/debug | |
fi | |
saved_path=$PWD | |
printf "%-24s %-24s %8s %6s %6s %9s\n" "clock" "parent" "flags" "en_cnt" "pre_cnt" "rate" | |
for foo in $(find /sys/kernel/debug/clk -type d); do | |
if [ "$foo" = '/sys/kernel/debug/clk' ]; then | |
continue | |
fi | |
cd $foo | |
if [ -f clk_flags ]; then | |
flags="$(cat clk_flags)" | |
fi | |
if [ -f clk_enable_count ]; then | |
enable_count="$(cat clk_enable_count)" | |
fi | |
if [ -f clk_prepare_count ]; then | |
prepare_count="$(cat clk_enable_count)" | |
fi | |
if [ -f clk_rate ]; then | |
rate="$(cat clk_rate)" | |
fi | |
clk="$(basename $foo)" | |
cd .. | |
parent="$(basename $PWD)" | |
if [ "$parent" = 'clk' ]; then | |
parent=" ---" | |
fi | |
printf "%-24s %-24s %08x %6d %6d %10d\n" "$clk" "$parent" "$flags" "$enable_count" "$prepare_count" "$rate" | |
cd $saved_path | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment