diff options
| author | Steve Dickson <steved@redhat.com> | 2009-05-05 17:48:24 -0400 |
|---|---|---|
| committer | Steve Dickson <steved@redhat.com> | 2009-05-05 17:48:24 -0400 |
| commit | aaa6513f6db3a54691cfa7022bfbd979db42672e (patch) | |
| tree | f6ae4820323335ae8c0d59dfc3a5cc6d7a03503c | |
| parent | 7d945a5e61fcae70cf072cea5cbcef4e45d0c92a (diff) | |
| download | systemtap-aaa6513f6db3a54691cfa7022bfbd979db42672e.tar.gz systemtap-aaa6513f6db3a54691cfa7022bfbd979db42672e.tar.xz systemtap-aaa6513f6db3a54691cfa7022bfbd979db42672e.zip | |
Added rpc_call_status trace points
| -rw-r--r-- | tapset/sunrpc_task.stp | 63 | ||||
| -rw-r--r-- | tracepoints/rpc_call_status.stp | 32 |
2 files changed, 95 insertions, 0 deletions
diff --git a/tapset/sunrpc_task.stp b/tapset/sunrpc_task.stp new file mode 100644 index 0000000..47cc178 --- /dev/null +++ b/tapset/sunrpc_task.stp @@ -0,0 +1,63 @@ +%{ +#include <linux/sunrpc/svc.h> +#include <linux/sunrpc/sched.h> +#include <linux/sunrpc/clnt.h> +%} + +function cl_prog:string(_task:long) +%{ + struct rpc_task *task = (struct rpc_task *)(long) kread(&(THIS->_task)); + struct rpc_clnt *clnt = (struct rpc_clnt *)(long) kread(&(task->tk_client)); + struct rpc_procinfo *proc = + (struct rpc_procinfo *)(long) kread(&(clnt->cl_procinfo)); + char *p_name = kread(&(proc->p_name)); + static struct { + int prog; + char *string; + } prog_progtbl[] = { + {100000, "rpcbind"}, + {100024, "statd"}, + {100011, "rquotad"}, + {100003, "nfsd"}, + {100021, "nlockmgr"}, + {100005, "mountd"}, + {100227, "nfs_acl"}, + }; + int i; + int tabsz = (sizeof(prog_progtbl)/sizeof(prog_progtbl[0])); + + for (i = 0; i < tabsz; i++) { + if (prog_progtbl[i].prog == clnt->cl_prog) { + break; + } + } + if (i == tabsz) + snprintf(THIS->__retvalue, MAXSTRINGLEN, "0x%x[%d]:%d", + clnt->cl_prog, clnt->cl_vers, proc->p_proc); + else + snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s[%d]:%d", + prog_progtbl[i].string, clnt->cl_vers, proc->p_proc); + + CATCH_DEREF_FAULT(); +%} +function cl_server:string(_task:long) +%{ + struct rpc_task *task = (struct rpc_task *)(long) kread(&(THIS->_task)); + struct rpc_clnt *clnt = (struct rpc_clnt *)(long) kread(&(task->tk_client)); + char *cl_server = kread(&(clnt->cl_server)); + + snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s", + cl_server ? cl_server : "NULL"); + + CATCH_DEREF_FAULT(); +%} + +function task_status:long(_task:long) +%{ + struct rpc_task *task = (struct rpc_task *)(long) kread(&(THIS->_task)); + + THIS->__retvalue = task->tk_status; + + CATCH_DEREF_FAULT(); +%} + diff --git a/tracepoints/rpc_call_status.stp b/tracepoints/rpc_call_status.stp new file mode 100644 index 0000000..8018559 --- /dev/null +++ b/tracepoints/rpc_call_status.stp @@ -0,0 +1,32 @@ +/* + * stap -g -I ../tapset rpc_call_status.stp + */ +%{ +#include <linux/sunrpc/svc.h> +#include <linux/sunrpc/sched.h> +#include <linux/sunrpc/clnt.h> +%} + +probe kernel.trace("rpc_bind_status") +{ + terror = task_status($task); + if (terror) + printf("rpc_bind_status:%s:%s: error %d (%s)\n", + cl_server($task), cl_prog($task), terror, errno_str(terror)); +} +probe kernel.trace("rpc_connect_status") +{ + terror = task_status($task); + if (terror) + printf("call_connect_status:%s:%s: error %d (%s)\n", + cl_server($task), cl_prog($task), terror, errno_str(terror)); +} +probe kernel.trace("rpc_call_status") +{ + terror = task_status($task); + if (terror) + printf("call_status:%s:%s: error %d (%s)\n", + cl_server($task), cl_prog($task), terror, errno_str(terror)); +} +probe begin { log("starting rpc call status probe") } +probe end { log("ending rpc call status probe") } |
