perf trace: Rename perf_evsel__*() operating on 'struct evsel *' to evsel__*()
As those is a 'struct evsel' methods, not part of tools/lib/perf/, aka libperf, to whom the perf_ prefix belongs. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
ec98b6df37
commit
794bca26e5
@ -366,9 +366,7 @@ out_delete:
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int perf_evsel__init_tp_uint_field(struct evsel *evsel,
|
static int evsel__init_tp_uint_field(struct evsel *evsel, struct tp_field *field, const char *name)
|
||||||
struct tp_field *field,
|
|
||||||
const char *name)
|
|
||||||
{
|
{
|
||||||
struct tep_format_field *format_field = evsel__field(evsel, name);
|
struct tep_format_field *format_field = evsel__field(evsel, name);
|
||||||
|
|
||||||
@ -380,11 +378,9 @@ static int perf_evsel__init_tp_uint_field(struct evsel *evsel,
|
|||||||
|
|
||||||
#define perf_evsel__init_sc_tp_uint_field(evsel, name) \
|
#define perf_evsel__init_sc_tp_uint_field(evsel, name) \
|
||||||
({ struct syscall_tp *sc = __evsel__syscall_tp(evsel);\
|
({ struct syscall_tp *sc = __evsel__syscall_tp(evsel);\
|
||||||
perf_evsel__init_tp_uint_field(evsel, &sc->name, #name); })
|
evsel__init_tp_uint_field(evsel, &sc->name, #name); })
|
||||||
|
|
||||||
static int perf_evsel__init_tp_ptr_field(struct evsel *evsel,
|
static int evsel__init_tp_ptr_field(struct evsel *evsel, struct tp_field *field, const char *name)
|
||||||
struct tp_field *field,
|
|
||||||
const char *name)
|
|
||||||
{
|
{
|
||||||
struct tep_format_field *format_field = evsel__field(evsel, name);
|
struct tep_format_field *format_field = evsel__field(evsel, name);
|
||||||
|
|
||||||
@ -396,7 +392,7 @@ static int perf_evsel__init_tp_ptr_field(struct evsel *evsel,
|
|||||||
|
|
||||||
#define perf_evsel__init_sc_tp_ptr_field(evsel, name) \
|
#define perf_evsel__init_sc_tp_ptr_field(evsel, name) \
|
||||||
({ struct syscall_tp *sc = __evsel__syscall_tp(evsel);\
|
({ struct syscall_tp *sc = __evsel__syscall_tp(evsel);\
|
||||||
perf_evsel__init_tp_ptr_field(evsel, &sc->name, #name); })
|
evsel__init_tp_ptr_field(evsel, &sc->name, #name); })
|
||||||
|
|
||||||
static void evsel__delete_priv(struct evsel *evsel)
|
static void evsel__delete_priv(struct evsel *evsel)
|
||||||
{
|
{
|
||||||
@ -404,13 +400,13 @@ static void evsel__delete_priv(struct evsel *evsel)
|
|||||||
evsel__delete(evsel);
|
evsel__delete(evsel);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int perf_evsel__init_syscall_tp(struct evsel *evsel)
|
static int evsel__init_syscall_tp(struct evsel *evsel)
|
||||||
{
|
{
|
||||||
struct syscall_tp *sc = evsel__syscall_tp(evsel);
|
struct syscall_tp *sc = evsel__syscall_tp(evsel);
|
||||||
|
|
||||||
if (sc != NULL) {
|
if (sc != NULL) {
|
||||||
if (perf_evsel__init_tp_uint_field(evsel, &sc->id, "__syscall_nr") &&
|
if (evsel__init_tp_uint_field(evsel, &sc->id, "__syscall_nr") &&
|
||||||
perf_evsel__init_tp_uint_field(evsel, &sc->id, "nr"))
|
evsel__init_tp_uint_field(evsel, &sc->id, "nr"))
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -418,7 +414,7 @@ static int perf_evsel__init_syscall_tp(struct evsel *evsel)
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int perf_evsel__init_augmented_syscall_tp(struct evsel *evsel, struct evsel *tp)
|
static int evsel__init_augmented_syscall_tp(struct evsel *evsel, struct evsel *tp)
|
||||||
{
|
{
|
||||||
struct syscall_tp *sc = evsel__syscall_tp(evsel);
|
struct syscall_tp *sc = evsel__syscall_tp(evsel);
|
||||||
|
|
||||||
@ -436,21 +432,21 @@ static int perf_evsel__init_augmented_syscall_tp(struct evsel *evsel, struct evs
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int perf_evsel__init_augmented_syscall_tp_args(struct evsel *evsel)
|
static int evsel__init_augmented_syscall_tp_args(struct evsel *evsel)
|
||||||
{
|
{
|
||||||
struct syscall_tp *sc = __evsel__syscall_tp(evsel);
|
struct syscall_tp *sc = __evsel__syscall_tp(evsel);
|
||||||
|
|
||||||
return __tp_field__init_ptr(&sc->args, sc->id.offset + sizeof(u64));
|
return __tp_field__init_ptr(&sc->args, sc->id.offset + sizeof(u64));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int perf_evsel__init_augmented_syscall_tp_ret(struct evsel *evsel)
|
static int evsel__init_augmented_syscall_tp_ret(struct evsel *evsel)
|
||||||
{
|
{
|
||||||
struct syscall_tp *sc = __evsel__syscall_tp(evsel);
|
struct syscall_tp *sc = __evsel__syscall_tp(evsel);
|
||||||
|
|
||||||
return __tp_field__init_uint(&sc->ret, sizeof(u64), sc->id.offset + sizeof(u64), evsel->needs_swap);
|
return __tp_field__init_uint(&sc->ret, sizeof(u64), sc->id.offset + sizeof(u64), evsel->needs_swap);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int perf_evsel__init_raw_syscall_tp(struct evsel *evsel, void *handler)
|
static int evsel__init_raw_syscall_tp(struct evsel *evsel, void *handler)
|
||||||
{
|
{
|
||||||
if (evsel__syscall_tp(evsel) != NULL) {
|
if (evsel__syscall_tp(evsel) != NULL) {
|
||||||
if (perf_evsel__init_sc_tp_uint_field(evsel, id))
|
if (perf_evsel__init_sc_tp_uint_field(evsel, id))
|
||||||
@ -474,7 +470,7 @@ static struct evsel *perf_evsel__raw_syscall_newtp(const char *direction, void *
|
|||||||
if (IS_ERR(evsel))
|
if (IS_ERR(evsel))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (perf_evsel__init_raw_syscall_tp(evsel, handler))
|
if (evsel__init_raw_syscall_tp(evsel, handler))
|
||||||
goto out_delete;
|
goto out_delete;
|
||||||
|
|
||||||
return evsel;
|
return evsel;
|
||||||
@ -1801,7 +1797,7 @@ static int trace__read_syscall_info(struct trace *trace, int id)
|
|||||||
return syscall__set_arg_fmts(sc);
|
return syscall__set_arg_fmts(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int perf_evsel__init_tp_arg_scnprintf(struct evsel *evsel)
|
static int evsel__init_tp_arg_scnprintf(struct evsel *evsel)
|
||||||
{
|
{
|
||||||
struct syscall_arg_fmt *fmt = evsel__syscall_arg_fmt(evsel);
|
struct syscall_arg_fmt *fmt = evsel__syscall_arg_fmt(evsel);
|
||||||
|
|
||||||
@ -3694,7 +3690,7 @@ static int ordered_events__deliver_event(struct ordered_events *oe,
|
|||||||
return __trace__deliver_event(trace, event->event);
|
return __trace__deliver_event(trace, event->event);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct syscall_arg_fmt *perf_evsel__syscall_arg_fmt(struct evsel *evsel, char *arg)
|
static struct syscall_arg_fmt *evsel__find_syscall_arg_fmt_by_name(struct evsel *evsel, char *arg)
|
||||||
{
|
{
|
||||||
struct tep_format_field *field;
|
struct tep_format_field *field;
|
||||||
struct syscall_arg_fmt *fmt = __evsel__syscall_arg_fmt(evsel);
|
struct syscall_arg_fmt *fmt = __evsel__syscall_arg_fmt(evsel);
|
||||||
@ -3749,7 +3745,7 @@ static int trace__expand_filter(struct trace *trace __maybe_unused, struct evsel
|
|||||||
|
|
||||||
scnprintf(arg, sizeof(arg), "%.*s", left_size, left);
|
scnprintf(arg, sizeof(arg), "%.*s", left_size, left);
|
||||||
|
|
||||||
fmt = perf_evsel__syscall_arg_fmt(evsel, arg);
|
fmt = evsel__find_syscall_arg_fmt_by_name(evsel, arg);
|
||||||
if (fmt == NULL) {
|
if (fmt == NULL) {
|
||||||
pr_err("\"%s\" not found in \"%s\", can't set filter \"%s\"\n",
|
pr_err("\"%s\" not found in \"%s\", can't set filter \"%s\"\n",
|
||||||
arg, evsel->name, evsel->filter);
|
arg, evsel->name, evsel->filter);
|
||||||
@ -4178,7 +4174,7 @@ static int trace__replay(struct trace *trace)
|
|||||||
"syscalls:sys_enter");
|
"syscalls:sys_enter");
|
||||||
|
|
||||||
if (evsel &&
|
if (evsel &&
|
||||||
(perf_evsel__init_raw_syscall_tp(evsel, trace__sys_enter) < 0 ||
|
(evsel__init_raw_syscall_tp(evsel, trace__sys_enter) < 0 ||
|
||||||
perf_evsel__init_sc_tp_ptr_field(evsel, args))) {
|
perf_evsel__init_sc_tp_ptr_field(evsel, args))) {
|
||||||
pr_err("Error during initialize raw_syscalls:sys_enter event\n");
|
pr_err("Error during initialize raw_syscalls:sys_enter event\n");
|
||||||
goto out;
|
goto out;
|
||||||
@ -4190,7 +4186,7 @@ static int trace__replay(struct trace *trace)
|
|||||||
evsel = perf_evlist__find_tracepoint_by_name(session->evlist,
|
evsel = perf_evlist__find_tracepoint_by_name(session->evlist,
|
||||||
"syscalls:sys_exit");
|
"syscalls:sys_exit");
|
||||||
if (evsel &&
|
if (evsel &&
|
||||||
(perf_evsel__init_raw_syscall_tp(evsel, trace__sys_exit) < 0 ||
|
(evsel__init_raw_syscall_tp(evsel, trace__sys_exit) < 0 ||
|
||||||
perf_evsel__init_sc_tp_uint_field(evsel, ret))) {
|
perf_evsel__init_sc_tp_uint_field(evsel, ret))) {
|
||||||
pr_err("Error during initialize raw_syscalls:sys_exit event\n");
|
pr_err("Error during initialize raw_syscalls:sys_exit event\n");
|
||||||
goto out;
|
goto out;
|
||||||
@ -4470,11 +4466,11 @@ static int evlist__set_syscall_tp_fields(struct evlist *evlist)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (strcmp(evsel->tp_format->system, "syscalls")) {
|
if (strcmp(evsel->tp_format->system, "syscalls")) {
|
||||||
perf_evsel__init_tp_arg_scnprintf(evsel);
|
evsel__init_tp_arg_scnprintf(evsel);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (perf_evsel__init_syscall_tp(evsel))
|
if (evsel__init_syscall_tp(evsel))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!strncmp(evsel->tp_format->name, "sys_enter_", 10)) {
|
if (!strncmp(evsel->tp_format->name, "sys_enter_", 10)) {
|
||||||
@ -4998,8 +4994,8 @@ int cmd_trace(int argc, const char **argv)
|
|||||||
if (trace.syscalls.events.augmented->priv == NULL &&
|
if (trace.syscalls.events.augmented->priv == NULL &&
|
||||||
strstr(evsel__name(evsel), "syscalls:sys_enter")) {
|
strstr(evsel__name(evsel), "syscalls:sys_enter")) {
|
||||||
struct evsel *augmented = trace.syscalls.events.augmented;
|
struct evsel *augmented = trace.syscalls.events.augmented;
|
||||||
if (perf_evsel__init_augmented_syscall_tp(augmented, evsel) ||
|
if (evsel__init_augmented_syscall_tp(augmented, evsel) ||
|
||||||
perf_evsel__init_augmented_syscall_tp_args(augmented))
|
evsel__init_augmented_syscall_tp_args(augmented))
|
||||||
goto out;
|
goto out;
|
||||||
/*
|
/*
|
||||||
* Augmented is __augmented_syscalls__ BPF_OUTPUT event
|
* Augmented is __augmented_syscalls__ BPF_OUTPUT event
|
||||||
@ -5013,8 +5009,8 @@ int cmd_trace(int argc, const char **argv)
|
|||||||
* as not to filter it, then we'll handle it just like we would
|
* as not to filter it, then we'll handle it just like we would
|
||||||
* for the BPF_OUTPUT one:
|
* for the BPF_OUTPUT one:
|
||||||
*/
|
*/
|
||||||
if (perf_evsel__init_augmented_syscall_tp(evsel, evsel) ||
|
if (evsel__init_augmented_syscall_tp(evsel, evsel) ||
|
||||||
perf_evsel__init_augmented_syscall_tp_args(evsel))
|
evsel__init_augmented_syscall_tp_args(evsel))
|
||||||
goto out;
|
goto out;
|
||||||
evsel->handler = trace__sys_enter;
|
evsel->handler = trace__sys_enter;
|
||||||
}
|
}
|
||||||
@ -5022,7 +5018,7 @@ int cmd_trace(int argc, const char **argv)
|
|||||||
if (strstarts(evsel__name(evsel), "syscalls:sys_exit_")) {
|
if (strstarts(evsel__name(evsel), "syscalls:sys_exit_")) {
|
||||||
struct syscall_tp *sc;
|
struct syscall_tp *sc;
|
||||||
init_augmented_syscall_tp:
|
init_augmented_syscall_tp:
|
||||||
if (perf_evsel__init_augmented_syscall_tp(evsel, evsel))
|
if (evsel__init_augmented_syscall_tp(evsel, evsel))
|
||||||
goto out;
|
goto out;
|
||||||
sc = __evsel__syscall_tp(evsel);
|
sc = __evsel__syscall_tp(evsel);
|
||||||
/*
|
/*
|
||||||
@ -5046,7 +5042,7 @@ init_augmented_syscall_tp:
|
|||||||
*/
|
*/
|
||||||
if (trace.raw_augmented_syscalls)
|
if (trace.raw_augmented_syscalls)
|
||||||
trace.raw_augmented_syscalls_args_size = (6 + 1) * sizeof(long) + sc->id.offset;
|
trace.raw_augmented_syscalls_args_size = (6 + 1) * sizeof(long) + sc->id.offset;
|
||||||
perf_evsel__init_augmented_syscall_tp_ret(evsel);
|
evsel__init_augmented_syscall_tp_ret(evsel);
|
||||||
evsel->handler = trace__sys_exit;
|
evsel->handler = trace__sys_exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user