#!/bin/bash set -eu -o pipefail if ! which "${1:-}" > /dev/null; then echo >&2 "usage: $0 command args..." exit 2 fi t=/sys/kernel/debug/tracing # clear the trace sudo bash -c "echo 0 > $t/tracing_on" sudo bash -c "echo > $t/trace" # enable ASoC tracing sudo bash -c "echo 1 > $t/events/asoc/enable" #sudo bash -c "echo 0 > $t/events/asoc/snd_soc_reg_read/enable" # trace a single invocation sudo bash -c "echo 1 > $t/tracing_on" "$@" sudo bash -c "echo 0 > $t/tracing_on" # filter out blank lines sudo grep '\S' $t/trace > trace.log # EOF