mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +00:00
Sample all running tasks, not just current
This commit is contained in:
@ -272,17 +272,18 @@ do_generate (void *data)
|
|||||||
in_queue = 0;
|
in_queue = 0;
|
||||||
|
|
||||||
/* Make sure the task still exists */
|
/* Make sure the task still exists */
|
||||||
for_each_process (p)
|
for_each_process (p) {
|
||||||
if (p == task)
|
if (p == task) {
|
||||||
goto go_ahead;
|
generate_stack_trace(task, head);
|
||||||
return;
|
|
||||||
|
|
||||||
go_ahead:
|
if (head++ == &stack_traces[N_TRACES - 1])
|
||||||
generate_stack_trace(task, head);
|
head = &stack_traces[0];
|
||||||
if (head++ == &stack_traces[N_TRACES - 1])
|
|
||||||
head = &stack_traces[0];
|
|
||||||
|
|
||||||
wake_up (&wait_for_trace);
|
wake_up (&wait_for_trace);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -301,13 +302,12 @@ queue_generate_stack_trace (struct task_struct *cur)
|
|||||||
static void
|
static void
|
||||||
on_timer(unsigned long dong)
|
on_timer(unsigned long dong)
|
||||||
{
|
{
|
||||||
static int n_ticks = 0;
|
struct task_struct *p;
|
||||||
task_t *task = current;
|
|
||||||
|
|
||||||
++n_ticks;
|
for_each_process (p) {
|
||||||
|
if (p->state == TASK_RUNNING)
|
||||||
if (task && task->pid != 0)
|
queue_generate_stack_trace (p);
|
||||||
queue_generate_stack_trace (task);
|
}
|
||||||
|
|
||||||
add_timeout (INTERVAL, on_timer);
|
add_timeout (INTERVAL, on_timer);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user