diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2009-08-07 22:26:37 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-08-09 06:54:45 -0400 |
commit | 3a43ce68ae1758fa6a839386025ef45acb6baa22 (patch) | |
tree | 5431e80f427ac6312dc123ecfdb101ea71b3d364 | |
parent | 10b8e3066066708f304e0fc5cfe658e05abf943d (diff) |
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: Frederic 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: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | include/linux/perf_counter.h | 10 | ||||
-rw-r--r-- | kernel/perf_counter.c | 20 |
2 files changed, 15 insertions, 15 deletions
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h index a67dd5c5b6d3..2aabe43c1d04 100644 --- a/include/linux/perf_counter.h +++ b/include/linux/perf_counter.h | |||
@@ -121,7 +121,7 @@ enum perf_counter_sample_format { | |||
121 | PERF_SAMPLE_CPU = 1U << 7, | 121 | PERF_SAMPLE_CPU = 1U << 7, |
122 | PERF_SAMPLE_PERIOD = 1U << 8, | 122 | PERF_SAMPLE_PERIOD = 1U << 8, |
123 | PERF_SAMPLE_STREAM_ID = 1U << 9, | 123 | PERF_SAMPLE_STREAM_ID = 1U << 9, |
124 | PERF_SAMPLE_TP_RECORD = 1U << 10, | 124 | PERF_SAMPLE_RAW = 1U << 10, |
125 | 125 | ||
126 | PERF_SAMPLE_MAX = 1U << 11, /* non-ABI */ | 126 | PERF_SAMPLE_MAX = 1U << 11, /* non-ABI */ |
127 | }; | 127 | }; |
@@ -414,9 +414,9 @@ struct perf_callchain_entry { | |||
414 | __u64 ip[PERF_MAX_STACK_DEPTH]; | 414 | __u64 ip[PERF_MAX_STACK_DEPTH]; |
415 | }; | 415 | }; |
416 | 416 | ||
417 | struct perf_tracepoint_record { | 417 | struct perf_raw_record { |
418 | int size; | 418 | u32 size; |
419 | char *record; | 419 | void *data; |
420 | }; | 420 | }; |
421 | 421 | ||
422 | struct task_struct; | 422 | struct task_struct; |
@@ -687,7 +687,7 @@ struct perf_sample_data { | |||
687 | struct pt_regs *regs; | 687 | struct pt_regs *regs; |
688 | u64 addr; | 688 | u64 addr; |
689 | u64 period; | 689 | u64 period; |
690 | void *private; | 690 | struct perf_raw_record *raw; |
691 | }; | 691 | }; |
692 | 692 | ||
693 | extern int perf_counter_overflow(struct perf_counter *counter, int nmi, | 693 | extern int perf_counter_overflow(struct perf_counter *counter, int nmi, |
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c index 117622cb73a3..002310540417 100644 --- a/kernel/perf_counter.c +++ b/kernel/perf_counter.c | |||
@@ -2646,7 +2646,7 @@ static void perf_counter_output(struct perf_counter *counter, int nmi, | |||
2646 | u64 counter; | 2646 | u64 counter; |
2647 | } group_entry; | 2647 | } group_entry; |
2648 | struct perf_callchain_entry *callchain = NULL; | 2648 | struct perf_callchain_entry *callchain = NULL; |
2649 | struct perf_tracepoint_record *tp = NULL; | 2649 | struct perf_raw_record *raw = NULL; |
2650 | int callchain_size = 0; | 2650 | int callchain_size = 0; |
2651 | u64 time; | 2651 | u64 time; |
2652 | struct { | 2652 | struct { |
@@ -2715,10 +2715,10 @@ static void perf_counter_output(struct perf_counter *counter, int nmi, | |||
2715 | header.size += sizeof(u64); | 2715 | header.size += sizeof(u64); |
2716 | } | 2716 | } |
2717 | 2717 | ||
2718 | if (sample_type & PERF_SAMPLE_TP_RECORD) { | 2718 | if (sample_type & PERF_SAMPLE_RAW) { |
2719 | tp = data->private; | 2719 | raw = data->raw; |
2720 | if (tp) | 2720 | if (raw) |
2721 | header.size += tp->size; | 2721 | header.size += raw->size; |
2722 | } | 2722 | } |
2723 | 2723 | ||
2724 | ret = perf_output_begin(&handle, counter, header.size, nmi, 1); | 2724 | 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 | } | 2784 | } |
2785 | } | 2785 | } |
2786 | 2786 | ||
2787 | if ((sample_type & PERF_SAMPLE_TP_RECORD) && tp) | 2787 | if ((sample_type & PERF_SAMPLE_RAW) && raw) |
2788 | perf_output_copy(&handle, tp->record, tp->size); | 2788 | perf_output_copy(&handle, raw->data, raw->size); |
2789 | 2789 | ||
2790 | perf_output_end(&handle); | 2790 | perf_output_end(&handle); |
2791 | } | 2791 | } |
@@ -3740,15 +3740,15 @@ static const struct pmu perf_ops_task_clock = { | |||
3740 | void perf_tpcounter_event(int event_id, u64 addr, u64 count, void *record, | 3740 | void perf_tpcounter_event(int event_id, u64 addr, u64 count, void *record, |
3741 | int entry_size) | 3741 | int entry_size) |
3742 | { | 3742 | { |
3743 | struct perf_tracepoint_record tp = { | 3743 | struct perf_raw_record raw = { |
3744 | .size = entry_size, | 3744 | .size = entry_size, |
3745 | .record = record, | 3745 | .data = record, |
3746 | }; | 3746 | }; |
3747 | 3747 | ||
3748 | struct perf_sample_data data = { | 3748 | struct perf_sample_data data = { |
3749 | .regs = get_irq_regs(), | 3749 | .regs = get_irq_regs(), |
3750 | .addr = addr, | 3750 | .addr = addr, |
3751 | .private = &tp, | 3751 | .raw = &raw, |
3752 | }; | 3752 | }; |
3753 | 3753 | ||
3754 | if (!data.regs) | 3754 | if (!data.regs) |