Lines Matching refs:evsel

128 			struct evsel *sys_enter,
316 static inline struct syscall_tp *__evsel__syscall_tp(struct evsel *evsel) in __evsel__syscall_tp() argument
318 struct evsel_trace *et = evsel->priv; in __evsel__syscall_tp()
323 static struct syscall_tp *evsel__syscall_tp(struct evsel *evsel) in evsel__syscall_tp() argument
325 if (evsel->priv == NULL) { in evsel__syscall_tp()
326 evsel->priv = evsel_trace__new(); in evsel__syscall_tp()
327 if (evsel->priv == NULL) in evsel__syscall_tp()
331 return __evsel__syscall_tp(evsel); in evsel__syscall_tp()
337 static inline struct syscall_arg_fmt *__evsel__syscall_arg_fmt(struct evsel *evsel) in __evsel__syscall_arg_fmt() argument
339 struct evsel_trace *et = evsel->priv; in __evsel__syscall_arg_fmt()
344 static struct syscall_arg_fmt *evsel__syscall_arg_fmt(struct evsel *evsel) in evsel__syscall_arg_fmt() argument
346 struct evsel_trace *et = evsel->priv; in evsel__syscall_arg_fmt()
348 if (evsel->priv == NULL) { in evsel__syscall_arg_fmt()
349 et = evsel->priv = evsel_trace__new(); in evsel__syscall_arg_fmt()
356 et->fmt = calloc(evsel->tp_format->format.nr_fields, sizeof(struct syscall_arg_fmt)); in evsel__syscall_arg_fmt()
361 return __evsel__syscall_arg_fmt(evsel); in evsel__syscall_arg_fmt()
364 evsel_trace__delete(evsel->priv); in evsel__syscall_arg_fmt()
365 evsel->priv = NULL; in evsel__syscall_arg_fmt()
369 static int evsel__init_tp_uint_field(struct evsel *evsel, struct tp_field *field, const char *name) in evsel__init_tp_uint_field() argument
371 struct tep_format_field *format_field = evsel__field(evsel, name); in evsel__init_tp_uint_field()
376 return tp_field__init_uint(field, format_field, evsel->needs_swap); in evsel__init_tp_uint_field()
379 #define perf_evsel__init_sc_tp_uint_field(evsel, name) \ argument
380 ({ struct syscall_tp *sc = __evsel__syscall_tp(evsel);\
381 evsel__init_tp_uint_field(evsel, &sc->name, #name); })
383 static int evsel__init_tp_ptr_field(struct evsel *evsel, struct tp_field *field, const char *name) in evsel__init_tp_ptr_field() argument
385 struct tep_format_field *format_field = evsel__field(evsel, name); in evsel__init_tp_ptr_field()
393 #define perf_evsel__init_sc_tp_ptr_field(evsel, name) \ argument
394 ({ struct syscall_tp *sc = __evsel__syscall_tp(evsel);\
395 evsel__init_tp_ptr_field(evsel, &sc->name, #name); })
397 static void evsel__delete_priv(struct evsel *evsel) in evsel__delete_priv() argument
399 zfree(&evsel->priv); in evsel__delete_priv()
400 evsel__delete(evsel); in evsel__delete_priv()
403 static int evsel__init_syscall_tp(struct evsel *evsel) in evsel__init_syscall_tp() argument
405 struct syscall_tp *sc = evsel__syscall_tp(evsel); in evsel__init_syscall_tp()
408 if (evsel__init_tp_uint_field(evsel, &sc->id, "__syscall_nr") && in evsel__init_syscall_tp()
409 evsel__init_tp_uint_field(evsel, &sc->id, "nr")) in evsel__init_syscall_tp()
417 static int evsel__init_augmented_syscall_tp(struct evsel *evsel, struct evsel *tp) in evsel__init_augmented_syscall_tp() argument
419 struct syscall_tp *sc = evsel__syscall_tp(evsel); in evsel__init_augmented_syscall_tp()
426 __tp_field__init_uint(&sc->id, syscall_id->size, syscall_id->offset, evsel->needs_swap)) in evsel__init_augmented_syscall_tp()
435 static int evsel__init_augmented_syscall_tp_args(struct evsel *evsel) in evsel__init_augmented_syscall_tp_args() argument
437 struct syscall_tp *sc = __evsel__syscall_tp(evsel); in evsel__init_augmented_syscall_tp_args()
442 static int evsel__init_augmented_syscall_tp_ret(struct evsel *evsel) in evsel__init_augmented_syscall_tp_ret() argument
444 struct syscall_tp *sc = __evsel__syscall_tp(evsel); in evsel__init_augmented_syscall_tp_ret()
446 …return __tp_field__init_uint(&sc->ret, sizeof(u64), sc->id.offset + sizeof(u64), evsel->needs_swap… in evsel__init_augmented_syscall_tp_ret()
449 static int evsel__init_raw_syscall_tp(struct evsel *evsel, void *handler) in evsel__init_raw_syscall_tp() argument
451 if (evsel__syscall_tp(evsel) != NULL) { in evsel__init_raw_syscall_tp()
452 if (perf_evsel__init_sc_tp_uint_field(evsel, id)) in evsel__init_raw_syscall_tp()
455 evsel->handler = handler; in evsel__init_raw_syscall_tp()
462 static struct evsel *perf_evsel__raw_syscall_newtp(const char *direction, void *handler) in perf_evsel__raw_syscall_newtp()
464 struct evsel *evsel = evsel__newtp("raw_syscalls", direction); in perf_evsel__raw_syscall_newtp() local
467 if (IS_ERR(evsel)) in perf_evsel__raw_syscall_newtp()
468 evsel = evsel__newtp("syscalls", direction); in perf_evsel__raw_syscall_newtp()
470 if (IS_ERR(evsel)) in perf_evsel__raw_syscall_newtp()
473 if (evsel__init_raw_syscall_tp(evsel, handler)) in perf_evsel__raw_syscall_newtp()
476 return evsel; in perf_evsel__raw_syscall_newtp()
479 evsel__delete_priv(evsel); in perf_evsel__raw_syscall_newtp()
483 #define perf_evsel__sc_tp_uint(evsel, name, sample) \ argument
484 ({ struct syscall_tp *fields = __evsel__syscall_tp(evsel); \
487 #define perf_evsel__sc_tp_ptr(evsel, name, sample) \ argument
488 ({ struct syscall_tp *fields = __evsel__syscall_tp(evsel); \
1826 static int evsel__init_tp_arg_scnprintf(struct evsel *evsel) in evsel__init_tp_arg_scnprintf() argument
1828 struct syscall_arg_fmt *fmt = evsel__syscall_arg_fmt(evsel); in evsel__init_tp_arg_scnprintf()
1831 syscall_arg_fmt__init_array(fmt, evsel->tp_format->format.fields); in evsel__init_tp_arg_scnprintf()
2075 typedef int (*tracepoint_handler)(struct trace *trace, struct evsel *evsel,
2080 struct evsel *evsel, int id) argument
2099 id, evsel__name(evsel), ++n);
2234 static int trace__fprintf_sample(struct trace *trace, struct evsel *evsel, argument
2243 evsel__name(evsel), ts,
2285 static int trace__sys_enter(struct trace *trace, struct evsel *evsel, argument
2293 int id = perf_evsel__sc_tp_uint(evsel, id, sample), err = -1;
2296 struct syscall *sc = trace__syscall_info(trace, evsel, id);
2307 trace__fprintf_sample(trace, evsel, sample, thread);
2309 args = perf_evsel__sc_tp_ptr(evsel, args, sample);
2329 if (evsel != trace->syscalls.events.sys_enter)
2364 static int trace__fprintf_sys_enter(struct trace *trace, struct evsel *evsel, argument
2369 int id = perf_evsel__sc_tp_uint(evsel, id, sample), err = -1;
2370 struct syscall *sc = trace__syscall_info(trace, evsel, id);
2387 args = perf_evsel__sc_tp_ptr(evsel, args, sample);
2397 static int trace__resolve_callchain(struct trace *trace, struct evsel *evsel, argument
2402 int max_stack = evsel->core.attr.sample_max_stack ?
2403 evsel->core.attr.sample_max_stack :
2410 err = thread__resolve_callchain(al.thread, cursor, evsel, sample, NULL, NULL, max_stack);
2425 static const char *errno_to_name(struct evsel *evsel, int err) argument
2427 struct perf_env *env = evsel__env(evsel);
2433 static int trace__sys_exit(struct trace *trace, struct evsel *evsel, argument
2441 int id = perf_evsel__sc_tp_uint(evsel, id, sample), err = -1, callchain_ret = 0, printed = 0;
2443 struct syscall *sc = trace__syscall_info(trace, evsel, id);
2454 trace__fprintf_sample(trace, evsel, sample, thread);
2456 ret = perf_evsel__sc_tp_uint(evsel, ret, sample);
2476 callchain_ret = trace__resolve_callchain(trace, evsel, sample, &callchain_cursor);
2516 *e = errno_to_name(evsel, -ret);
2558 pr_err("Problem processing %s callchain, skipping...\n", evsel__name(evsel));
2567 static int trace__vfs_getname(struct trace *trace, struct evsel *evsel, argument
2576 const char *filename = evsel__rawptr(evsel, sample, "pathname");
2628 static int trace__sched_stat_runtime(struct trace *trace, struct evsel *evsel, argument
2632 u64 runtime = evsel__intval(evsel, sample, "runtime");
2650 evsel->name,
2651 evsel__strval(evsel, sample, "comm"),
2652 (pid_t)evsel__intval(evsel, sample, "pid"),
2654 evsel__intval(evsel, sample, "vruntime"));
2690 static size_t trace__fprintf_tp_fields(struct trace *trace, struct evsel *evsel, struct perf_sample… argument
2695 struct tep_format_field *field = evsel->tp_format->format.fields;
2696 struct syscall_arg_fmt *arg = __evsel__syscall_arg_fmt(evsel);
2722 offset = format_field__intval(field, sample, evsel->needs_swap);
2729 val = format_field__intval(field, sample, evsel->needs_swap);
2764 static int trace__event_handler(struct trace *trace, struct evsel *evsel, argument
2776 if (evsel->disabled)
2782 callchain_ret = trace__resolve_callchain(trace, evsel, sample, &callchain_cursor);
2799 if (evsel == trace->syscalls.events.augmented) {
2800 int id = perf_evsel__sc_tp_uint(evsel, id, sample);
2801 struct syscall *sc = trace__syscall_info(trace, evsel, id);
2805 trace__fprintf_sys_enter(trace, evsel, sample);
2817 fprintf(trace->output, "%s(", evsel->name);
2819 if (evsel__is_bpf_output(evsel)) {
2821 } else if (evsel->tp_format) {
2822 if (strncmp(evsel->tp_format->name, "sys_enter_", 10) ||
2823 trace__fprintf_sys_enter(trace, evsel, sample)) {
2825 event_format__fprintf(evsel->tp_format, sample->cpu,
2829 trace__fprintf_tp_fields(trace, evsel, sample, thread, NULL, 0);
2840 pr_err("Problem processing %s callchain, skipping...\n", evsel__name(evsel));
2844 if (evsel->max_events != ULONG_MAX && ++evsel->nr_events_printed == evsel->max_events) {
2845 evsel__disable(evsel);
2846 evsel__close(evsel);
2871 struct evsel *evsel, argument
2885 callchain_ret = trace__resolve_callchain(trace, evsel, sample, &callchain_cursor);
2897 if (evsel->core.attr.config == PERF_COUNT_SW_PAGE_FAULTS_MAJ)
2910 evsel->core.attr.config == PERF_COUNT_SW_PAGE_FAULTS_MAJ ?
2935 pr_err("Problem processing %s callchain, skipping...\n", evsel__name(evsel));
2946 struct evsel *evsel, argument
2958 (evsel->core.attr.sample_type & PERF_SAMPLE_TIME))
2965 struct evsel *evsel, argument
2972 tracepoint_handler handler = evsel->handler;
2978 trace__set_base_time(trace, evsel, sample);
2982 handler(trace, evsel, event, sample);
3062 struct evsel *evsel, *tmp; local
3076 evlist__for_each_entry_safe(evlist, evsel, tmp) {
3077 if (!strstarts(evsel__name(evsel), "probe:vfs_getname"))
3080 if (evsel__field(evsel, "pathname")) {
3081 evsel->handler = trace__vfs_getname;
3086 list_del_init(&evsel->core.node);
3087 evsel->evlist = NULL;
3088 evsel__delete(evsel);
3094 static struct evsel *evsel__new_pgfault(u64 config)
3096 struct evsel *evsel; local
3107 evsel = evsel__new(&attr);
3108 if (evsel)
3109 evsel->handler = trace__pgfault;
3111 return evsel;
3116 struct evsel *evsel; local
3118 evlist__for_each_entry(evlist, evsel) {
3119 struct evsel_trace *et = evsel->priv;
3121 if (!et || !evsel->tp_format || strcmp(evsel->tp_format->system, "syscalls"))
3132 struct evsel *evsel; local
3139 evsel = evlist__id2evsel(trace->evlist, sample->id);
3140 if (evsel == NULL) {
3145 if (evswitch__discard(&trace->evswitch, evsel))
3148 trace__set_base_time(trace, evsel, sample);
3150 if (evsel->core.attr.type == PERF_TYPE_TRACEPOINT &&
3153 evsel__name(evsel), sample->tid,
3156 tracepoint_handler handler = evsel->handler;
3157 handler(trace, evsel, event, sample);
3168 struct evsel *sys_enter, *sys_exit;
3216 struct evsel *sys_exit;
3578 struct evsel *evsel, *tmp; local
3584 evlist__for_each_entry_safe(trace->evlist, tmp, evsel) {
3585 if (evsel->bpf_obj == trace->bpf_obj) {
3586 evlist__remove(trace->evlist, evsel);
3587 evsel__delete(evsel);
3638 struct evsel *evsel; local
3640 evlist__for_each_entry(trace->evlist, evsel) {
3641 if (evsel == trace->syscalls.events.augmented ||
3642 evsel->bpf_obj == trace->bpf_obj)
3787 static struct syscall_arg_fmt *evsel__find_syscall_arg_fmt_by_name(struct evsel *evsel, char *arg) argument
3790 struct syscall_arg_fmt *fmt = __evsel__syscall_arg_fmt(evsel);
3792 if (evsel->tp_format == NULL || fmt == NULL)
3795 for (field = evsel->tp_format->format.fields; field; field = field->next, ++fmt)
3802 static int trace__expand_filter(struct trace *trace __maybe_unused, struct evsel *evsel) argument
3804 char *tok, *left = evsel->filter, *new_filter = evsel->filter;
3842 fmt = evsel__find_syscall_arg_fmt_by_name(evsel, arg);
3845 arg, evsel->name, evsel->filter);
3870 if (new_filter != evsel->filter)
3876 right_size, right, arg, evsel->name, evsel->filter);
3881 arg, evsel->name, evsel->filter);
3891 if (new_filter != evsel->filter) {
3892 pr_debug("New filter for %s: %s\n", evsel->name, new_filter);
3893 evsel__set_filter(evsel, new_filter);
3900 static int trace__expand_filters(struct trace *trace, struct evsel **err_evsel)
3903 struct evsel *evsel; local
3905 evlist__for_each_entry(evlist, evsel) {
3906 if (evsel->filter == NULL)
3909 if (trace__expand_filter(trace, evsel)) {
3910 *err_evsel = evsel;
3921 struct evsel *evsel, *pgfault_maj = NULL, *pgfault_min = NULL; local
4054 err = trace__expand_filters(trace, &evsel);
4057 err = evlist__apply_filters(evlist, &evsel);
4089 evlist__for_each_entry(evlist, evsel) {
4090 if (evsel__has_callchain(evsel) &&
4091 evsel->core.attr.sample_max_stack == 0)
4092 evsel->core.attr.sample_max_stack = trace->max_stack;
4195 evsel->filter, evsel__name(evsel), errno,
4219 struct evsel *evsel; local
4258 evsel = evlist__find_tracepoint_by_name(session->evlist, "raw_syscalls:sys_enter");
4260 if (evsel == NULL)
4261 evsel = evlist__find_tracepoint_by_name(session->evlist, "syscalls:sys_enter");
4263 if (evsel &&
4264 (evsel__init_raw_syscall_tp(evsel, trace__sys_enter) < 0 ||
4265 perf_evsel__init_sc_tp_ptr_field(evsel, args))) {
4270 evsel = evlist__find_tracepoint_by_name(session->evlist, "raw_syscalls:sys_exit");
4271 if (evsel == NULL)
4272 evsel = evlist__find_tracepoint_by_name(session->evlist, "syscalls:sys_exit");
4273 if (evsel &&
4274 (evsel__init_raw_syscall_tp(evsel, trace__sys_exit) < 0 ||
4275 perf_evsel__init_sc_tp_uint_field(evsel, ret))) {
4280 evlist__for_each_entry(session->evlist, evsel) {
4281 if (evsel->core.attr.type == PERF_TYPE_SOFTWARE &&
4282 (evsel->core.attr.config == PERF_COUNT_SW_PAGE_FAULTS_MAJ ||
4283 evsel->core.attr.config == PERF_COUNT_SW_PAGE_FAULTS_MIN ||
4284 evsel->core.attr.config == PERF_COUNT_SW_PAGE_FAULTS))
4285 evsel->handler = trace__pgfault;
4518 struct evsel *evsel; local
4520 evlist__for_each_entry(evlist, evsel) {
4521 if (evsel->handler == NULL)
4522 evsel->handler = handler;
4526 static void evsel__set_syscall_arg_fmt(struct evsel *evsel, const char *name) argument
4528 struct syscall_arg_fmt *fmt = evsel__syscall_arg_fmt(evsel);
4536 if (strcmp(evsel->tp_format->format.fields->name, "__syscall_nr") == 0 ||
4537 strcmp(evsel->tp_format->format.fields->name, "nr") == 0)
4540 memcpy(fmt + skip, scfmt->arg, (evsel->tp_format->format.nr_fields - skip) * sizeof(*fmt));
4547 struct evsel *evsel; local
4549 evlist__for_each_entry(evlist, evsel) {
4550 if (evsel->priv || !evsel->tp_format)
4553 if (strcmp(evsel->tp_format->system, "syscalls")) {
4554 evsel__init_tp_arg_scnprintf(evsel);
4558 if (evsel__init_syscall_tp(evsel))
4561 if (!strncmp(evsel->tp_format->name, "sys_enter_", 10)) {
4562 struct syscall_tp *sc = __evsel__syscall_tp(evsel);
4567 evsel__set_syscall_arg_fmt(evsel, evsel->tp_format->name + sizeof("sys_enter_") - 1);
4568 } else if (!strncmp(evsel->tp_format->name, "sys_exit_", 9)) {
4569 struct syscall_tp *sc = __evsel__syscall_tp(evsel);
4571 if (__tp_field__init_uint(&sc->ret, sizeof(u64), sc->id.offset + sizeof(u64), evsel->needs_swap))
4574 evsel__set_syscall_arg_fmt(evsel, evsel->tp_format->name + sizeof("sys_exit_") - 1);
4869 struct evsel *evsel; local
4941 evsel = bpf__setup_output_event(trace.evlist, "__augmented_syscalls__");
4942 if (IS_ERR(evsel)) {
4943 bpf__strerror_setup_output_event(trace.evlist, PTR_ERR(evsel), bf, sizeof(bf));
4948 if (evsel) {
4949 trace.syscalls.events.augmented = evsel;
4951 evsel = evlist__find_tracepoint_by_name(trace.evlist, "raw_syscalls:sys_enter");
4952 if (evsel == NULL) {
4957 if (evsel->bpf_obj == NULL) {
4962 trace.bpf_obj = evsel->bpf_obj;
5073 evlist__for_each_entry(trace.evlist, evsel) {
5074 bool raw_syscalls_sys_exit = strcmp(evsel__name(evsel), "raw_syscalls:sys_exit") == 0;
5082 strstr(evsel__name(evsel), "syscalls:sys_enter")) {
5083 struct evsel *augmented = trace.syscalls.events.augmented;
5084 if (evsel__init_augmented_syscall_tp(augmented, evsel) ||
5099 if (evsel__init_augmented_syscall_tp(evsel, evsel) ||
5100 evsel__init_augmented_syscall_tp_args(evsel))
5102 evsel->handler = trace__sys_enter;
5105 if (strstarts(evsel__name(evsel), "syscalls:sys_exit_")) {
5108 if (evsel__init_augmented_syscall_tp(evsel, evsel))
5110 sc = __evsel__syscall_tp(evsel);
5132 evsel__init_augmented_syscall_tp_ret(evsel);
5133 evsel->handler = trace__sys_exit;