diff options
-rw-r--r-- | include/linux/perf_counter.h | 2 | ||||
-rw-r--r-- | kernel/perf_counter.c | 10 |
2 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h index 9cea32a0655d..6bc250039738 100644 --- a/include/linux/perf_counter.h +++ b/include/linux/perf_counter.h | |||
@@ -106,6 +106,7 @@ enum perf_counter_sample_format { | |||
106 | PERF_SAMPLE_CALLCHAIN = 1U << 5, | 106 | PERF_SAMPLE_CALLCHAIN = 1U << 5, |
107 | PERF_SAMPLE_ID = 1U << 6, | 107 | PERF_SAMPLE_ID = 1U << 6, |
108 | PERF_SAMPLE_CPU = 1U << 7, | 108 | PERF_SAMPLE_CPU = 1U << 7, |
109 | PERF_SAMPLE_PERIOD = 1U << 8, | ||
109 | }; | 110 | }; |
110 | 111 | ||
111 | /* | 112 | /* |
@@ -260,6 +261,7 @@ enum perf_event_type { | |||
260 | * struct { | 261 | * struct { |
261 | * struct perf_event_header header; | 262 | * struct perf_event_header header; |
262 | * u64 time; | 263 | * u64 time; |
264 | * u64 id; | ||
263 | * u64 sample_period; | 265 | * u64 sample_period; |
264 | * }; | 266 | * }; |
265 | */ | 267 | */ |
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c index e75b91a76a58..f8390668c391 100644 --- a/kernel/perf_counter.c +++ b/kernel/perf_counter.c | |||
@@ -2404,6 +2404,11 @@ static void perf_counter_output(struct perf_counter *counter, | |||
2404 | cpu_entry.cpu = raw_smp_processor_id(); | 2404 | cpu_entry.cpu = raw_smp_processor_id(); |
2405 | } | 2405 | } |
2406 | 2406 | ||
2407 | if (sample_type & PERF_SAMPLE_PERIOD) { | ||
2408 | header.type |= PERF_SAMPLE_PERIOD; | ||
2409 | header.size += sizeof(u64); | ||
2410 | } | ||
2411 | |||
2407 | if (sample_type & PERF_SAMPLE_GROUP) { | 2412 | if (sample_type & PERF_SAMPLE_GROUP) { |
2408 | header.type |= PERF_SAMPLE_GROUP; | 2413 | header.type |= PERF_SAMPLE_GROUP; |
2409 | header.size += sizeof(u64) + | 2414 | header.size += sizeof(u64) + |
@@ -2445,6 +2450,9 @@ static void perf_counter_output(struct perf_counter *counter, | |||
2445 | if (sample_type & PERF_SAMPLE_CPU) | 2450 | if (sample_type & PERF_SAMPLE_CPU) |
2446 | perf_output_put(&handle, cpu_entry); | 2451 | perf_output_put(&handle, cpu_entry); |
2447 | 2452 | ||
2453 | if (sample_type & PERF_SAMPLE_PERIOD) | ||
2454 | perf_output_put(&handle, counter->hw.sample_period); | ||
2455 | |||
2448 | /* | 2456 | /* |
2449 | * XXX PERF_SAMPLE_GROUP vs inherited counters seems difficult. | 2457 | * XXX PERF_SAMPLE_GROUP vs inherited counters seems difficult. |
2450 | */ | 2458 | */ |
@@ -2835,6 +2843,7 @@ static void perf_log_period(struct perf_counter *counter, u64 period) | |||
2835 | struct { | 2843 | struct { |
2836 | struct perf_event_header header; | 2844 | struct perf_event_header header; |
2837 | u64 time; | 2845 | u64 time; |
2846 | u64 id; | ||
2838 | u64 period; | 2847 | u64 period; |
2839 | } freq_event = { | 2848 | } freq_event = { |
2840 | .header = { | 2849 | .header = { |
@@ -2843,6 +2852,7 @@ static void perf_log_period(struct perf_counter *counter, u64 period) | |||
2843 | .size = sizeof(freq_event), | 2852 | .size = sizeof(freq_event), |
2844 | }, | 2853 | }, |
2845 | .time = sched_clock(), | 2854 | .time = sched_clock(), |
2855 | .id = counter->id, | ||
2846 | .period = period, | 2856 | .period = period, |
2847 | }; | 2857 | }; |
2848 | 2858 | ||