This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[PATCH 2/3] Display task flags as character strings
- From: Steve Dickson <SteveD at redhat dot com>
- To: Systemtap Mailing list <systemtap at sources dot redhat dot com>
- Date: Thu, 25 Feb 2010 17:47:14 -0500
- Subject: [PATCH 2/3] Display task flags as character strings
- References: <4B86FD5B.8080507@RedHat.com>
commit f806afc977f8995d78226af13fd81fbe95da2e94
Author: Steve Dickson <steved@redhat.com>
Date: Thu Feb 25 14:39:52 2010 -0500
Display task flags as character strings
To make the output clearer, translate the task flag bits
into a corresponding character string or if there are
no bits set in the flags, don't display it at all.
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/tapset/rpc.stp b/tapset/rpc.stp
index b2093be..1ca3d1d 100644
--- a/tapset/rpc.stp
+++ b/tapset/rpc.stp
@@ -325,8 +325,8 @@ probe sunrpc.clnt.call_sync = kernel.function("rpc_call_sync") !,
flags = $flags
name = "sunrpc.clnt.call_sync"
- argstr = sprintf("%s %d %s %d %s %d", servername, xid, progname,
- vers, procname, flags)
+ argstr = sprintf("%s %d %s %d %s %s", servername, xid, progname,
+ vers, procname, task_flags(flags))
}
probe sunrpc.clnt.call_sync.return = kernel.function("rpc_call_sync").return !,
@@ -372,8 +372,8 @@ probe sunrpc.clnt.call_async = kernel.function("rpc_call_async") !,
flags = $flags
name = "sunrpc.clnt.call_async"
- argstr = sprintf("%s %d %s %d %s %d", servername, xid, progname,
- vers, procname, flags)
+ argstr = sprintf("%s %d %s %d %s %s", servername, xid, progname,
+ vers, procname, task_flags(flags))
}
probe sunrpc.clnt.call_async.return =
@@ -409,8 +409,8 @@ probe sunrpc.clnt.restart_call = kernel.function("rpc_restart_call") !,
tk_runstate = $task->tk_runstate
name = "sunrpc.clnt.restart_call"
- argstr = sprintf("%s %d %d %d %d %d %d", servername, prog, xid, tk_pid,
- tk_flags, tk_priority, tk_runstate)
+ argstr = sprintf("%s %d %d %d %s %d %d", servername, prog, xid, tk_pid,
+ task_flags(tk_flags), tk_priority, tk_runstate)
}
probe sunrpc.clnt.restart_call.return =
@@ -781,7 +781,8 @@ probe sunrpc.sched.new_task = kernel.function("rpc_new_task") !,
flags = $setup_data->flags
%)
name = "sunrpc.sched.new_task"
- argstr = sprintf("%d %d %d %d %d", xid, prog, vers, prot, flags)
+ argstr = sprintf("%d %d %d %d %s", xid, prog, vers, prot,
+ task_flags(flags))
}
probe sunrpc.sched.new_task.return = kernel.function("rpc_new_task").return !,
@@ -812,7 +813,8 @@ probe sunrpc.sched.release_task = kernel.function("rpc_release_task") !,
tk_flags = $task->tk_flags
name = "sunrpc.sched.release_task"
- argstr = sprintf("%d %d %d %d %d", xid, prog, vers, prot, tk_flags)
+ argstr = sprintf("%d %d %d %d %s", xid, prog, vers, prot,
+ task_flags(tk_flags))
}
probe sunrpc.sched.release_task.return =
@@ -846,8 +848,8 @@ probe sunrpc.sched.execute = kernel.function("__rpc_execute") !,
tk_flags = $task->tk_flags
name = "sunrpc.sched.execute"
- argstr = sprintf("%d %d %d %d %d %d", xid, prog, vers, prot,
- tk_pid, tk_flags)
+ argstr = sprintf("%d %d %d %d %d %s", xid, prog, vers, prot,
+ tk_pid, task_flags(tk_flags))
}
probe sunrpc.sched.execute.return = kernel.function("__rpc_execute").return !,
@@ -887,8 +889,8 @@ probe sunrpc.sched.delay = kernel.function("rpc_delay") !,
delay = $delay
name = "sunrpc.sched.delay"
- argstr = sprintf("%d %d %d %d %d %d %d", xid, prog, vers,
- prot, tk_pid, tk_flags, delay)
+ argstr = sprintf("%d %d %d %d %d %d %s", xid, prog, vers,
+ prot, tk_pid, delay, task_flags(tk_flags))
}
probe sunrpc.sched.delay.return = kernel.function("rpc_delay").return !,
@@ -1037,3 +1039,52 @@ function addr_from_rqst_str:string(_rqstp:long)
CATCH_DEREF_FAULT();
%}
+function task_flags:string(flags:long)
+%{
+ char buf[MAXSTRINGLEN];
+ int cc=0;
+
+ if (RPC_TASK_ASYNC & THIS->flags) {
+ sprintf(buf+cc, "ASYNC|");
+ cc = strlen(buf);
+ }
+ if (RPC_TASK_SWAPPER & THIS->flags) {
+ sprintf(buf+cc, "SWAPPER|");
+ cc = strlen(buf);
+ }
+ if (RPC_CALL_MAJORSEEN & THIS->flags) {
+ sprintf(buf+cc, "MAJORSEEN|");
+ cc = strlen(buf);
+ }
+ if (RPC_TASK_ROOTCREDS & THIS->flags) {
+ sprintf(buf+cc, "ROOTCREDS|");
+ cc = strlen(buf);
+ }
+ if (RPC_TASK_DYNAMIC & THIS->flags) {
+ sprintf(buf+cc, "DYNAMIC|");
+ cc = strlen(buf);
+ }
+ if (RPC_TASK_KILLED & THIS->flags) {
+ sprintf(buf+cc, "KILLED|");
+ cc = strlen(buf);
+ }
+ if (RPC_TASK_SOFT & THIS->flags) {
+ sprintf(buf+cc, "SOFT|");
+ cc = strlen(buf);
+ }
+ if (RPC_TASK_SOFTCONN & THIS->flags) {
+ sprintf(buf+cc, "SOFTCONN|");
+ cc = strlen(buf);
+ }
+
+ if (cc) {
+ buf[strlen(buf)-1] = '\0';
+ snprintf(THIS->__retvalue, MAXSTRINGLEN, "0x%llx(%s)",
+ THIS->flags, buf);
+ } else if (THIS->flags)
+ snprintf(THIS->__retvalue, MAXSTRINGLEN, "0x%llx", THIS->flags);
+ else
+ snprintf(THIS->__retvalue, MAXSTRINGLEN, " ");
+
+ CATCH_DEREF_FAULT();
+%}