aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/oprofile/cpu_buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/oprofile/cpu_buffer.c')
-rw-r--r--drivers/oprofile/cpu_buffer.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/oprofile/cpu_buffer.c b/drivers/oprofile/cpu_buffer.c
index d6c68270b3da..b47ce038490f 100644
--- a/drivers/oprofile/cpu_buffer.c
+++ b/drivers/oprofile/cpu_buffer.c
@@ -112,7 +112,7 @@ void end_cpu_work(void)
112} 112}
113 113
114/* Resets the cpu buffer to a sane state. */ 114/* Resets the cpu buffer to a sane state. */
115void cpu_buffer_reset(struct oprofile_cpu_buffer * cpu_buf) 115void cpu_buffer_reset(struct oprofile_cpu_buffer *cpu_buf)
116{ 116{
117 /* reset these to invalid values; the next sample 117 /* reset these to invalid values; the next sample
118 * collected will populate the buffer with proper 118 * collected will populate the buffer with proper
@@ -123,7 +123,7 @@ void cpu_buffer_reset(struct oprofile_cpu_buffer * cpu_buf)
123} 123}
124 124
125/* compute number of available slots in cpu_buffer queue */ 125/* compute number of available slots in cpu_buffer queue */
126static unsigned long nr_available_slots(struct oprofile_cpu_buffer const * b) 126static unsigned long nr_available_slots(struct oprofile_cpu_buffer const *b)
127{ 127{
128 unsigned long head = b->head_pos; 128 unsigned long head = b->head_pos;
129 unsigned long tail = b->tail_pos; 129 unsigned long tail = b->tail_pos;
@@ -134,7 +134,7 @@ static unsigned long nr_available_slots(struct oprofile_cpu_buffer const * b)
134 return tail + (b->buffer_size - head) - 1; 134 return tail + (b->buffer_size - head) - 1;
135} 135}
136 136
137static void increment_head(struct oprofile_cpu_buffer * b) 137static void increment_head(struct oprofile_cpu_buffer *b)
138{ 138{
139 unsigned long new_head = b->head_pos + 1; 139 unsigned long new_head = b->head_pos + 1;
140 140
@@ -149,17 +149,17 @@ static void increment_head(struct oprofile_cpu_buffer * b)
149} 149}
150 150
151static inline void 151static inline void
152add_sample(struct oprofile_cpu_buffer * cpu_buf, 152add_sample(struct oprofile_cpu_buffer *cpu_buf,
153 unsigned long pc, unsigned long event) 153 unsigned long pc, unsigned long event)
154{ 154{
155 struct op_sample * entry = &cpu_buf->buffer[cpu_buf->head_pos]; 155 struct op_sample *entry = &cpu_buf->buffer[cpu_buf->head_pos];
156 entry->eip = pc; 156 entry->eip = pc;
157 entry->event = event; 157 entry->event = event;
158 increment_head(cpu_buf); 158 increment_head(cpu_buf);
159} 159}
160 160
161static inline void 161static inline void
162add_code(struct oprofile_cpu_buffer * buffer, unsigned long value) 162add_code(struct oprofile_cpu_buffer *buffer, unsigned long value)
163{ 163{
164 add_sample(buffer, ESCAPE_CODE, value); 164 add_sample(buffer, ESCAPE_CODE, value);
165} 165}
@@ -173,10 +173,10 @@ add_code(struct oprofile_cpu_buffer * buffer, unsigned long value)
173 * pc. We tag this in the buffer by generating kernel enter/exit 173 * pc. We tag this in the buffer by generating kernel enter/exit
174 * events whenever is_kernel changes 174 * events whenever is_kernel changes
175 */ 175 */
176static int log_sample(struct oprofile_cpu_buffer * cpu_buf, unsigned long pc, 176static int log_sample(struct oprofile_cpu_buffer *cpu_buf, unsigned long pc,
177 int is_kernel, unsigned long event) 177 int is_kernel, unsigned long event)
178{ 178{
179 struct task_struct * task; 179 struct task_struct *task;
180 180
181 cpu_buf->sample_received++; 181 cpu_buf->sample_received++;
182 182
@@ -222,7 +222,7 @@ static int oprofile_begin_trace(struct oprofile_cpu_buffer *cpu_buf)
222 return 1; 222 return 1;
223} 223}
224 224
225static void oprofile_end_trace(struct oprofile_cpu_buffer * cpu_buf) 225static void oprofile_end_trace(struct oprofile_cpu_buffer *cpu_buf)
226{ 226{
227 cpu_buf->tracing = 0; 227 cpu_buf->tracing = 0;
228} 228}
@@ -260,7 +260,7 @@ void oprofile_add_sample(struct pt_regs * const regs, unsigned long event)
260#define MAX_IBS_SAMPLE_SIZE 14 260#define MAX_IBS_SAMPLE_SIZE 14
261 261
262void oprofile_add_ibs_sample(struct pt_regs *const regs, 262void oprofile_add_ibs_sample(struct pt_regs *const regs,
263 unsigned int * const ibs_sample, int ibs_code) 263 unsigned int *const ibs_sample, int ibs_code)
264{ 264{
265 int is_kernel = !user_mode(regs); 265 int is_kernel = !user_mode(regs);
266 struct oprofile_cpu_buffer *cpu_buf = &__get_cpu_var(cpu_buffer); 266 struct oprofile_cpu_buffer *cpu_buf = &__get_cpu_var(cpu_buffer);
@@ -345,7 +345,7 @@ void oprofile_add_trace(unsigned long pc)
345 */ 345 */
346static void wq_sync_buffer(struct work_struct *work) 346static void wq_sync_buffer(struct work_struct *work)
347{ 347{
348 struct oprofile_cpu_buffer * b = 348 struct oprofile_cpu_buffer *b =
349 container_of(work, struct oprofile_cpu_buffer, work.work); 349 container_of(work, struct oprofile_cpu_buffer, work.work);
350 if (b->cpu != smp_processor_id()) { 350 if (b->cpu != smp_processor_id()) {
351 printk(KERN_DEBUG "WQ on CPU%d, prefer CPU%d\n", 351 printk(KERN_DEBUG "WQ on CPU%d, prefer CPU%d\n",