1
0
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:
Douglas Raillard 2022-04-13 12:21:15 +01:00 committed by Marc Bonnici
parent ff599dfbb6
commit 8f80d8a5ee

View File

@ -42,9 +42,10 @@ cpufreq_get_all_governors() {
}
cpufreq_trace_all_frequencies() {
FREQS=$($CAT /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq)
CPU=0; for F in $FREQS; do
echo "cpu_frequency_devlib: state=$F cpu_id=$CPU" > /sys/kernel/debug/tracing/trace_marker
local TRACEFS=$(get_tracefs_mount_point)
local FREQS=$($CAT /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq)
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))
done
}
@ -96,10 +97,15 @@ cpuidle_wake_all_cpus() {
# FTrace Utility Functions
################################################################################
get_tracefs_mount_point() {
get_fs_mount_point tracefs || $PRINTF "%s" '/sys/kernel/debug/tracing'
}
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)/"
$CAT /sys/kernel/debug/tracing/trace_stat/function$CPU \
$CAT $TRACEFS/trace_stat/function$CPU \
| sed "$REPLACE_STRING"
done
}