Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 Mar 2009 03:30:15 +0000 (UTC)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r190518 - head/sys/tools
Message-ID:  <200903290330.n2T3UFVA020793@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rwatson
Date: Sun Mar 29 03:30:15 2009
New Revision: 190518
URL: http://svn.freebsd.org/changeset/base/190518

Log:
  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.

Modified:
  head/sys/tools/vnode_if.awk

Modified: head/sys/tools/vnode_if.awk
==============================================================================
--- head/sys/tools/vnode_if.awk	Sun Mar 29 01:04:13 2009	(r190517)
+++ head/sys/tools/vnode_if.awk	Sun Mar 29 03:30:15 2009	(r190518)
@@ -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");



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903290330.n2T3UFVA020793>