mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-11 23:51:06 +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>
|
Sun Apr 3 17:03:33 2005 Soeren Sandmann <sandmann@redhat.com>
|
||||||
|
|
||||||
* sysprof-module.c (queue_generate_stack_trace): Put current
|
* sysprof-module.c (queue_generate_stack_trace): Put current
|
||||||
|
|||||||
10
TODO
10
TODO
@ -1,6 +1,7 @@
|
|||||||
Before 1.0:
|
Before 1.0:
|
||||||
|
|
||||||
- grep FIXME
|
- 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
|
- Need to make "make install" work (how do you know where to install
|
||||||
kernel modules?)
|
kernel modules?)
|
||||||
- Find out what distributions it actually works on
|
- 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
|
- hook up menu items view/start etc (or possibly get rid of them or move
|
||||||
them)
|
them)
|
||||||
- give profiles on the command line
|
- give profiles on the command line
|
||||||
- autoconfuscate?
|
- auto*?
|
||||||
- .desktop file
|
- .desktop file
|
||||||
- Consider expanding a few more levels of a new descendants tree
|
- Consider expanding a few more levels of a new descendants tree
|
||||||
|
|
||||||
@ -81,10 +82,6 @@ Before 1.2:
|
|||||||
|
|
||||||
- hide internal stuff in ProfileDescendant
|
- hide internal stuff in ProfileDescendant
|
||||||
|
|
||||||
- kernel module should put process to sleep before sampling. Should get us
|
|
||||||
more accurate data
|
|
||||||
|
|
||||||
|
|
||||||
Later:
|
Later:
|
||||||
|
|
||||||
- Figure out how Google's pprof script works. Then add real call graph
|
- Figure out how Google's pprof script works. Then add real call graph
|
||||||
@ -154,6 +151,9 @@ Later:
|
|||||||
|
|
||||||
DONE:
|
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
|
- Make sure samples label shows correct nunber after Open
|
||||||
|
|
||||||
- Move "samples" label to the toolbar, then get rid of statusbar.
|
- 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;
|
struct work_struct work;
|
||||||
static int in_queue;
|
|
||||||
static int saved_state;
|
|
||||||
|
|
||||||
DECLARE_WAIT_QUEUE_HEAD (wait_to_be_scanned);
|
DECLARE_WAIT_QUEUE_HEAD (wait_to_be_scanned);
|
||||||
|
|
||||||
@ -271,8 +269,11 @@ do_generate (void *data)
|
|||||||
{
|
{
|
||||||
struct task_struct *task = data;
|
struct task_struct *task = data;
|
||||||
struct task_struct *g, *p;
|
struct task_struct *g, *p;
|
||||||
|
|
||||||
/* Make sure the thread still exists */
|
/* 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) {
|
do_each_thread (g, p) {
|
||||||
if (p == task) {
|
if (p == task) {
|
||||||
generate_stack_trace(task, head);
|
generate_stack_trace(task, head);
|
||||||
@ -281,34 +282,14 @@ do_generate (void *data)
|
|||||||
head = &stack_traces[0];
|
head = &stack_traces[0];
|
||||||
|
|
||||||
wake_up (&wait_for_trace);
|
wake_up (&wait_for_trace);
|
||||||
|
wake_up_process (task);
|
||||||
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
} while_each_thread (g, p);
|
} while_each_thread (g, p);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
wake_up_process (task);
|
add_timeout (INTERVAL, on_timer);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -321,21 +302,16 @@ on_timer(unsigned long dong)
|
|||||||
;
|
;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (current && current->pid != 0) {
|
if (current && current->state == TASK_RUNNING && current->pid != 0) {
|
||||||
#if 0
|
INIT_WORK (&work, do_generate, current);
|
||||||
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
|
|
||||||
|
|
||||||
|
set_current_state (TASK_UNINTERRUPTIBLE);
|
||||||
add_timeout (INTERVAL, on_timer);
|
|
||||||
|
schedule_work (&work);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
add_timeout (INTERVAL, on_timer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|||||||
Reference in New Issue
Block a user