summaryrefslogtreecommitdiff
path: root/module
diff options
context:
space:
mode:
authorSoeren Sandmann <sandmann@redhat.com>2005-09-27 05:35:19 +0000
committerSøren Sandmann Pedersen <ssp@src.gnome.org>2005-09-27 05:35:19 +0000
commitbce3b1fea61037e67c9ffcbbc6443f9a3314e469 (patch)
treef8e4f7943b8ed502735ff4ada8499313a26ba1bc /module
parent665d680c468731d53471a2bd59cce01ad14cf296 (diff)
If the address is 0x01, treat as kernel, regardless of whether we have a
Tue Sep 27 01:33:33 2005 Soeren Sandmann <sandmann@redhat.com> * process.c (process_lookup_symbol): If the address is 0x01, treat as kernel, regardless of whether we have a map for that address or not. * module/sysprof-module.c (timer_notify): Take a stack trace of the current process, even when we are in kernel mode. This way we can assign kernel activity to individual user space stacktraces. * TODO: updates.
Diffstat (limited to 'module')
-rw-r--r--module/sysprof-module.c60
1 files changed, 25 insertions, 35 deletions
diff --git a/module/sysprof-module.c b/module/sysprof-module.c
index 143f58e..3c26822 100644
--- a/module/sysprof-module.c
+++ b/module/sysprof-module.c
@@ -452,52 +452,42 @@ timer_notify (struct pt_regs *regs)
is_user = user_mode(regs);
- if (!current || current->pid == 0)
+ if (!current || current->pid == 0 || !current->mm)
return 0;
if (is_user && current->state != TASK_RUNNING)
return 0;
+ memset(trace, 0, sizeof (SysprofStackTrace));
+
+ trace->pid = current->pid;
+
+ i = 0;
if (!is_user)
{
- /* kernel */
-
- trace->pid = current->pid;
- trace->truncated = 0;
- trace->n_addresses = 1;
+ trace->addresses[i++] = 0x01;
+ regs = (void *)current->thread.esp0 - sizeof (struct pt_regs);
+ }
- /* 0x1 is taken by sysprof to mean "in kernel" */
- trace->addresses[0] = (void *)0x1;
+ trace->addresses[i++] = (void *)regs->REG_INS_PTR;
+
+ frame = (StackFrame *)regs->REG_FRAME_PTR;
+
+ while (pages_present (frame) &&
+ i < SYSPROF_MAX_ADDRESSES &&
+ ((unsigned long)frame) < START_OF_STACK &&
+ (unsigned long)frame >= regs->REG_STACK_PTR)
+ {
+ trace->addresses[i++] = (void *)frame->return_address;
+ frame = (StackFrame *)frame->next;
}
+
+ trace->n_addresses = i;
+
+ if (i == SYSPROF_MAX_ADDRESSES)
+ trace->truncated = 1;
else
- {
- memset(trace, 0, sizeof (SysprofStackTrace));
-
- trace->pid = current->pid;
trace->truncated = 0;
-
- i = 0;
-
- trace->addresses[i++] = (void *)regs->REG_INS_PTR;
-
- frame = (StackFrame *)regs->REG_FRAME_PTR;
-
- while (pages_present (frame) &&
- i < SYSPROF_MAX_ADDRESSES &&
- ((unsigned long)frame) < START_OF_STACK &&
- (unsigned long)frame >= regs->REG_STACK_PTR)
- {
- trace->addresses[i++] = (void *)frame->return_address;
- frame = (StackFrame *)frame->next;
- }
-
- trace->n_addresses = i;
-
- if (i == SYSPROF_MAX_ADDRESSES)
- trace->truncated = 1;
- else
- trace->truncated = 0;
- }
if (head++ == &stack_traces[N_TRACES - 1])
head = &stack_traces[0];