/* is_kernel is needed because on some architectures you cannot tell if you are in kernel or user space simply by looking at pc. We tag this in the buffer by generating kernel enter/exit events whenever is_kernel changes  */
static int log_sample(struct oprofile_cpu_buffer *cpu_buf, unsigned long pc, unsigned long backtrace, int is_kernel, unsigned long event)
/* is_kernel is needed because on some architectures you cannot tell if you are in kernel or user space simply by looking at pc. We tag this in the buffer by generating kernel enter/exit events whenever is_kernel changes  */
static int log_sample(struct oprofile_cpu_buffer *cpu_buf, unsigned long pc, unsigned long backtrace, int is_kernel, unsigned long event)
{
	cpu_buf->sample_received++;
	if (pc == ESCAPE_CODE) {
		cpu_buf->sample_invalid_eip++;
		return 0;
	}
	if (op_add_code(cpu_buf, backtrace, is_kernel, current))
		goto fail;
	if (op_add_sample(cpu_buf, pc, event))
		goto fail;
	return 1;
fail:
	cpu_buf->sample_lost_overflow++;
	return 0;
}