summaryrefslogtreecommitdiff
path: root/drivers/oprofile/cpu_buffer.h
diff options
context:
space:
mode:
authorRobert Richter <robert.richter@amd.com>2008-12-04 16:27:00 +0100
committerRobert Richter <robert.richter@amd.com>2008-12-10 14:20:16 +0100
commitfbc9bf9f0ed4f0fbc47dcb5b1c26c28c93b60e33 (patch)
tree30cf2c1e7e2e7c0277c61758280edcbcd9689292 /drivers/oprofile/cpu_buffer.h
parentbf589e32960181fa8cbca7bfdd92265e49dc2dfa (diff)
downloadlinux-sh-fbc9bf9f0ed4f0fbc47dcb5b1c26c28c93b60e33.tar.gz
oprofile: moving cpu_buffer_reset() to cpu_buffer.h
This is in preparation for changes in the cpu buffer implementation. Signed-off-by: Robert Richter <robert.richter@amd.com>
Diffstat (limited to 'drivers/oprofile/cpu_buffer.h')
-rw-r--r--drivers/oprofile/cpu_buffer.h28
1 files changed, 13 insertions, 15 deletions
diff --git a/drivers/oprofile/cpu_buffer.h b/drivers/oprofile/cpu_buffer.h
index 6055b5678394..895763f065e9 100644
--- a/drivers/oprofile/cpu_buffer.h
+++ b/drivers/oprofile/cpu_buffer.h
@@ -50,7 +50,19 @@ struct oprofile_cpu_buffer {
DECLARE_PER_CPU(struct oprofile_cpu_buffer, cpu_buffer);
-void cpu_buffer_reset(struct oprofile_cpu_buffer *cpu_buf);
+/*
+ * Resets the cpu buffer to a sane state.
+ *
+ * reset these to invalid values; the next sample collected will
+ * populate the buffer with proper values to initialize the buffer
+ */
+static inline void cpu_buffer_reset(int cpu)
+{
+ struct oprofile_cpu_buffer *cpu_buf = &per_cpu(cpu_buffer, cpu);
+
+ cpu_buf->last_is_kernel = -1;
+ cpu_buf->last_task = NULL;
+}
static inline
struct op_sample *cpu_buffer_write_entry(struct oprofile_cpu_buffer *cpu_buf)
@@ -88,20 +100,6 @@ unsigned long cpu_buffer_entries(struct oprofile_cpu_buffer *b)
unsigned long head = b->head_pos;
unsigned long tail = b->tail_pos;
- /*
- * Subtle. This resets the persistent last_task
- * and in_kernel values used for switching notes.
- * BUT, there is a small window between reading
- * head_pos, and this call, that means samples
- * can appear at the new head position, but not
- * be prefixed with the notes for switching
- * kernel mode or a task switch. This small hole
- * can lead to mis-attribution or samples where
- * we don't know if it's in the kernel or not,
- * at the start of an event buffer.
- */
- cpu_buffer_reset(b);
-
if (head >= tail)
return head - tail;