mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
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:
committed by
Søren Sandmann Pedersen
parent
bef6878e61
commit
6c408203c2
@ -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>
|
Thu Mar 31 23:09:09 2005 Soeren Sandmann <sandmann@redhat.com>
|
||||||
|
|
||||||
* sysprof.c (build_gui): Remove stray %
|
* sysprof.c (build_gui): Remove stray %
|
||||||
|
|||||||
@ -262,6 +262,9 @@ generate_stack_trace(struct task_struct *task,
|
|||||||
|
|
||||||
struct work_struct work;
|
struct work_struct work;
|
||||||
static int in_queue;
|
static int in_queue;
|
||||||
|
static int saved_state;
|
||||||
|
|
||||||
|
DECLARE_WAIT_QUEUE_HEAD (wait_to_be_scanned);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
do_generate (void *data)
|
do_generate (void *data)
|
||||||
@ -269,8 +272,6 @@ do_generate (void *data)
|
|||||||
struct task_struct *task = data;
|
struct task_struct *task = data;
|
||||||
struct task_struct *g, *p;
|
struct task_struct *g, *p;
|
||||||
|
|
||||||
in_queue = 0;
|
|
||||||
|
|
||||||
/* Make sure the thread still exists */
|
/* Make sure the thread still exists */
|
||||||
do_each_thread (g, p) {
|
do_each_thread (g, p) {
|
||||||
if (p == task) {
|
if (p == task) {
|
||||||
@ -281,9 +282,13 @@ do_generate (void *data)
|
|||||||
|
|
||||||
wake_up (&wait_for_trace);
|
wake_up (&wait_for_trace);
|
||||||
|
|
||||||
return;
|
goto out;
|
||||||
}
|
}
|
||||||
} while_each_thread (g, p);
|
} while_each_thread (g, p);
|
||||||
|
|
||||||
|
out:
|
||||||
|
wake_up_process (task);
|
||||||
|
in_queue = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -292,11 +297,18 @@ queue_generate_stack_trace (struct task_struct *cur)
|
|||||||
if (in_queue)
|
if (in_queue)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
in_queue = 1;
|
#if 0
|
||||||
|
printk(KERN_ALERT "qst: current: %d\n", current? current->pid : -1);
|
||||||
|
#endif
|
||||||
|
|
||||||
INIT_WORK (&work, do_generate, cur);
|
INIT_WORK (&work, do_generate, cur);
|
||||||
|
|
||||||
|
in_queue = 1;
|
||||||
|
|
||||||
schedule_work (&work);
|
schedule_work (&work);
|
||||||
|
|
||||||
|
saved_state = cur->state;
|
||||||
|
set_task_state (cur, TASK_UNINTERRUPTIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
Reference in New Issue
Block a user