aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorRobert Richter <robert.richter@amd.com>2012-04-02 14:19:08 -0400
committerIngo Molnar <mingo@kernel.org>2012-05-09 09:23:12 -0400
commitfd0d000b2c34aa43d4e92dcf0dfaeda7e123008a (patch)
tree8b81831cf37f1be6dd3cc9be772952d5c835a550 /include
parentc75841a398d667d9968245b9519d93cedbfb4780 (diff)
perf: Pass last sampling period to perf_sample_data_init()
We always need to pass the last sample period to perf_sample_data_init(), otherwise the event distribution will be wrong. Thus, modifiyng the function interface with the required period as argument. So basically a pattern like this: perf_sample_data_init(&data, ~0ULL); data.period = event->hw.last_period; will now be like that: perf_sample_data_init(&data, ~0ULL, event->hw.last_period); Avoids unininitialized data.period and simplifies code. Signed-off-by: Robert Richter <robert.richter@amd.com> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1333390758-10893-3-git-send-email-robert.richter@amd.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/perf_event.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index ddbb6a901f65..f32578634d9d 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -1132,11 +1132,14 @@ struct perf_sample_data {
1132 struct perf_branch_stack *br_stack; 1132 struct perf_branch_stack *br_stack;
1133}; 1133};
1134 1134
1135static inline void perf_sample_data_init(struct perf_sample_data *data, u64 addr) 1135static inline void perf_sample_data_init(struct perf_sample_data *data,
1136 u64 addr, u64 period)
1136{ 1137{
1138 /* remaining struct members initialized in perf_prepare_sample() */
1137 data->addr = addr; 1139 data->addr = addr;
1138 data->raw = NULL; 1140 data->raw = NULL;
1139 data->br_stack = NULL; 1141 data->br_stack = NULL;
1142 data->period = period;
1140} 1143}
1141 1144
1142extern void perf_output_sample(struct perf_output_handle *handle, 1145extern void perf_output_sample(struct perf_output_handle *handle,