Commit 76ff9e3f authored by John Levon's avatar John Levon Committed by Linus Torvalds

[PATCH] OProfile: Export task->tgid in the buffer

Export the task->tgid to userspace as well. This is needed
for forthcoming thread profiling stuff and should have been
done in the original patch ... oh well.

This requires an upgrade to oprofile 0.5.3. You can get it from
the website, or, for the impatient, here :

	http://movementarian.org/oprofile-0.5.3.tar.gz
parent 97ef4805
......@@ -274,12 +274,17 @@ static void add_kernel_ctx_switch(unsigned int in_kernel)
add_event_entry(KERNEL_EXIT_SWITCH_CODE);
}
static void add_user_ctx_switch(pid_t pid, unsigned long cookie)
static void
add_user_ctx_switch(struct task_struct const * task, unsigned long cookie)
{
add_event_entry(ESCAPE_CODE);
add_event_entry(CTX_SWITCH_CODE);
add_event_entry(pid);
add_event_entry(task->pid);
add_event_entry(cookie);
/* Another code for daemon back-compat */
add_event_entry(ESCAPE_CODE);
add_event_entry(CTX_TGID_CODE);
add_event_entry(task->tgid);
}
......@@ -446,7 +451,7 @@ static void sync_buffer(struct oprofile_cpu_buffer * cpu_buf)
mm = take_tasks_mm(new);
cookie = get_exec_dcookie(mm);
add_user_ctx_switch(new->pid, cookie);
add_user_ctx_switch(new, cookie);
}
} else {
add_sample(mm, s, in_kernel);
......
......@@ -31,6 +31,7 @@ void wake_up_buffer_waiter(void);
#define KERNEL_ENTER_SWITCH_CODE 4
#define KERNEL_EXIT_SWITCH_CODE 5
#define MODULE_LOADED_CODE 6
#define CTX_TGID_CODE 7
/* add data to the event buffer */
void add_event_entry(unsigned long data);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment