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); \
1818 static int evsel__init_tp_arg_scnprintf(struct evsel *evsel) in evsel__init_tp_arg_scnprintf() argument
1820 struct syscall_arg_fmt *fmt = evsel__syscall_arg_fmt(evsel); in evsel__init_tp_arg_scnprintf()
1823 syscall_arg_fmt__init_array(fmt, evsel->tp_format->format.fields); in evsel__init_tp_arg_scnprintf()
2067 typedef int (*tracepoint_handler)(struct trace *trace, struct evsel *evsel,
2072 struct evsel *evsel, int id) argument
2091 id, evsel__name(evsel), ++n);
2226 static int trace__fprintf_sample(struct trace *trace, struct evsel *evsel, argument
2235 evsel__name(evsel), ts,
2269 static int trace__sys_enter(struct trace *trace, struct evsel *evsel, argument
2277 int id = perf_evsel__sc_tp_uint(evsel, id, sample), err = -1;
2280 struct syscall *sc = trace__syscall_info(trace, evsel, id);
2291 trace__fprintf_sample(trace, evsel, sample, thread);
2293 args = perf_evsel__sc_tp_ptr(evsel, args, sample);
2313 if (evsel != trace->syscalls.events.sys_enter)
2348 static int trace__fprintf_sys_enter(struct trace *trace, struct evsel *evsel, argument
2353 int id = perf_evsel__sc_tp_uint(evsel, id, sample), err = -1;
2354 struct syscall *sc = trace__syscall_info(trace, evsel, id);
2371 args = perf_evsel__sc_tp_ptr(evsel, args, sample);
2381 static int trace__resolve_callchain(struct trace *trace, struct evsel *evsel, argument
2386 int max_stack = evsel->core.attr.sample_max_stack ?
2387 evsel->core.attr.sample_max_stack :
2394 err = thread__resolve_callchain(al.thread, cursor, evsel, sample, NULL, NULL, max_stack);
2409 static const char *errno_to_name(struct evsel *evsel, int err) argument
2411 struct perf_env *env = evsel__env(evsel);
2417 static int trace__sys_exit(struct trace *trace, struct evsel *evsel, argument
2425 int id = perf_evsel__sc_tp_uint(evsel, id, sample), err = -1, callchain_ret = 0, printed = 0;
2427 struct syscall *sc = trace__syscall_info(trace, evsel, id);
2438 trace__fprintf_sample(trace, evsel, sample, thread);
2440 ret = perf_evsel__sc_tp_uint(evsel, ret, sample);
2460 callchain_ret = trace__resolve_callchain(trace, evsel, sample, &callchain_cursor);
2500 *e = errno_to_name(evsel, -ret);
2542 pr_err("Problem processing %s callchain, skipping...\n", evsel__name(evsel));
2551 static int trace__vfs_getname(struct trace *trace, struct evsel *evsel, argument
2560 const char *filename = evsel__rawptr(evsel, sample, "pathname");
2612 static int trace__sched_stat_runtime(struct trace *trace, struct evsel *evsel, argument
2616 u64 runtime = evsel__intval(evsel, sample, "runtime");
2634 evsel->name,
2635 evsel__strval(evsel, sample, "comm"),
2636 (pid_t)evsel__intval(evsel, sample, "pid"),
2638 evsel__intval(evsel, sample, "vruntime"));
2674 static size_t trace__fprintf_tp_fields(struct trace *trace, struct evsel *evsel, struct perf_sample… argument
2679 struct tep_format_field *field = evsel->tp_format->format.fields;
2680 struct syscall_arg_fmt *arg = __evsel__syscall_arg_fmt(evsel);
2706 offset = format_field__intval(field, sample, evsel->needs_swap);
2713 val = format_field__intval(field, sample, evsel->needs_swap);
2748 static int trace__event_handler(struct trace *trace, struct evsel *evsel, argument
2760 if (evsel->disabled)
2766 callchain_ret = trace__resolve_callchain(trace, evsel, sample, &callchain_cursor);
2783 if (evsel == trace->syscalls.events.augmented) {
2784 int id = perf_evsel__sc_tp_uint(evsel, id, sample);
2785 struct syscall *sc = trace__syscall_info(trace, evsel, id);
2789 trace__fprintf_sys_enter(trace, evsel, sample);
2801 fprintf(trace->output, "%s(", evsel->name);
2803 if (evsel__is_bpf_output(evsel)) {
2805 } else if (evsel->tp_format) {
2806 if (strncmp(evsel->tp_format->name, "sys_enter_", 10) ||
2807 trace__fprintf_sys_enter(trace, evsel, sample)) {
2809 event_format__fprintf(evsel->tp_format, sample->cpu,
2813 trace__fprintf_tp_fields(trace, evsel, sample, thread, NULL, 0);
2824 pr_err("Problem processing %s callchain, skipping...\n", evsel__name(evsel));
2828 if (evsel->max_events != ULONG_MAX && ++evsel->nr_events_printed == evsel->max_events) {
2829 evsel__disable(evsel);
2830 evsel__close(evsel);
2855 struct evsel *evsel, argument
2869 callchain_ret = trace__resolve_callchain(trace, evsel, sample, &callchain_cursor);
2881 if (evsel->core.attr.config == PERF_COUNT_SW_PAGE_FAULTS_MAJ)
2894 evsel->core.attr.config == PERF_COUNT_SW_PAGE_FAULTS_MAJ ?
2919 pr_err("Problem processing %s callchain, skipping...\n", evsel__name(evsel));
2930 struct evsel *evsel, argument
2942 (evsel->core.attr.sample_type & PERF_SAMPLE_TIME))
2949 struct evsel *evsel, argument
2956 tracepoint_handler handler = evsel->handler;
2962 trace__set_base_time(trace, evsel, sample);
2966 handler(trace, evsel, event, sample);
3046 struct evsel *evsel, *tmp; local
3060 evlist__for_each_entry_safe(evlist, evsel, tmp) {
3061 if (!strstarts(evsel__name(evsel), "probe:vfs_getname"))
3064 if (evsel__field(evsel, "pathname")) {
3065 evsel->handler = trace__vfs_getname;
3070 list_del_init(&evsel->core.node);
3071 evsel->evlist = NULL;
3072 evsel__delete(evsel);
3078 static struct evsel *evsel__new_pgfault(u64 config)
3080 struct evsel *evsel; local
3091 evsel = evsel__new(&attr);
3092 if (evsel)
3093 evsel->handler = trace__pgfault;
3095 return evsel;
3101 struct evsel *evsel; local
3108 evsel = perf_evlist__id2evsel(trace->evlist, sample->id);
3109 if (evsel == NULL) {
3114 if (evswitch__discard(&trace->evswitch, evsel))
3117 trace__set_base_time(trace, evsel, sample);
3119 if (evsel->core.attr.type == PERF_TYPE_TRACEPOINT &&
3122 evsel__name(evsel), sample->tid,
3125 tracepoint_handler handler = evsel->handler;
3126 handler(trace, evsel, event, sample);
3137 struct evsel *sys_enter, *sys_exit;
3185 struct evsel *sys_exit;
3547 struct evsel *evsel, *tmp; local
3553 evlist__for_each_entry_safe(trace->evlist, tmp, evsel) {
3554 if (evsel->bpf_obj == trace->bpf_obj) {
3555 evlist__remove(trace->evlist, evsel);
3556 evsel__delete(evsel);
3607 struct evsel *evsel; local
3609 evlist__for_each_entry(trace->evlist, evsel) {
3610 if (evsel == trace->syscalls.events.augmented ||
3611 evsel->bpf_obj == trace->bpf_obj)
3757 static struct syscall_arg_fmt *evsel__find_syscall_arg_fmt_by_name(struct evsel *evsel, char *arg) argument
3760 struct syscall_arg_fmt *fmt = __evsel__syscall_arg_fmt(evsel);
3762 if (evsel->tp_format == NULL || fmt == NULL)
3765 for (field = evsel->tp_format->format.fields; field; field = field->next, ++fmt)
3772 static int trace__expand_filter(struct trace *trace __maybe_unused, struct evsel *evsel) argument
3774 char *tok, *left = evsel->filter, *new_filter = evsel->filter;
3812 fmt = evsel__find_syscall_arg_fmt_by_name(evsel, arg);
3815 arg, evsel->name, evsel->filter);
3840 if (new_filter != evsel->filter)
3846 right_size, right, arg, evsel->name, evsel->filter);
3851 arg, evsel->name, evsel->filter);
3861 if (new_filter != evsel->filter) {
3862 pr_debug("New filter for %s: %s\n", evsel->name, new_filter);
3863 evsel__set_filter(evsel, new_filter);
3870 static int trace__expand_filters(struct trace *trace, struct evsel **err_evsel)
3873 struct evsel *evsel; local
3875 evlist__for_each_entry(evlist, evsel) {
3876 if (evsel->filter == NULL)
3879 if (trace__expand_filter(trace, evsel)) {
3880 *err_evsel = evsel;
3891 struct evsel *evsel, *pgfault_maj = NULL, *pgfault_min = NULL; local
4028 err = trace__expand_filters(trace, &evsel);
4031 err = perf_evlist__apply_filters(evlist, &evsel);
4063 evlist__for_each_entry(evlist, evsel) {
4064 if (evsel__has_callchain(evsel) &&
4065 evsel->core.attr.sample_max_stack == 0)
4066 evsel->core.attr.sample_max_stack = trace->max_stack;
4169 evsel->filter, evsel__name(evsel), errno,
4193 struct evsel *evsel; local
4232 evsel = perf_evlist__find_tracepoint_by_name(session->evlist,
4235 if (evsel == NULL)
4236 evsel = perf_evlist__find_tracepoint_by_name(session->evlist,
4239 if (evsel &&
4240 (evsel__init_raw_syscall_tp(evsel, trace__sys_enter) < 0 ||
4241 perf_evsel__init_sc_tp_ptr_field(evsel, args))) {
4246 evsel = perf_evlist__find_tracepoint_by_name(session->evlist,
4248 if (evsel == NULL)
4249 evsel = perf_evlist__find_tracepoint_by_name(session->evlist,
4251 if (evsel &&
4252 (evsel__init_raw_syscall_tp(evsel, trace__sys_exit) < 0 ||
4253 perf_evsel__init_sc_tp_uint_field(evsel, ret))) {
4258 evlist__for_each_entry(session->evlist, evsel) {
4259 if (evsel->core.attr.type == PERF_TYPE_SOFTWARE &&
4260 (evsel->core.attr.config == PERF_COUNT_SW_PAGE_FAULTS_MAJ ||
4261 evsel->core.attr.config == PERF_COUNT_SW_PAGE_FAULTS_MIN ||
4262 evsel->core.attr.config == PERF_COUNT_SW_PAGE_FAULTS))
4263 evsel->handler = trace__pgfault;
4496 struct evsel *evsel; local
4498 evlist__for_each_entry(evlist, evsel) {
4499 if (evsel->handler == NULL)
4500 evsel->handler = handler;
4504 static void evsel__set_syscall_arg_fmt(struct evsel *evsel, const char *name) argument
4506 struct syscall_arg_fmt *fmt = evsel__syscall_arg_fmt(evsel);
4514 if (strcmp(evsel->tp_format->format.fields->name, "__syscall_nr") == 0 ||
4515 strcmp(evsel->tp_format->format.fields->name, "nr") == 0)
4518 memcpy(fmt + skip, scfmt->arg, (evsel->tp_format->format.nr_fields - skip) * sizeof(*fmt));
4525 struct evsel *evsel; local
4527 evlist__for_each_entry(evlist, evsel) {
4528 if (evsel->priv || !evsel->tp_format)
4531 if (strcmp(evsel->tp_format->system, "syscalls")) {
4532 evsel__init_tp_arg_scnprintf(evsel);
4536 if (evsel__init_syscall_tp(evsel))
4539 if (!strncmp(evsel->tp_format->name, "sys_enter_", 10)) {
4540 struct syscall_tp *sc = __evsel__syscall_tp(evsel);
4545 evsel__set_syscall_arg_fmt(evsel, evsel->tp_format->name + sizeof("sys_enter_") - 1);
4546 } else if (!strncmp(evsel->tp_format->name, "sys_exit_", 9)) {
4547 struct syscall_tp *sc = __evsel__syscall_tp(evsel);
4549 if (__tp_field__init_uint(&sc->ret, sizeof(u64), sc->id.offset + sizeof(u64), evsel->needs_swap))
4552 evsel__set_syscall_arg_fmt(evsel, evsel->tp_format->name + sizeof("sys_exit_") - 1);
4830 struct evsel *evsel; local
4900 evsel = bpf__setup_output_event(trace.evlist, "__augmented_syscalls__");
4901 if (IS_ERR(evsel)) {
4902 bpf__strerror_setup_output_event(trace.evlist, PTR_ERR(evsel), bf, sizeof(bf));
4907 if (evsel) {
4908 trace.syscalls.events.augmented = evsel;
4910 evsel = perf_evlist__find_tracepoint_by_name(trace.evlist, "raw_syscalls:sys_enter");
4911 if (evsel == NULL) {
4916 if (evsel->bpf_obj == NULL) {
4921 trace.bpf_obj = evsel->bpf_obj;
5032 evlist__for_each_entry(trace.evlist, evsel) {
5033 bool raw_syscalls_sys_exit = strcmp(evsel__name(evsel), "raw_syscalls:sys_exit") == 0;
5041 strstr(evsel__name(evsel), "syscalls:sys_enter")) {
5042 struct evsel *augmented = trace.syscalls.events.augmented;
5043 if (evsel__init_augmented_syscall_tp(augmented, evsel) ||
5058 if (evsel__init_augmented_syscall_tp(evsel, evsel) ||
5059 evsel__init_augmented_syscall_tp_args(evsel))
5061 evsel->handler = trace__sys_enter;
5064 if (strstarts(evsel__name(evsel), "syscalls:sys_exit_")) {
5067 if (evsel__init_augmented_syscall_tp(evsel, evsel))
5069 sc = __evsel__syscall_tp(evsel);
5091 evsel__init_augmented_syscall_tp_ret(evsel);
5092 evsel->handler = trace__sys_exit;