mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
tools: rcu: Add usage function and check for argument
This commit converts extract-stall.sh script's header comment to a usage() function, and adds an argument check. While in the area, make this script be executable. [ paulmck: Strength argument check, remove extraneous comment. ] Signed-off-by: Bhaskar Chowdhury <unixbhaskar@gmail.com> Signed-off-by: Paul E. McKenney <paulmck@kernel.org> Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
This commit is contained in:
parent
7c3a8b48dc
commit
236bdb881d
1 changed files with 20 additions and 6 deletions
26
tools/rcu/extract-stall.sh
Normal file → Executable file
26
tools/rcu/extract-stall.sh
Normal file → Executable file
|
@ -1,11 +1,25 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# SPDX-License-Identifier: GPL-2.0+
|
# SPDX-License-Identifier: GPL-2.0+
|
||||||
#
|
|
||||||
# Extract any RCU CPU stall warnings present in specified file.
|
usage() {
|
||||||
# Filter out clocksource lines. Note that preceding-lines excludes the
|
echo Extract any RCU CPU stall warnings present in specified file.
|
||||||
# initial line of the stall warning but trailing-lines includes it.
|
echo Filter out clocksource lines. Note that preceding-lines excludes the
|
||||||
#
|
echo initial line of the stall warning but trailing-lines includes it.
|
||||||
# Usage: extract-stall.sh dmesg-file [ preceding-lines [ trailing-lines ] ]
|
echo
|
||||||
|
echo Usage: $(basename $0) dmesg-file [ preceding-lines [ trailing-lines ] ]
|
||||||
|
echo
|
||||||
|
echo Error: $1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Terminate the script, if the argument is missing
|
||||||
|
|
||||||
|
if test -f "$1" && test -r "$1"
|
||||||
|
then
|
||||||
|
:
|
||||||
|
else
|
||||||
|
usage "Console log file \"$1\" missing or unreadable."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo $1
|
echo $1
|
||||||
preceding_lines="${2-3}"
|
preceding_lines="${2-3}"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue