mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
Seems to work
This commit is contained in:
@ -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;
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user