mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-10 07:00:53 +00:00
*** empty log message ***
This commit is contained in:
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include "sysprof-module.h"
|
#include "sysprof-module.h"
|
||||||
|
|
||||||
|
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
MODULE_AUTHOR("Soeren Sandmann (sandmann@daimi.au.dk)");
|
MODULE_AUTHOR("Soeren Sandmann (sandmann@daimi.au.dk)");
|
||||||
|
|
||||||
@ -42,8 +43,9 @@ static struct timer_list timer;
|
|||||||
static void
|
static void
|
||||||
init_timeout (void)
|
init_timeout (void)
|
||||||
{
|
{
|
||||||
init_timer(&timer);
|
printk (KERN_ALERT "init timeout\n");
|
||||||
timer.function = on_timer;
|
timer.function = on_timer;
|
||||||
|
init_timer(&timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -89,6 +91,9 @@ read_user_space (userspace_reader *reader,
|
|||||||
if (user_page == 0)
|
if (user_page == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
printk (KERN_ALERT "locking\n");
|
||||||
|
spin_lock(&reader->task->mm->page_table_lock);
|
||||||
|
|
||||||
if (!reader->user_page || user_page != reader->user_page) {
|
if (!reader->user_page || user_page != reader->user_page) {
|
||||||
int found;
|
int found;
|
||||||
struct page *page;
|
struct page *page;
|
||||||
@ -102,12 +107,19 @@ read_user_space (userspace_reader *reader,
|
|||||||
1, 0, 0, &page, NULL);
|
1, 0, 0, &page, NULL);
|
||||||
|
|
||||||
if (!found)
|
if (!found)
|
||||||
|
{
|
||||||
|
printk (KERN_ALERT "unlocking\n");
|
||||||
|
spin_unlock(&reader->task->mm->page_table_lock);
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
reader->kernel_page = (unsigned long)kmap (page);
|
reader->kernel_page = (unsigned long)kmap (page);
|
||||||
reader->page = page;
|
reader->page = page;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printk (KERN_ALERT "unlocking\n");
|
||||||
|
spin_unlock(&reader->task->mm->page_table_lock);
|
||||||
|
|
||||||
if (get_user (res, (int *)(reader->kernel_page + (address - user_page))) != 0)
|
if (get_user (res, (int *)(reader->kernel_page + (address - user_page))) != 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -199,6 +211,8 @@ do_generate (void *data)
|
|||||||
|
|
||||||
in_queue = 0;
|
in_queue = 0;
|
||||||
|
|
||||||
|
printk (KERN_ALERT "do_generate\n");
|
||||||
|
|
||||||
/* Make sure the task still exists */
|
/* Make sure the task still exists */
|
||||||
for_each_process (p)
|
for_each_process (p)
|
||||||
if (p == task)
|
if (p == task)
|
||||||
@ -207,6 +221,7 @@ do_generate (void *data)
|
|||||||
|
|
||||||
go_ahead:
|
go_ahead:
|
||||||
generate_stack_trace(task, head);
|
generate_stack_trace(task, head);
|
||||||
|
printk (KERN_ALERT "generated stack\n");
|
||||||
if (head++ == &stack_traces[N_TRACES - 1])
|
if (head++ == &stack_traces[N_TRACES - 1])
|
||||||
head = &stack_traces[0];
|
head = &stack_traces[0];
|
||||||
|
|
||||||
@ -214,7 +229,7 @@ do_generate (void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
queue_stack (struct task_struct *cur)
|
queue_generate_stack_trace (struct task_struct *cur)
|
||||||
{
|
{
|
||||||
if (in_queue)
|
if (in_queue)
|
||||||
return;
|
return;
|
||||||
@ -230,13 +245,14 @@ static void
|
|||||||
on_timer(unsigned long dong)
|
on_timer(unsigned long dong)
|
||||||
{
|
{
|
||||||
static int n_ticks = 0;
|
static int n_ticks = 0;
|
||||||
|
task_t *task = current;
|
||||||
|
|
||||||
++n_ticks;
|
++n_ticks;
|
||||||
|
|
||||||
if (current && current->pid != 0)
|
printk (KERN_ALERT "on timer\n");
|
||||||
{
|
|
||||||
queue_stack (current);
|
if (task && task->pid != 0)
|
||||||
}
|
queue_generate_stack_trace (task);
|
||||||
|
|
||||||
add_timeout (INTERVAL, on_timer);
|
add_timeout (INTERVAL, on_timer);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user