diff options
author | Robert Richter <robert.richter@amd.com> | 2009-01-05 21:56:50 -0500 |
---|---|---|
committer | Robert Richter <robert.richter@amd.com> | 2009-01-07 16:45:46 -0500 |
commit | bd7dc46f770d317ada1348294ff1f319243b803b (patch) | |
tree | b328520c9676e4787de076aeb6e5c4804cd14786 /drivers/oprofile/buffer_sync.c | |
parent | d9928c25a6960cf128c2078a89fe6f8e0180ff60 (diff) |
oprofile: add op_cpu_buffer_get_data()
This function provides access to attached data of a sample. It returns
the size of data including the current value. Also,
op_cpu_buffer_get_size() is available to check if there is data
attached.
Signed-off-by: Robert Richter <robert.richter@amd.com>
Diffstat (limited to 'drivers/oprofile/buffer_sync.c')
-rw-r--r-- | drivers/oprofile/buffer_sync.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/oprofile/buffer_sync.c b/drivers/oprofile/buffer_sync.c index d969bb13a252..f9031d31eeb7 100644 --- a/drivers/oprofile/buffer_sync.c +++ b/drivers/oprofile/buffer_sync.c | |||
@@ -524,6 +524,7 @@ void sync_buffer(int cpu) | |||
524 | { | 524 | { |
525 | struct mm_struct *mm = NULL; | 525 | struct mm_struct *mm = NULL; |
526 | struct mm_struct *oldmm; | 526 | struct mm_struct *oldmm; |
527 | unsigned long val; | ||
527 | struct task_struct *new; | 528 | struct task_struct *new; |
528 | unsigned long cookie = 0; | 529 | unsigned long cookie = 0; |
529 | int in_kernel = 1; | 530 | int in_kernel = 1; |
@@ -559,10 +560,11 @@ void sync_buffer(int cpu) | |||
559 | state = sb_sample_start; | 560 | state = sb_sample_start; |
560 | add_kernel_ctx_switch(flags & IS_KERNEL); | 561 | add_kernel_ctx_switch(flags & IS_KERNEL); |
561 | } | 562 | } |
562 | if (flags & USER_CTX_SWITCH) { | 563 | if (flags & USER_CTX_SWITCH |
564 | && op_cpu_buffer_get_data(&entry, &val)) { | ||
563 | /* userspace context switch */ | 565 | /* userspace context switch */ |
566 | new = (struct task_struct *)val; | ||
564 | oldmm = mm; | 567 | oldmm = mm; |
565 | new = (struct task_struct *)sample->data[0]; | ||
566 | release_mm(oldmm); | 568 | release_mm(oldmm); |
567 | mm = take_tasks_mm(new); | 569 | mm = take_tasks_mm(new); |
568 | if (mm != oldmm) | 570 | if (mm != oldmm) |