Commit 236bdb88 authored by Bhaskar Chowdhury's avatar Bhaskar Chowdhury Committed by Boqun Feng
Browse files

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: default avatarBhaskar Chowdhury <unixbhaskar@gmail.com>
Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
Signed-off-by: default avatarBoqun Feng <boqun.feng@gmail.com>
parent 7c3a8b48
Loading
Loading
Loading
Loading

tools/rcu/extract-stall.sh

100644 → 100755
+20 −6
Original line number Diff line number Diff line
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0+
#
# Extract any RCU CPU stall warnings present in specified file.
# Filter out clocksource lines.  Note that preceding-lines excludes the
# initial line of the stall warning but trailing-lines includes it.
#
# Usage: extract-stall.sh dmesg-file [ preceding-lines [ trailing-lines ] ]

usage() {
	echo Extract any RCU CPU stall warnings present in specified file.
	echo Filter out clocksource lines.  Note that preceding-lines excludes the
	echo initial line of the stall warning but trailing-lines includes it.
	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
preceding_lines="${2-3}"