aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/perf_counter.c
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2009-06-05 15:05:43 +0200
committerIngo Molnar <mingo@elte.hu>2009-06-05 18:07:47 +0200
commit689802b2d0536e72281dc959ab9cb34fb3c304cf (patch)
tree9be866e918391e86eaecd8a05124f86693504d3f /kernel/perf_counter.c
parentac4bcf889469ffbca88f234d3184452886a47905 (diff)
downloadkernel_samsung_tuna-689802b2d0536e72281dc959ab9cb34fb3c304cf.zip
kernel_samsung_tuna-689802b2d0536e72281dc959ab9cb34fb3c304cf.tar.gz
kernel_samsung_tuna-689802b2d0536e72281dc959ab9cb34fb3c304cf.tar.bz2
perf_counter: Add PERF_SAMPLE_PERIOD
In order to allow easy tracking of the period, also provide means of adding it to the sample data. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/perf_counter.c')
-rw-r--r--kernel/perf_counter.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index e75b91a..f839066 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -2404,6 +2404,11 @@ static void perf_counter_output(struct perf_counter *counter,
cpu_entry.cpu = raw_smp_processor_id();
}
+ if (sample_type & PERF_SAMPLE_PERIOD) {
+ header.type |= PERF_SAMPLE_PERIOD;
+ header.size += sizeof(u64);
+ }
+
if (sample_type & PERF_SAMPLE_GROUP) {
header.type |= PERF_SAMPLE_GROUP;
header.size += sizeof(u64) +
@@ -2445,6 +2450,9 @@ static void perf_counter_output(struct perf_counter *counter,
if (sample_type & PERF_SAMPLE_CPU)
perf_output_put(&handle, cpu_entry);
+ if (sample_type & PERF_SAMPLE_PERIOD)
+ perf_output_put(&handle, counter->hw.sample_period);
+
/*
* XXX PERF_SAMPLE_GROUP vs inherited counters seems difficult.
*/
@@ -2835,6 +2843,7 @@ static void perf_log_period(struct perf_counter *counter, u64 period)
struct {
struct perf_event_header header;
u64 time;
+ u64 id;
u64 period;
} freq_event = {
.header = {
@@ -2843,6 +2852,7 @@ static void perf_log_period(struct perf_counter *counter, u64 period)
.size = sizeof(freq_event),
},
.time = sched_clock(),
+ .id = counter->id,
.period = period,
};