]> sourceware.org Git - systemtap.git/commitdiff
Fix 13501 (partial) by making 'stap -L scheduler.ctxswitch' work.
authorDavid Smith <dsmith@redhat.com>
Fri, 16 Dec 2011 15:33:38 +0000 (09:33 -0600)
committerDavid Smith <dsmith@redhat.com>
Fri, 16 Dec 2011 15:33:38 +0000 (09:33 -0600)
* tapset/scheduler.stp (scheduler.ctxswitch): Merge the probe aliases for
  '__scheduler.ctxswitch.tp' and '__scheduler.ctxswitch.kp'.
* testsuite/buildok/scheduler-ctxswitch.stp: Remove
  '__scheduler.ctxswitch.kp' testing.

tapset/scheduler.stp
testsuite/buildok/scheduler-ctxswitch.stp

index f1787e8c37f3121411af1c18e46872c83eec42c6..136d7557513bd90be9b13b2c772ea22bb2c1f8b7 100644 (file)
@@ -101,35 +101,30 @@ probe scheduler.balance = kernel.function("idle_balance") ?
  * @next_priority: The priority of the process to be switched in
  * @prevtsk_state: the state of the process to be switched out
  * @nexttsk_state: the state of the process to be switched in
- *
- * Currently, SystemTap can't access arguments of inline 
- * functions. So we choose to probe __switch_to instead 
- * of context_switch()       
  */
 
-probe __scheduler.ctxswitch.tp = kernel.trace("sched_switch") 
-{
-       next_pid =  $next->tgid
-       next_tid = $next->pid
-       next_task = $next
-       next_task_name = task_execname($next)
-       nexttsk_state = $next->state
-       next_priority = $next->prio
-       prev_priority = $prev->prio
-       prev_pid = $prev->tgid
-       prev_tid = $prev->pid
-       prev_task       =       $prev
-       prev_task_name  =       task_execname($prev)
-       prevtsk_state = $prev->state
-}
+/*
+ * We prefer the "sched_switch" tracepoint here, since we can reliably
+ * access the tracepoint's arguments.  If we don't have the
+ * tracepoint, we try function probing.  But these are typically
+ * inlined, and SystemTap can't access arguments of inline functions
+ * consistently. So we choose to probe __switch_to() instead of
+ * context_switch() on some platforms.
+ * 
+ * Since the argument names for the tracepoint ("$prev" and "$next")
+ * match up with the function argument names, handling either the
+ * tracepoint or function here was made easier.
+ */
 
-probe __scheduler.ctxswitch.kp =
+probe scheduler.ctxswitch = kernel.trace("sched_switch") !,
 %( arch != "x86_64" && arch != "ia64" %?
        kernel.function("__switch_to")
 %:
        kernel.function("context_switch")
 %)
 {
+       name = "ctxswitch"
+
        /*
         * Note that we prefer '$prev_p' here because on RHEL5
         * (2.6.18-238.1.1.el5) the '__switch_to()' function has both
@@ -180,13 +175,6 @@ probe __scheduler.ctxswitch.kp =
        }
 }
 
-probe scheduler.ctxswitch =
-       __scheduler.ctxswitch.tp !,
-       __scheduler.ctxswitch.kp
-{
-       name = "ctxswitch"
-}
-
 
 /**
  * probe scheduler.kthread_stop - A thread created by kthread_create is being stopped
index d70a377412cc0b05cae57f6c75a6c43ba57bc4bf..f93c1e02a5bc7d28e4f8e1238311ba5aeb7fecaa 100755 (executable)
@@ -10,13 +10,3 @@ probe scheduler.ctxswitch
                next_pid, next_priority, nexttsk_state,
                next_task_name, next_tid)
 }
-
-probe __scheduler.ctxswitch.kp
-{
-        printf("prev: pid %d, priority %d, state %d, task_name %s, tid %d\n",
-               prev_pid, prev_priority, prevtsk_state,
-               prev_task_name, prev_tid)
-        printf("next: pid %d, priority %d, state %d, task_name %s, tid %d\n",
-               next_pid, next_priority, nexttsk_state,
-               next_task_name, next_tid)
-}
This page took 0.02945 seconds and 5 git commands to generate.