Skip to contentSkip to conversation

Perf Script: Add a python script to statistic direct io behavior

PATCH New chenggang 1 participant 1 message Feb 7, 2013 perf events

lore
Share & tools
lore

chenggang

author
#0 lore raw

PATCH v2 1/1 Perf Script: Add a python script to statistic direct io behavior

From: [email protected]

The last version of this patch need to introduce 2 new tracepoint events in VFS, but introduce new tracepoint events into VFS is not a clever idea. So, I modified this patch, and only use a existing tracepoint event (ext4:ext4_direct_IO_exit).

If the engineers want to analyze the direct io behavior of some applications without source code, perf tools with some appropriate tracepoints events in the VFS subsystem are excellent choice.

Many database systems use their own page cache subsystems and use the direct IO to access the disks. Sometimes, the system engineers need to know the misses rate of the database system's page cache. This requirements can be satisfied by recording the database's file access behavior through the way of direct IO. So, we use tracepoint event, ext4:ext4_direct_IO_exit, to record the system wide's direct IO behavior. The script direct-io.py are introduced by this patch can record the tracepoint events, ext4:ext4_direct_IO_exit, analyse the sample data, and give a concise report.

usage:
"perf script record direct-io\n" "perf script report direct-io [comm|pid]\n"

Cc Peter Zijlstra <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc David Ahern <[email protected]>
Cc Arjan van de Ven <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Yanmin Zhang <[email protected]>
Cc Wu Fengguang <[email protected]>
Cc Mike Galbraith <[email protected]>
Cc Andrew Morton <[email protected]>
---
 tools/perf/scripts/python/bin/direct-io-record |    2 +
 tools/perf/scripts/python/bin/direct-io-report |   21 +++
 tools/perf/scripts/python/direct-io.py         |  197 ++++++++++++++++++++++++
 3 files changed, 220 insertions(+)
 create mode 100755 tools/perf/scripts/python/bin/direct-io-record
 create mode 100644 tools/perf/scripts/python/bin/direct-io-report
 create mode 100644 tools/perf/scripts/python/direct-io.py
tools/perf/scripts/python/bin/direct-io-record new file +2 -0
new file mode 100755
index 0000000..f38d5fc
@@ -0,0 +1,2 @@
+#!/bin/bash
+perf record -e ext4:ext4_direct_IO_exit  $@
tools/perf/scripts/python/bin/direct-io-report new file +21 -0
new file mode 100644
index 0000000..828d9c6
@@ -0,0 +1,21 @@
+#!/bin/bash
+# description: direct_io statistic
+# args: [comm|pid]
+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 1 ] ; then
+    echo "usage: perf script report direct-io [comm|pid]"
+    exit
+fi
+
+if [ "$n_args" -gt 0 ] ; then
+    comm=$1
+    shift
+fi
+perf script $@ -s "$PERF_EXEC_PATH"/scripts/python/direct-io.py $comm
tools/perf/scripts/python/direct-io.py new file +197 -0

197 lines not on this page · raw message

Signature · 1 line
1.7.9.5