Commit 3a43ce68 authored by Frederic Weisbecker's avatar Frederic Weisbecker Committed by Ingo Molnar

perf_counter: Fix tracepoint sampling to be part of generic sampling

Based on Peter's comments, make tracepoint sampling generic
just like all the other sampling bits are. This is a rename
with no code changes:

- PERF_SAMPLE_TP_RECORD to PERF_SAMPLE_RAW
- struct perf_tracepoint_record to perf_raw_record

We want the system in place that transport tracepoints raw
samples events into the perf ring buffer to be generalized and
usable by any type of counter.

Reported-by; Peter Zijlstra <peterz@infradead.org>
Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1249698400-5441-4-git-send-email-fweisbec@gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 10b8e306
...@@ -121,7 +121,7 @@ enum perf_counter_sample_format { ...@@ -121,7 +121,7 @@ enum perf_counter_sample_format {
PERF_SAMPLE_CPU = 1U << 7, PERF_SAMPLE_CPU = 1U << 7,
PERF_SAMPLE_PERIOD = 1U << 8, PERF_SAMPLE_PERIOD = 1U << 8,
PERF_SAMPLE_STREAM_ID = 1U << 9, PERF_SAMPLE_STREAM_ID = 1U << 9,
PERF_SAMPLE_TP_RECORD = 1U << 10, PERF_SAMPLE_RAW = 1U << 10,
PERF_SAMPLE_MAX = 1U << 11, /* non-ABI */ PERF_SAMPLE_MAX = 1U << 11, /* non-ABI */
}; };
...@@ -414,9 +414,9 @@ struct perf_callchain_entry { ...@@ -414,9 +414,9 @@ struct perf_callchain_entry {
__u64 ip[PERF_MAX_STACK_DEPTH]; __u64 ip[PERF_MAX_STACK_DEPTH];
}; };
struct perf_tracepoint_record { struct perf_raw_record {
int size; u32 size;
char *record; void *data;
}; };
struct task_struct; struct task_struct;
...@@ -687,7 +687,7 @@ struct perf_sample_data { ...@@ -687,7 +687,7 @@ struct perf_sample_data {
struct pt_regs *regs; struct pt_regs *regs;
u64 addr; u64 addr;
u64 period; u64 period;
void *private; struct perf_raw_record *raw;
}; };
extern int perf_counter_overflow(struct perf_counter *counter, int nmi, extern int perf_counter_overflow(struct perf_counter *counter, int nmi,
......
...@@ -2646,7 +2646,7 @@ static void perf_counter_output(struct perf_counter *counter, int nmi, ...@@ -2646,7 +2646,7 @@ static void perf_counter_output(struct perf_counter *counter, int nmi,
u64 counter; u64 counter;
} group_entry; } group_entry;
struct perf_callchain_entry *callchain = NULL; struct perf_callchain_entry *callchain = NULL;
struct perf_tracepoint_record *tp = NULL; struct perf_raw_record *raw = NULL;
int callchain_size = 0; int callchain_size = 0;
u64 time; u64 time;
struct { struct {
...@@ -2715,10 +2715,10 @@ static void perf_counter_output(struct perf_counter *counter, int nmi, ...@@ -2715,10 +2715,10 @@ static void perf_counter_output(struct perf_counter *counter, int nmi,
header.size += sizeof(u64); header.size += sizeof(u64);
} }
if (sample_type & PERF_SAMPLE_TP_RECORD) { if (sample_type & PERF_SAMPLE_RAW) {
tp = data->private; raw = data->raw;
if (tp) if (raw)
header.size += tp->size; header.size += raw->size;
} }
ret = perf_output_begin(&handle, counter, header.size, nmi, 1); ret = perf_output_begin(&handle, counter, header.size, nmi, 1);
...@@ -2784,8 +2784,8 @@ static void perf_counter_output(struct perf_counter *counter, int nmi, ...@@ -2784,8 +2784,8 @@ static void perf_counter_output(struct perf_counter *counter, int nmi,
} }
} }
if ((sample_type & PERF_SAMPLE_TP_RECORD) && tp) if ((sample_type & PERF_SAMPLE_RAW) && raw)
perf_output_copy(&handle, tp->record, tp->size); perf_output_copy(&handle, raw->data, raw->size);
perf_output_end(&handle); perf_output_end(&handle);
} }
...@@ -3740,15 +3740,15 @@ static const struct pmu perf_ops_task_clock = { ...@@ -3740,15 +3740,15 @@ static const struct pmu perf_ops_task_clock = {
void perf_tpcounter_event(int event_id, u64 addr, u64 count, void *record, void perf_tpcounter_event(int event_id, u64 addr, u64 count, void *record,
int entry_size) int entry_size)
{ {
struct perf_tracepoint_record tp = { struct perf_raw_record raw = {
.size = entry_size, .size = entry_size,
.record = record, .data = record,
}; };
struct perf_sample_data data = { struct perf_sample_data data = {
.regs = get_irq_regs(), .regs = get_irq_regs(),
.addr = addr, .addr = addr,
.private = &tp, .raw = &raw,
}; };
if (!data.regs) if (!data.regs)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment