Lines Matching +full:no +full:- +full:pc +full:- +full:write
4 * @remark Copyright 2002-2009 OProfile authors
11 * Each CPU has a local buffer that stores PC value/event
52 cpu_buf->sample_lost_overflow++; in oprofile_cpu_buffer_inc_smpl_lost()
79 b->last_task = NULL; in alloc_cpu_buffers()
80 b->last_is_kernel = -1; in alloc_cpu_buffers()
81 b->tracing = 0; in alloc_cpu_buffers()
82 b->buffer_size = buffer_size; in alloc_cpu_buffers()
83 b->sample_received = 0; in alloc_cpu_buffers()
84 b->sample_lost_overflow = 0; in alloc_cpu_buffers()
85 b->backtrace_aborted = 0; in alloc_cpu_buffers()
86 b->sample_invalid_eip = 0; in alloc_cpu_buffers()
87 b->cpu = i; in alloc_cpu_buffers()
88 INIT_DELAYED_WORK(&b->work, wq_sync_buffer); in alloc_cpu_buffers()
94 return -ENOMEM; in alloc_cpu_buffers()
110 schedule_delayed_work_on(i, &b->work, DEFAULT_TIMER_EXPIRE + i); in start_cpu_work()
126 /* these works are per-cpu, no need for flush_sync */ in flush_cpu_work()
127 flush_delayed_work(&b->work); in flush_cpu_work()
132 * This function prepares the cpu buffer to write a sample.
146 entry->event = ring_buffer_lock_reserve in op_cpu_buffer_write_reserve()
148 size * sizeof(entry->sample->data[0])); in op_cpu_buffer_write_reserve()
149 if (!entry->event) in op_cpu_buffer_write_reserve()
151 entry->sample = ring_buffer_event_data(entry->event); in op_cpu_buffer_write_reserve()
152 entry->size = size; in op_cpu_buffer_write_reserve()
153 entry->data = entry->sample->data; in op_cpu_buffer_write_reserve()
155 return entry->sample; in op_cpu_buffer_write_reserve()
160 return ring_buffer_unlock_commit(op_ring_buffer, entry->event); in op_cpu_buffer_write_commit()
170 entry->event = e; in op_cpu_buffer_read_entry()
171 entry->sample = ring_buffer_event_data(e); in op_cpu_buffer_read_entry()
172 entry->size = (ring_buffer_event_length(e) - sizeof(struct op_sample)) in op_cpu_buffer_read_entry()
173 / sizeof(entry->sample->data[0]); in op_cpu_buffer_read_entry()
174 entry->data = entry->sample->data; in op_cpu_buffer_read_entry()
175 return entry->sample; in op_cpu_buffer_read_entry()
197 /* notice a switch from user->kernel or vice versa */ in op_add_code()
199 if (cpu_buf->last_is_kernel != is_kernel) { in op_add_code()
200 cpu_buf->last_is_kernel = is_kernel; in op_add_code()
207 if (cpu_buf->last_task != task) { in op_add_code()
208 cpu_buf->last_task = task; in op_add_code()
223 return -ENOMEM; in op_add_code()
225 sample->eip = ESCAPE_CODE; in op_add_code()
226 sample->event = flags; in op_add_code()
238 unsigned long pc, unsigned long event) in op_add_sample() argument
245 return -ENOMEM; in op_add_sample()
247 sample->eip = pc; in op_add_sample()
248 sample->event = event; in op_add_sample()
258 * pc. We tag this in the buffer by generating kernel enter/exit
262 log_sample(struct oprofile_cpu_buffer *cpu_buf, unsigned long pc, in log_sample() argument
267 cpu_buf->sample_received++; in log_sample()
269 if (pc == ESCAPE_CODE) { in log_sample()
270 cpu_buf->sample_invalid_eip++; in log_sample()
277 if (op_add_sample(cpu_buf, pc, event)) in log_sample()
283 cpu_buf->sample_lost_overflow++; in log_sample()
289 cpu_buf->tracing = 1; in oprofile_begin_trace()
294 cpu_buf->tracing = 0; in oprofile_end_trace()
298 __oprofile_add_ext_sample(unsigned long pc, struct pt_regs * const regs, in __oprofile_add_ext_sample() argument
309 if (!log_sample(cpu_buf, pc, backtrace, is_kernel, event, task)) in __oprofile_add_ext_sample()
321 void oprofile_add_ext_hw_sample(unsigned long pc, struct pt_regs * const regs, in oprofile_add_ext_hw_sample() argument
325 __oprofile_add_ext_sample(pc, regs, event, is_kernel, task); in oprofile_add_ext_hw_sample()
328 void oprofile_add_ext_sample(unsigned long pc, struct pt_regs * const regs, in oprofile_add_ext_sample() argument
331 __oprofile_add_ext_sample(pc, regs, event, is_kernel, NULL); in oprofile_add_ext_sample()
337 unsigned long pc; in oprofile_add_sample() local
341 pc = profile_pc(regs); in oprofile_add_sample()
344 pc = ESCAPE_CODE; /* as this causes an early return. */ in oprofile_add_sample()
347 __oprofile_add_ext_sample(pc, regs, event, is_kernel, NULL); in oprofile_add_sample()
358 unsigned long pc, int code, int size) in oprofile_write_reserve() argument
364 cpu_buf->sample_received++; in oprofile_write_reserve()
366 /* no backtraces for samples with data */ in oprofile_write_reserve()
373 sample->eip = ESCAPE_CODE; in oprofile_write_reserve()
374 sample->event = 0; /* no flags */ in oprofile_write_reserve()
377 op_cpu_buffer_add_data(entry, pc); in oprofile_write_reserve()
382 entry->event = NULL; in oprofile_write_reserve()
383 cpu_buf->sample_lost_overflow++; in oprofile_write_reserve()
388 if (!entry->event) in oprofile_add_data()
395 if (!entry->event) in oprofile_add_data64()
410 if (!entry->event) in oprofile_write_commit()
411 return -EINVAL; in oprofile_write_commit()
415 void oprofile_add_pc(unsigned long pc, int is_kernel, unsigned long event) in oprofile_add_pc() argument
418 log_sample(cpu_buf, pc, 0, is_kernel, event, NULL); in oprofile_add_pc()
421 void oprofile_add_trace(unsigned long pc) in oprofile_add_trace() argument
425 if (!cpu_buf->tracing) in oprofile_add_trace()
432 if (pc == ESCAPE_CODE) in oprofile_add_trace()
435 if (op_add_sample(cpu_buf, pc, 0)) in oprofile_add_trace()
440 cpu_buf->tracing = 0; in oprofile_add_trace()
441 cpu_buf->backtrace_aborted++; in oprofile_add_trace()
456 if (b->cpu != smp_processor_id() && !cpu_online(b->cpu)) { in wq_sync_buffer()
457 cancel_delayed_work(&b->work); in wq_sync_buffer()
460 sync_buffer(b->cpu); in wq_sync_buffer()
462 /* don't re-add the work if we're shutting down */ in wq_sync_buffer()
464 schedule_delayed_work(&b->work, DEFAULT_TIMER_EXPIRE); in wq_sync_buffer()