Put current process to sleep.

Sun Apr  3 17:03:33 2005  Soeren Sandmann  <sandmann@redhat.com>

	* sysprof-module.c (queue_generate_stack_trace): Put current
	process to sleep.

	* sysprof-module.c (do_generate): Wake up the traced process
This commit is contained in:
Soeren Sandmann
2005-04-03 22:06:00 +00:00
committed by Søren Sandmann Pedersen
parent bef6878e61
commit 6c408203c2
2 changed files with 25 additions and 6 deletions

View File

@ -1,3 +1,10 @@
Sun Apr 3 17:03:33 2005 Soeren Sandmann <sandmann@redhat.com>
* sysprof-module.c (queue_generate_stack_trace): Put current
process to sleep.
* sysprof-module.c (do_generate): Wake up the traced process
Thu Mar 31 23:09:09 2005 Soeren Sandmann <sandmann@redhat.com>
* sysprof.c (build_gui): Remove stray %

View File

@ -237,7 +237,7 @@ generate_stack_trace(struct task_struct *task,
trace->pid = task->pid;
trace->truncated = 0;
trace->addresses[0] = (void *)regs->eip;
i = 1;
@ -262,15 +262,16 @@ generate_stack_trace(struct task_struct *task,
struct work_struct work;
static int in_queue;
static int saved_state;
DECLARE_WAIT_QUEUE_HEAD (wait_to_be_scanned);
static void
do_generate (void *data)
{
struct task_struct *task = data;
struct task_struct *g, *p;
in_queue = 0;
/* Make sure the thread still exists */
do_each_thread (g, p) {
if (p == task) {
@ -281,9 +282,13 @@ do_generate (void *data)
wake_up (&wait_for_trace);
return;
goto out;
}
} while_each_thread (g, p);
out:
wake_up_process (task);
in_queue = 0;
}
static void
@ -292,11 +297,18 @@ queue_generate_stack_trace (struct task_struct *cur)
if (in_queue)
return;
in_queue = 1;
#if 0
printk(KERN_ALERT "qst: current: %d\n", current? current->pid : -1);
#endif
INIT_WORK (&work, do_generate, cur);
in_queue = 1;
schedule_work (&work);
saved_state = cur->state;
set_task_state (cur, TASK_UNINTERRUPTIBLE);
}
static void