mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
shutils.in: De-hardcode tracefs location
Detect tracefs mount point rather than hardcoding its path.
This commit is contained in:
parent
ff599dfbb6
commit
8f80d8a5ee
@ -42,9 +42,10 @@ cpufreq_get_all_governors() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cpufreq_trace_all_frequencies() {
|
cpufreq_trace_all_frequencies() {
|
||||||
FREQS=$($CAT /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq)
|
local TRACEFS=$(get_tracefs_mount_point)
|
||||||
CPU=0; for F in $FREQS; do
|
local FREQS=$($CAT /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq)
|
||||||
echo "cpu_frequency_devlib: state=$F cpu_id=$CPU" > /sys/kernel/debug/tracing/trace_marker
|
local CPU=0; for F in $FREQS; do
|
||||||
|
printf "%s\n" "cpu_frequency_devlib: state=$F cpu_id=$CPU" > $TRACEFS/trace_marker
|
||||||
CPU=$((CPU + 1))
|
CPU=$((CPU + 1))
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@ -96,10 +97,15 @@ cpuidle_wake_all_cpus() {
|
|||||||
# FTrace Utility Functions
|
# FTrace Utility Functions
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
get_tracefs_mount_point() {
|
||||||
|
get_fs_mount_point tracefs || $PRINTF "%s" '/sys/kernel/debug/tracing'
|
||||||
|
}
|
||||||
|
|
||||||
ftrace_get_function_stats() {
|
ftrace_get_function_stats() {
|
||||||
for CPU in $(ls /sys/kernel/debug/tracing/trace_stat | sed 's/function//'); do
|
local TRACEFS=$(get_tracefs_mount_point)
|
||||||
|
for CPU in $(ls $TRACEFS/trace_stat | sed 's/function//'); do
|
||||||
REPLACE_STRING="s/ Function/\n Function (CPU$CPU)/"
|
REPLACE_STRING="s/ Function/\n Function (CPU$CPU)/"
|
||||||
$CAT /sys/kernel/debug/tracing/trace_stat/function$CPU \
|
$CAT $TRACEFS/trace_stat/function$CPU \
|
||||||
| sed "$REPLACE_STRING"
|
| sed "$REPLACE_STRING"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user