summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <sandmann@daimi.au.dk>2009-10-21 12:28:43 -0400
committerSøren Sandmann Pedersen <sandmann@daimi.au.dk>2009-10-21 12:28:43 -0400
commitecb15e0b7fc6c695ced6bdac4444e014686b16d8 (patch)
treed6c1fb36762bdf11cb1cc0170895f88e0b943145
parent393a26dad67c7a08a3e234f46c6f1c6b072286fe (diff)
Show the "-- kernel --" marker in kernel threads
The innermost context is normally user mode, so we don't show. For kernel threads, the innermost context is the kernel, so don't filter it out.
-rw-r--r--tracker.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/tracker.c b/tracker.c
index 9cadcea..ac60cf5 100644
--- a/tracker.c
+++ b/tracker.c
@@ -932,7 +932,7 @@ process_sample (state_t *state, StackStash *resolved, sample_t *sample)
return;
}
- len = 4;
+ len = 5;
for (n = sample->trace; n != NULL; n = n->parent)
len++;
@@ -969,6 +969,17 @@ process_sample (state_t *state, StackStash *resolved, sample_t *sample)
resolved_traces[len++] = POINTER_TO_U64 (symbol);
}
+ if (context && context->context != PERF_CONTEXT_USER)
+ {
+ /* Kernel threads do not have a user part, so we end up here
+ * without ever getting a user context. If this happens,
+ * add the '- - kernel - - ' name, so that kernel threads
+ * are properly blamed on the kernel
+ */
+ resolved_traces[len++] =
+ POINTER_TO_U64 (unique_dup (state->unique_symbols, context->name));
+ }
+
cmdline = make_message (state, "[%s]", process->comm);
resolved_traces[len++] = POINTER_TO_U64 (cmdline);