[<prev] [next>] [day] [month] [year] [list]
Message-ID: <tip-j02nobfvvn9c7yrphdsnbqx0@git.kernel.org>
Date: Mon, 14 Aug 2017 10:48:04 -0700
From: tip-bot for Arnaldo Carvalho de Melo <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: wangnan0@...wei.com, linux-kernel@...r.kernel.org, acme@...hat.com,
dsahern@...il.com, adrian.hunter@...el.com, tglx@...utronix.de,
jolsa@...nel.org, tmricht@...ux.vnet.ibm.com, mpetlan@...hat.com,
mingo@...nel.org, namhyung@...nel.org, hpa@...or.com
Subject: [tip:perf/core] perf test shell: Add test using vfs_getname + 'perf
trace'
Commit-ID: e498f336d66f804f87787b2ec31821e349a37b7b
Gitweb: http://git.kernel.org/tip/e498f336d66f804f87787b2ec31821e349a37b7b
Author: Arnaldo Carvalho de Melo <acme@...hat.com>
AuthorDate: Fri, 4 Aug 2017 17:06:26 -0300
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Fri, 11 Aug 2017 16:06:30 -0300
perf test shell: Add test using vfs_getname + 'perf trace'
Uses the 'perf test shell' library to add probe:vfs_getname to the
system then use it with 'perf trace' using 'touch' to write to a temp
file, then checks that that was captured by the vfs_getname was used by
'perf trace', that already handles "probe:vfs_getname" if present, and
used in the "open" syscall "filename" argument beautifier.
Testing it:
# perf test "trace + vfs_getname"
61: Check open filename arg using perf trace + vfs_getname: Ok
#
# perf test -v "trace + vfs_getname"
61: Check open filename arg using perf trace + vfs_getname:
--- start ---
test child forked, pid 30846
Added new event:
probe:vfs_getname (on getname_flags:72 with pathname=result->name:string)
You can now use it in all perf tools, such as:
perf record -e probe:vfs_getname -aR sleep 1
2.237 ( 0.012 ms): touch/30855 open(filename: /tmp/temporary_file.kmoWQ, flags: CREAT|NOCTTY|NONBLOCK|WRONLY, mode: IRUGO|IWUGO) = 3
test child finished with 0
---- end ----
Check open filename arg using perf trace + vfs_getname: Ok
#
Cc: Adrian Hunter <adrian.hunter@...el.com>
Cc: David Ahern <dsahern@...il.com>
Cc: Jiri Olsa <jolsa@...nel.org>
Cc: Michael Petlan <mpetlan@...hat.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Thomas Richter <tmricht@...ux.vnet.ibm.com>
Cc: Wang Nan <wangnan0@...wei.com>
Link: http://lkml.kernel.org/n/tip-j02nobfvvn9c7yrphdsnbqx0@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/tests/shell/trace+probe_vfs_getname.sh | 31 +++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/tools/perf/tests/shell/trace+probe_vfs_getname.sh b/tools/perf/tests/shell/trace+probe_vfs_getname.sh
new file mode 100755
index 0000000..d0fba0c
--- /dev/null
+++ b/tools/perf/tests/shell/trace+probe_vfs_getname.sh
@@ -0,0 +1,31 @@
+# Check open filename arg using perf trace + vfs_getname
+
+# Uses the 'perf test shell' library to add probe:vfs_getname to the system
+# then use it with 'perf trace' using 'touch' to write to a temp file, then
+# checks that that was captured by the vfs_getname was used by 'perf trace',
+# that already handles "probe:vfs_getname" if present, and used in the
+# "open" syscall "filename" argument beautifier.
+
+# Arnaldo Carvalho de Melo <acme@...nel.org>, 2017
+
+. $(dirname $0)/lib/probe_vfs_getname.sh
+
+file=$(mktemp /tmp/temporary_file.XXXXX)
+
+trace_open_vfs_getname() {
+ perf trace -e open touch $file 2>&1 | \
+ egrep " +[0-9]+\.[0-9]+ +\( +[0-9]+\.[0-9]+ ms\): +touch\/[0-9]+ open\(filename: +${file}, +flags: CREAT\|NOCTTY\|NONBLOCK\|WRONLY, +mode: +IRUGO\|IWUGO\) += +[0-9]+$"
+}
+
+
+add_probe_vfs_getname || skip_if_no_debuginfo
+err=$?
+if [ $err -ne 0 ] ; then
+ exit $err
+fi
+
+trace_open_vfs_getname
+err=$?
+rm -f ${file}
+cleanup_probe_vfs_getname
+exit $err
Powered by blists - more mailing lists