linux/tools/testing/selftests/ftrace/test.d/ftrace/func_profile_stat.tc

#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# description: ftrace - function profiling
# requires: function_profile_enabled

: "Enable function profile"
echo 1 > function_profile_enabled

: "Profile must be updated"
cp trace_stat/function0 $TMPDIR/
( echo "forked"; sleep 1 )
: "diff returns 0 if there is no difference"
! diff trace_stat/function0 $TMPDIR/function0

echo 0 > function_profile_enabled

: "Profile must NOT be updated"
cp trace_stat/function0 $TMPDIR/
( echo "forked"; sleep 1 )
: "diff returns 0 if there is no difference"
diff trace_stat/function0 $TMPDIR/function0