mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
Re-schedule the timeout here instead of in on_timer().
Sun Apr 3 23:28:45 2005 Soeren Sandmann <sandmann@redhat.com> * sysprof-module.c (do_generate): Re-schedule the timeout here instead of in on_timer(). * sysprof-module.c (on_timer): Only block tasks in the TASK_RUNNING state.
This commit is contained in:
committed by
Søren Sandmann Pedersen
parent
6c408203c2
commit
9bddb58d92
@ -1,3 +1,11 @@
|
||||
Sun Apr 3 23:28:45 2005 Soeren Sandmann <sandmann@redhat.com>
|
||||
|
||||
* sysprof-module.c (do_generate): Re-schedule the timeout here
|
||||
instead of in on_timer().
|
||||
|
||||
* sysprof-module.c (on_timer): Only block tasks in the
|
||||
TASK_RUNNING state.
|
||||
|
||||
Sun Apr 3 17:03:33 2005 Soeren Sandmann <sandmann@redhat.com>
|
||||
|
||||
* sysprof-module.c (queue_generate_stack_trace): Put current
|
||||
|
||||
10
TODO
10
TODO
@ -1,6 +1,7 @@
|
||||
Before 1.0:
|
||||
|
||||
- grep FIXME
|
||||
- When the module is unloaded, kill all processes blocking in read
|
||||
- Need to make "make install" work (how do you know where to install
|
||||
kernel modules?)
|
||||
- Find out what distributions it actually works on
|
||||
@ -18,7 +19,7 @@ Before 1.0:
|
||||
- hook up menu items view/start etc (or possibly get rid of them or move
|
||||
them)
|
||||
- give profiles on the command line
|
||||
- autoconfuscate?
|
||||
- auto*?
|
||||
- .desktop file
|
||||
- Consider expanding a few more levels of a new descendants tree
|
||||
|
||||
@ -81,10 +82,6 @@ Before 1.2:
|
||||
|
||||
- hide internal stuff in ProfileDescendant
|
||||
|
||||
- kernel module should put process to sleep before sampling. Should get us
|
||||
more accurate data
|
||||
|
||||
|
||||
Later:
|
||||
|
||||
- Figure out how Google's pprof script works. Then add real call graph
|
||||
@ -154,6 +151,9 @@ Later:
|
||||
|
||||
DONE:
|
||||
|
||||
- kernel module should put process to sleep before sampling. Should get us
|
||||
more accurate data
|
||||
|
||||
- Make sure samples label shows correct nunber after Open
|
||||
|
||||
- Move "samples" label to the toolbar, then get rid of statusbar.
|
||||
|
||||
@ -261,8 +261,6 @@ 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);
|
||||
|
||||
@ -271,8 +269,11 @@ do_generate (void *data)
|
||||
{
|
||||
struct task_struct *task = data;
|
||||
struct task_struct *g, *p;
|
||||
|
||||
|
||||
/* Make sure the thread still exists */
|
||||
/* FIXME: this is probably not necessary anymore, now that
|
||||
* we make the process sleep
|
||||
*/
|
||||
do_each_thread (g, p) {
|
||||
if (p == task) {
|
||||
generate_stack_trace(task, head);
|
||||
@ -281,34 +282,14 @@ do_generate (void *data)
|
||||
head = &stack_traces[0];
|
||||
|
||||
wake_up (&wait_for_trace);
|
||||
|
||||
wake_up_process (task);
|
||||
|
||||
goto out;
|
||||
}
|
||||
} while_each_thread (g, p);
|
||||
|
||||
out:
|
||||
wake_up_process (task);
|
||||
in_queue = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
queue_generate_stack_trace (struct task_struct *cur)
|
||||
{
|
||||
if (in_queue)
|
||||
return;
|
||||
|
||||
#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);
|
||||
add_timeout (INTERVAL, on_timer);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -321,21 +302,16 @@ on_timer(unsigned long dong)
|
||||
;
|
||||
#endif
|
||||
|
||||
if (current && current->pid != 0) {
|
||||
#if 0
|
||||
printk(KERN_ALERT "current: %d\n", current->pid);
|
||||
#endif
|
||||
queue_generate_stack_trace (current);
|
||||
}
|
||||
#if 0
|
||||
else if (!current)
|
||||
printk(KERN_ALERT "no current\n");
|
||||
else
|
||||
printk(KERN_ALERT "current is 0\n");
|
||||
#endif
|
||||
if (current && current->state == TASK_RUNNING && current->pid != 0) {
|
||||
INIT_WORK (&work, do_generate, current);
|
||||
|
||||
|
||||
add_timeout (INTERVAL, on_timer);
|
||||
set_current_state (TASK_UNINTERRUPTIBLE);
|
||||
|
||||
schedule_work (&work);
|
||||
}
|
||||
else {
|
||||
add_timeout (INTERVAL, on_timer);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
|
||||
Reference in New Issue
Block a user