diff options
Diffstat (limited to 'runtime/transport/ring_buffer.c')
-rw-r--r-- | runtime/transport/ring_buffer.c | 51 |
1 files changed, 9 insertions, 42 deletions
diff --git a/runtime/transport/ring_buffer.c b/runtime/transport/ring_buffer.c index abe9c360..99ce2031 100644 --- a/runtime/transport/ring_buffer.c +++ b/runtime/transport/ring_buffer.c @@ -5,41 +5,20 @@ #include <linux/cpumask.h> static struct ring_buffer *__stp_ring_buffer = NULL; -//DEFINE_PER_CPU(struct oprofile_cpu_buffer, cpu_buffer); /* _stp_poll_wait is a waitqueue for tasks blocked on * _stp_data_poll_trace() */ static DECLARE_WAIT_QUEUE_HEAD(_stp_poll_wait); -#if 1 /* * Trace iterator - used by printout routines who present trace * results to users and which routines might sleep, etc: */ -struct _stp_ring_buffer_iterator { -#if 0 - struct trace_array *tr; - struct tracer *trace; - void *private; - struct ring_buffer_iter *buffer_iter[NR_CPUS]; - - /* The below is zeroed out in pipe_read */ - struct trace_seq seq; - struct trace_entry *ent; -#endif +struct _stp_ring_buffer_data { int cpu; u64 ts; - -#if 0 - unsigned long iter_flags; - loff_t pos; - long idx; - - cpumask_var_t started; -#endif }; -static struct _stp_ring_buffer_iterator _stp_iter; -#endif +static struct _stp_ring_buffer_data _stp_rb_data; static cpumask_var_t _stp_trace_reader_cpumask; @@ -159,13 +138,10 @@ static ssize_t tracing_wait_pipe(struct file *filp) * Anyway, this is really very primitive wakeup. */ set_current_state(TASK_INTERRUPTIBLE); - //iter->tr->waiter = current; /* sleep for 100 msecs, and try again. */ schedule_timeout(HZ/10); - //iter->tr->waiter = NULL; - if (signal_pending(current)) { dbug_trans(1, "returning -EINTR\n"); return -EINTR; @@ -186,8 +162,9 @@ peek_next_entry(int cpu, u64 *ts) return event ? ring_buffer_event_data(event) : NULL; } +/* Find the next real entry */ static struct _stp_entry * -__stp_find_next_entry(long cpu_file, int *ent_cpu, u64 *ent_ts) +_stp_find_next_entry(long cpu_file) { struct _stp_entry *ent; @@ -199,8 +176,7 @@ __stp_find_next_entry(long cpu_file, int *ent_cpu, u64 *ent_ts) if (ring_buffer_empty_cpu(__stp_ring_buffer, (int)cpu_file)) return NULL; ent = peek_next_entry(cpu_file, ent_ts); - if (ent_cpu) - *ent_cpu = cpu_file; + _stp_rb_data.cpu = cpu_file; return ent; #else @@ -226,22 +202,13 @@ __stp_find_next_entry(long cpu_file, int *ent_cpu, u64 *ent_ts) } } - if (ent_cpu) - *ent_cpu = next_cpu; - - if (ent_ts) - *ent_ts = next_ts; + _stp_rb_data.cpu = next_cpu; + _stp_rb_data.ts = next_ts; return next; #endif } -/* Find the next real entry, and increment the iterator to the next entry */ -static struct _stp_entry *_stp_find_next_entry(long cpu_file) -{ - return __stp_find_next_entry(cpu_file, &_stp_iter.cpu, &_stp_iter.ts); -} - /* * Consumer reader. @@ -279,8 +246,8 @@ _stp_data_read_trace(struct file *filp, char __user *ubuf, if (len <= 0) break; - ring_buffer_consume(__stp_ring_buffer, _stp_iter.cpu, - &_stp_iter.ts); + ring_buffer_consume(__stp_ring_buffer, _stp_rb_data.cpu, + &_stp_rb_data.ts); ubuf += len; cnt -= len; sret += len; |