summaryrefslogtreecommitdiffstats
path: root/sys/tools/vnode_if.awk
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2009-03-29 03:30:15 +0000
committerrwatson <rwatson@FreeBSD.org>2009-03-29 03:30:15 +0000
commitdd8829d949c6d50631f4997ee594e975cb98f077 (patch)
tree492bd1992f24e0b1af85556888d246791d38badd /sys/tools/vnode_if.awk
parent454fcf41e6df0a4529ca2346ac41cb9d8c6b404e (diff)
downloadFreeBSD-src-dd8829d949c6d50631f4997ee594e975cb98f077.zip
FreeBSD-src-dd8829d949c6d50631f4997ee594e975cb98f077.tar.gz
Add SDT DTrace probes for VFS vnode operations in the vfs:vop
provider namespace. These are inserted dynamically into the VOP_..._AP() functions created from vnode_if.src. Each VOP has entry and return probes, as arg0 the primary vnode, arg1 the vnode operation argument structure pointer, providing access to IN and OUT arguments, and for return probes, arg2 the return value. MFC after: 1 month Sponsored by: Google, Inc.
Diffstat (limited to 'sys/tools/vnode_if.awk')
-rw-r--r--sys/tools/vnode_if.awk12
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/tools/vnode_if.awk b/sys/tools/vnode_if.awk
index b250c92..86c6bdc 100644
--- a/sys/tools/vnode_if.awk
+++ b/sys/tools/vnode_if.awk
@@ -165,12 +165,18 @@ if (hfile) {
if (cfile) {
printc(common_head \
+ "#include \"opt_kdtrace.h\"\n" \
+ "\n" \
"#include <sys/param.h>\n" \
"#include <sys/event.h>\n" \
+ "#include <sys/kernel.h>\n" \
"#include <sys/mount.h>\n" \
+ "#include <sys/sdt.h>\n" \
"#include <sys/systm.h>\n" \
"#include <sys/vnode.h>\n" \
"\n" \
+ "SDT_PROVIDER_DECLARE(vfs);\n" \
+ "\n" \
"struct vnodeop_desc vop_default_desc = {\n" \
" \"default\",\n" \
" 0,\n" \
@@ -348,6 +354,10 @@ while ((getline < srcfile) > 0) {
printc("\tVDESC_NO_OFFSET");
printc("};");
+ printc("\n");
+ printc("SDT_PROBE_DEFINE2(vfs, vop, " name ", entry, \"struct vnode *\", \"struct " name "_args *\");\n");
+ printc("SDT_PROBE_DEFINE3(vfs, vop, " name ", return, \"struct vnode *\", \"struct " name "_args *\", \"int\");\n");
+
# Print out function.
printc("\nint\n" uname "_AP(struct " name "_args *a)");
printc("{");
@@ -364,6 +374,7 @@ while ((getline < srcfile) > 0) {
printc("\t vop->"name" == NULL && vop->vop_bypass == NULL)")
printc("\t\tvop = vop->vop_default;")
printc("\tVNASSERT(vop != NULL, a->a_" args[0]", (\"No "name"(%p, %p)\", a->a_" args[0]", a));")
+ printc("\tSDT_PROBE(vfs, vop, " name ", entry, a->a_" args[0] ", a, 0, 0, 0);\n");
for (i = 0; i < numargs; ++i)
add_debug_code(name, args[i], "Entry", "\t");
add_pre(name);
@@ -372,6 +383,7 @@ while ((getline < srcfile) > 0) {
printc("\telse")
printc("\t\trc = vop->vop_bypass(&a->a_gen);")
printc(ctrstr);
+ printc("\tSDT_PROBE(vfs, vop, " name ", return, a->a_" args[0] ", a, rc, 0, 0);\n");
printc("\tif (rc == 0) {");
for (i = 0; i < numargs; ++i)
add_debug_code(name, args[i], "OK", "\t\t");
OpenPOWER on IntegriCloud