Seems to work

This commit is contained in:
Søren Sandmann Pedersen
2004-10-30 04:26:32 +00:00
parent 7b07956eb3
commit 7487166139
2 changed files with 10 additions and 6 deletions

View File

@ -21,7 +21,7 @@
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Soeren Sandmann (sandmann@daimi.au.dk)");
#define SAMPLES_PER_SECOND (10)
#define SAMPLES_PER_SECOND (100)
#define INTERVAL (HZ / SAMPLES_PER_SECOND)
#define N_TRACES 256
@ -93,7 +93,7 @@ add_timeout(unsigned int interval,
static int
read_task_address (struct task_struct *task, unsigned long address, int *result)
{
unsigned long page_addr = address & PAGE_MASK;
unsigned long page_addr = (address & PAGE_MASK);
int found;
struct page *page;
void *kaddr;
@ -103,14 +103,16 @@ read_task_address (struct task_struct *task, unsigned long address, int *result)
return 0;
found = get_user_pages (task, task->mm, page_addr, 1, 0, 0, &page, NULL);
if (!found)
return 0;
kaddr = kmap_atomic (page, KM_SOFTIRQ0);
res = ((int *)kaddr)[(address - page_addr) / 4];
kaddr = kmap_atomic (page, KM_SOFTIRQ0);
if (get_user (res, (int *)kaddr + (address - page_addr) / 4)) {
kunmap_atomic (page, KM_SOFTIRQ0);
return 0;
}
kunmap_atomic (page, KM_SOFTIRQ0);
*result = res;

View File

@ -110,10 +110,12 @@ on_read (gpointer data)
rd = read (app->input_fd, &trace, sizeof (trace));
#if 0
g_print ("pid: %d\n", trace.pid);
for (i=0; i < trace.n_addresses; ++i)
g_print ("rd: %08x\n", trace.addresses[i]);
g_print ("-=-\n");
#endif
if (rd > 0 && app->profiling && !app->generating_profile)
{