From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752275AbdHNRuM (ORCPT ); Mon, 14 Aug 2017 13:50:12 -0400 Received: from terminus.zytor.com ([65.50.211.136]:53617 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751570AbdHNRuK (ORCPT ); Mon, 14 Aug 2017 13:50:10 -0400 Date: Mon, 14 Aug 2017 10:47:40 -0700 From: tip-bot for Arnaldo Carvalho de Melo Message-ID: Cc: dsahern@gmail.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, mingo@kernel.org, hpa@zytor.com, tmricht@linux.vnet.ibm.com, acme@redhat.com, mpetlan@redhat.com, jolsa@kernel.org, adrian.hunter@intel.com, namhyung@kernel.org, wangnan0@huawei.com Reply-To: dsahern@gmail.com, tglx@linutronix.de, mingo@kernel.org, linux-kernel@vger.kernel.org, hpa@zytor.com, tmricht@linux.vnet.ibm.com, acme@redhat.com, jolsa@kernel.org, mpetlan@redhat.com, adrian.hunter@intel.com, namhyung@kernel.org, wangnan0@huawei.com To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf test shell: Add test using probe:vfs_getname and verifying results Git-Commit-ID: 6060c7264ded3f6fa17e74bca3e192ce477e8063 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 6060c7264ded3f6fa17e74bca3e192ce477e8063 Gitweb: http://git.kernel.org/tip/6060c7264ded3f6fa17e74bca3e192ce477e8063 Author: Arnaldo Carvalho de Melo AuthorDate: Fri, 4 Aug 2017 14:39:37 -0300 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 11 Aug 2017 16:06:30 -0300 perf test shell: Add test using probe:vfs_getname and verifying results This test uses the 'perf test shell' library to add probe:vfs_getname to the system then use it with 'perf record' using 'touch' to write to a temp file, then checks that that was captured by the vfs_getname probe in the generated perf.data file, with the temp file name as the pathname argument. Using it: # perf test "Use vfs_getname" 60: Use vfs_getname probe to get syscall args filenames: Ok # perf test -v "Use vfs_getname" 60: Use vfs_getname probe to get syscall args filenames: --- start --- test child forked, pid 16414 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 Recording open file: [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.022 MB /tmp/vaca.perf.data.QZsn7 (13 samples) ] Looking at perf.data file for vfs_getname records for the file we touched: touch 16421 [002] 1255152.879561: probe:vfs_getname: (ffffffffa626e608) pathname="/tmp/vaca.l10SL" test child finished with 0 ---- end ---- Use vfs_getname probe to get syscall args filenames: Ok # Cc: Adrian Hunter Cc: David Ahern Cc: Jiri Olsa Cc: Michael Petlan Cc: Namhyung Kim Cc: Thomas Richter Cc: Wang Nan Link: http://lkml.kernel.org/n/tip-t555fnhbcbxnukltk23dqxur@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- .../tests/shell/record+script_probe_vfs_getname.sh | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tools/perf/tests/shell/record+script_probe_vfs_getname.sh b/tools/perf/tests/shell/record+script_probe_vfs_getname.sh new file mode 100755 index 0000000..2725c5d --- /dev/null +++ b/tools/perf/tests/shell/record+script_probe_vfs_getname.sh @@ -0,0 +1,37 @@ +# Use vfs_getname probe to get syscall args filenames + +# Uses the 'perf test shell' library to add probe:vfs_getname to the system +# then use it with 'perf record' using 'touch' to write to a temp file, then +# checks that that was captured by the vfs_getname probe in the generated +# perf.data file, with the temp file name as the pathname argument. + +# Arnaldo Carvalho de Melo , 2017 + +. $(dirname $0)/lib/probe_vfs_getname.sh + +perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX) +file=$(mktemp /tmp/temporary_file.XXXXX) + +record_open_file() { + echo "Recording open file:" + perf record -o ${perfdata} -e probe:vfs_getname touch $file +} + +perf_script_filenames() { + echo "Looking at perf.data file for vfs_getname records for the file we touched:" + perf script -i ${perfdata} | \ + egrep " +touch +[0-9]+ +\[[0-9]+\] +[0-9]+\.[0-9]+: +probe:vfs_getname: +\([[:xdigit:]]+\) +pathname=\"${file}\"" +} + +add_probe_vfs_getname || skip_if_no_debuginfo +err=$? +if [ $err -ne 0 ] ; then + exit $err +fi + +record_open_file && perf_script_filenames +err=$? +rm -f ${perfdata} +rm -f ${file} +cleanup_probe_vfs_getname +exit $err