]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - include/linux/perf_event.h
perf: Provide generic perf_sample_data initialization
[net-next-2.6.git] / include / linux / perf_event.h
index 7b18b4fd5df7b80686e8db84e2b912a9e1a05ae1..6f8cd7da1a012da2760e0e251f8d1792a99cfcd7 100644 (file)
@@ -487,9 +487,8 @@ struct hw_perf_event {
                        struct hrtimer  hrtimer;
                };
 #ifdef CONFIG_HAVE_HW_BREAKPOINT
-               union { /* breakpoint */
-                       struct arch_hw_breakpoint       info;
-               };
+               /* breakpoint */
+               struct arch_hw_breakpoint       info;
 #endif
        };
        atomic64_t                      prev_count;
@@ -802,6 +801,13 @@ struct perf_sample_data {
        struct perf_raw_record          *raw;
 };
 
+static inline
+void perf_sample_data_init(struct perf_sample_data *data, u64 addr)
+{
+       data->addr = addr;
+       data->raw  = NULL;
+}
+
 extern void perf_output_sample(struct perf_output_handle *handle,
                               struct perf_event_header *header,
                               struct perf_sample_data *data,
@@ -858,6 +864,21 @@ extern int sysctl_perf_event_paranoid;
 extern int sysctl_perf_event_mlock;
 extern int sysctl_perf_event_sample_rate;
 
+static inline bool perf_paranoid_tracepoint_raw(void)
+{
+       return sysctl_perf_event_paranoid > -1;
+}
+
+static inline bool perf_paranoid_cpu(void)
+{
+       return sysctl_perf_event_paranoid > 0;
+}
+
+static inline bool perf_paranoid_kernel(void)
+{
+       return sysctl_perf_event_paranoid > 1;
+}
+
 extern void perf_event_init(void);
 extern void perf_tp_event(int event_id, u64 addr, u64 count, void *record, int entry_size);
 extern void perf_bp_event(struct perf_event *event, void *data);