xref: /aosp_15_r20/external/ltp/testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_trace_stat.sh (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1#! /bin/sh
2
3###############################################################################
4#                                                                             #
5# Copyright (c) 2010 FUJITSU LIMITED                                          #
6#                                                                             #
7# This program is free software; you can redistribute it and/or modify it     #
8# under the terms of the GNU General Public License as published by the Free  #
9# Software Foundation; either version 2 of the License, or (at your option)   #
10# any later version.                                                          #
11#                                                                             #
12# Author: Li Zefan <[email protected]>                                      #
13#                                                                             #
14###############################################################################
15
16LOOP=200
17
18should_skip=0
19nr_cpus=`tst_ncpus`
20
21if [ ! -e "$TRACING_PATH"/function_profile_enabled ]; then
22        should_skip=1
23fi
24
25while true; do
26	if [ $should_skip -eq 1 ]; then
27		sleep 2
28		continue
29	fi
30	cpu=$(tst_random 0 $((nr_cpus - 1)))
31	i=0;
32	while [ $i -lt $LOOP ]; do
33		cat "$TRACING_PATH"/trace_stat/function${cpu} > /dev/null 2>&1
34		i=$((i + 1))
35	done
36
37	sleep 1
38done
39