perf trace/scripting: Add rwtop and sctop scripts
A couple of scripts, one in Python and the other in Perl, that demonstrate 'live mode' tracing. For each, the output of the perf event stream is fed continuously to the script, which continuously aggregates the data and reports the current results every 3 seconds, or at the optionally specified interval. After the current results are displayed, the aggregations are cleared and the cycle begins anew. To run the scripts, simply pipe the output of the 'perf trace record' step as input to the corresponding 'perf trace report' step, using '-' as the filename to -o and -i: $ perf trace record sctop -o - | perf trace report sctop -i - Also adds clear_term() utility functions to the Util.pm and Util.py utility modules, for use by any script to clear the screen. Signed-off-by: Tom Zanussi <tzanussi@gmail.com> Acked-by: Thomas Gleixner <tglx@linutronix.de> Cc: fweisbec@gmail.com Cc: rostedt@goodmis.org Cc: k-keiichi@bx.jp.nec.com Cc: acme@ghostprotocols.net LKML-Reference: <1270184365-8281-10-git-send-email-tzanussi@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
2
tools/perf/scripts/python/bin/sctop-record
Normal file
2
tools/perf/scripts/python/bin/sctop-record
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
perf record -c 1 -f -a -M -R -e raw_syscalls:sys_enter $@
|
24
tools/perf/scripts/python/bin/sctop-report
Normal file
24
tools/perf/scripts/python/bin/sctop-report
Normal file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
# description: syscall top
|
||||
# args: [comm] [interval]
|
||||
n_args=0
|
||||
for i in "$@"
|
||||
do
|
||||
if expr match "$i" "-" > /dev/null ; then
|
||||
break
|
||||
fi
|
||||
n_args=$(( $n_args + 1 ))
|
||||
done
|
||||
if [ "$n_args" -gt 2 ] ; then
|
||||
echo "usage: sctop-report [comm] [interval]"
|
||||
exit
|
||||
fi
|
||||
if [ "$n_args" -gt 1 ] ; then
|
||||
comm=$1
|
||||
interval=$2
|
||||
shift 2
|
||||
elif [ "$n_args" -gt 0 ] ; then
|
||||
interval=$1
|
||||
shift
|
||||
fi
|
||||
perf trace $@ -s ~/libexec/perf-core/scripts/python/sctop.py $comm $interval
|
Reference in New Issue
Block a user