1 /* SPDX-License-Identifier: GPL-2.0 */
3 * dlfilter.h: Interface to perf script --dlfilter shared object
4 * Copyright (c) 2021, Intel Corporation.
7 #ifndef PERF_UTIL_DLFILTER_H
8 #define PERF_UTIL_DLFILTER_H
16 struct perf_dlfilter_fns
;
17 struct perf_dlfilter_sample
;
18 struct perf_dlfilter_al
;
24 struct perf_session
*session
;
31 union perf_event
*event
;
32 struct perf_sample
*sample
;
34 struct machine
*machine
;
35 struct addr_location
*al
;
36 struct addr_location
*addr_al
;
37 struct perf_dlfilter_sample
*d_sample
;
38 struct perf_dlfilter_al
*d_ip_al
;
39 struct perf_dlfilter_al
*d_addr_al
;
41 int (*start
)(void **data
, void *ctx
);
42 int (*stop
)(void *data
, void *ctx
);
44 int (*filter_event
)(void *data
,
45 const struct perf_dlfilter_sample
*sample
,
47 int (*filter_event_early
)(void *data
,
48 const struct perf_dlfilter_sample
*sample
,
51 struct perf_dlfilter_fns
*fns
;
54 struct dlfilter
*dlfilter__new(const char *file
, int dlargc
, char **dlargv
);
56 int dlfilter__start(struct dlfilter
*d
, struct perf_session
*session
);
58 int dlfilter__do_filter_event(struct dlfilter
*d
,
59 union perf_event
*event
,
60 struct perf_sample
*sample
,
62 struct machine
*machine
,
63 struct addr_location
*al
,
64 struct addr_location
*addr_al
,
67 void dlfilter__cleanup(struct dlfilter
*d
);
69 static inline int dlfilter__filter_event(struct dlfilter
*d
,
70 union perf_event
*event
,
71 struct perf_sample
*sample
,
73 struct machine
*machine
,
74 struct addr_location
*al
,
75 struct addr_location
*addr_al
)
77 if (!d
|| !d
->filter_event
)
79 return dlfilter__do_filter_event(d
, event
, sample
, evsel
, machine
, al
, addr_al
, false);
82 static inline int dlfilter__filter_event_early(struct dlfilter
*d
,
83 union perf_event
*event
,
84 struct perf_sample
*sample
,
86 struct machine
*machine
,
87 struct addr_location
*al
,
88 struct addr_location
*addr_al
)
90 if (!d
|| !d
->filter_event_early
)
92 return dlfilter__do_filter_event(d
, event
, sample
, evsel
, machine
, al
, addr_al
, true);
95 int list_available_dlfilters(const struct option
*opt
, const char *s
, int unset
);
96 bool get_filter_desc(const char *dirname
, const char *name
, char **desc
,