From: Soeren Sandmann Date: Sun, 3 Apr 2005 22:06:00 +0000 (+0000) Subject: Put current process to sleep. X-Git-Tag: sysprof-0.9~35 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6c408203c2e41bfd4fd98b2a347cfde36ac2ad00;p=platform%2Fupstream%2Fsysprof.git Put current process to sleep. Sun Apr 3 17:03:33 2005 Soeren Sandmann * sysprof-module.c (queue_generate_stack_trace): Put current process to sleep. * sysprof-module.c (do_generate): Wake up the traced process --- diff --git a/ChangeLog b/ChangeLog index e9e09b7..da3e1d6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Sun Apr 3 17:03:33 2005 Soeren Sandmann + + * 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 * sysprof.c (build_gui): Remove stray % diff --git a/sysprof-module.c b/sysprof-module.c index d70cb8f..3915d6b 100644 --- a/sysprof-module.c +++ b/sysprof-module.c @@ -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