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); \
1837 static int evsel__init_tp_arg_scnprintf(struct evsel *evsel) in evsel__init_tp_arg_scnprintf() argument
1839 struct syscall_arg_fmt *fmt = evsel__syscall_arg_fmt(evsel); in evsel__init_tp_arg_scnprintf()
1842 syscall_arg_fmt__init_array(fmt, evsel->tp_format->format.fields); in evsel__init_tp_arg_scnprintf()
2086 typedef int (*tracepoint_handler)(struct trace *trace, struct evsel *evsel,
2091 struct evsel *evsel, int id) argument
2110 id, evsel__name(evsel), ++n);
2245 static int trace__fprintf_sample(struct trace *trace, struct evsel *evsel, argument
2254 evsel__name(evsel), ts,
2296 static int trace__sys_enter(struct trace *trace, struct evsel *evsel, argument
2304 int id = perf_evsel__sc_tp_uint(evsel, id, sample), err = -1;
2307 struct syscall *sc = trace__syscall_info(trace, evsel, id);
2318 trace__fprintf_sample(trace, evsel, sample, thread);
2320 args = perf_evsel__sc_tp_ptr(evsel, args, sample);
2340 if (evsel != trace->syscalls.events.sys_enter)
2375 static int trace__fprintf_sys_enter(struct trace *trace, struct evsel *evsel, argument
2380 int id = perf_evsel__sc_tp_uint(evsel, id, sample), err = -1;
2381 struct syscall *sc = trace__syscall_info(trace, evsel, id);
2398 args = perf_evsel__sc_tp_ptr(evsel, args, sample);
2408 static int trace__resolve_callchain(struct trace *trace, struct evsel *evsel, argument
2413 int max_stack = evsel->core.attr.sample_max_stack ?
2414 evsel->core.attr.sample_max_stack :
2421 err = thread__resolve_callchain(al.thread, cursor, evsel, sample, NULL, NULL, max_stack);
2436 static const char *errno_to_name(struct evsel *evsel, int err) argument
2438 struct perf_env *env = evsel__env(evsel);
2444 static int trace__sys_exit(struct trace *trace, struct evsel *evsel, argument
2452 int id = perf_evsel__sc_tp_uint(evsel, id, sample), err = -1, callchain_ret = 0, printed = 0;
2454 struct syscall *sc = trace__syscall_info(trace, evsel, id);
2465 trace__fprintf_sample(trace, evsel, sample, thread);
2467 ret = perf_evsel__sc_tp_uint(evsel, ret, sample);
2487 callchain_ret = trace__resolve_callchain(trace, evsel, sample, &callchain_cursor);
2527 *e = errno_to_name(evsel, -ret);
2569 pr_err("Problem processing %s callchain, skipping...\n", evsel__name(evsel));
2578 static int trace__vfs_getname(struct trace *trace, struct evsel *evsel, argument
2587 const char *filename = evsel__rawptr(evsel, sample, "pathname");
2639 static int trace__sched_stat_runtime(struct trace *trace, struct evsel *evsel, argument
2643 u64 runtime = evsel__intval(evsel, sample, "runtime");
2661 evsel->name,
2662 evsel__strval(evsel, sample, "comm"),
2663 (pid_t)evsel__intval(evsel, sample, "pid"),
2665 evsel__intval(evsel, sample, "vruntime"));
2701 static size_t trace__fprintf_tp_fields(struct trace *trace, struct evsel *evsel, struct perf_sample… argument
2706 struct tep_format_field *field = evsel->tp_format->format.fields;
2707 struct syscall_arg_fmt *arg = __evsel__syscall_arg_fmt(evsel);
2733 offset = format_field__intval(field, sample, evsel->needs_swap);
2742 val = format_field__intval(field, sample, evsel->needs_swap);
2777 static int trace__event_handler(struct trace *trace, struct evsel *evsel, argument
2789 if (evsel->disabled)
2795 callchain_ret = trace__resolve_callchain(trace, evsel, sample, &callchain_cursor);
2812 if (evsel == trace->syscalls.events.augmented) {
2813 int id = perf_evsel__sc_tp_uint(evsel, id, sample);
2814 struct syscall *sc = trace__syscall_info(trace, evsel, id);
2818 trace__fprintf_sys_enter(trace, evsel, sample);
2830 fprintf(trace->output, "%s(", evsel->name);
2832 if (evsel__is_bpf_output(evsel)) {
2834 } else if (evsel->tp_format) {
2835 if (strncmp(evsel->tp_format->name, "sys_enter_", 10) ||
2836 trace__fprintf_sys_enter(trace, evsel, sample)) {
2838 event_format__fprintf(evsel->tp_format, sample->cpu,
2842 trace__fprintf_tp_fields(trace, evsel, sample, thread, NULL, 0);
2853 pr_err("Problem processing %s callchain, skipping...\n", evsel__name(evsel));
2857 if (evsel->max_events != ULONG_MAX && ++evsel->nr_events_printed == evsel->max_events) {
2858 evsel__disable(evsel);
2859 evsel__close(evsel);
2884 struct evsel *evsel, argument
2898 callchain_ret = trace__resolve_callchain(trace, evsel, sample, &callchain_cursor);
2910 if (evsel->core.attr.config == PERF_COUNT_SW_PAGE_FAULTS_MAJ)
2923 evsel->core.attr.config == PERF_COUNT_SW_PAGE_FAULTS_MAJ ?
2948 pr_err("Problem processing %s callchain, skipping...\n", evsel__name(evsel));
2959 struct evsel *evsel, argument
2971 (evsel->core.attr.sample_type & PERF_SAMPLE_TIME))
2978 struct evsel *evsel, argument
2985 tracepoint_handler handler = evsel->handler;
2991 trace__set_base_time(trace, evsel, sample);
2995 handler(trace, evsel, event, sample);
3075 struct evsel *evsel, *tmp; local
3085 evlist__for_each_entry_safe(evlist, evsel, tmp) {
3086 if (!strstarts(evsel__name(evsel), "probe:vfs_getname"))
3089 if (evsel__field(evsel, "pathname")) {
3090 evsel->handler = trace__vfs_getname;
3095 list_del_init(&evsel->core.node);
3096 evsel->evlist = NULL;
3097 evsel__delete(evsel);
3103 static struct evsel *evsel__new_pgfault(u64 config)
3105 struct evsel *evsel; local
3116 evsel = evsel__new(&attr);
3117 if (evsel)
3118 evsel->handler = trace__pgfault;
3120 return evsel;
3125 struct evsel *evsel; local
3127 evlist__for_each_entry(evlist, evsel) {
3128 struct evsel_trace *et = evsel->priv;
3130 if (!et || !evsel->tp_format || strcmp(evsel->tp_format->system, "syscalls"))
3141 struct evsel *evsel; local
3148 evsel = evlist__id2evsel(trace->evlist, sample->id);
3149 if (evsel == NULL) {
3154 if (evswitch__discard(&trace->evswitch, evsel))
3157 trace__set_base_time(trace, evsel, sample);
3159 if (evsel->core.attr.type == PERF_TYPE_TRACEPOINT &&
3162 evsel__name(evsel), sample->tid,
3165 tracepoint_handler handler = evsel->handler;
3166 handler(trace, evsel, event, sample);
3177 struct evsel *sys_enter, *sys_exit;
3225 struct evsel *sys_exit;
3598 struct evsel *evsel, *tmp; local
3604 evlist__for_each_entry_safe(trace->evlist, tmp, evsel) {
3605 if (evsel->bpf_obj == trace->bpf_obj) {
3606 evlist__remove(trace->evlist, evsel);
3607 evsel__delete(evsel);
3658 struct evsel *evsel; local
3660 evlist__for_each_entry(trace->evlist, evsel) {
3661 if (evsel == trace->syscalls.events.augmented ||
3662 evsel->bpf_obj == trace->bpf_obj)
3807 static struct syscall_arg_fmt *evsel__find_syscall_arg_fmt_by_name(struct evsel *evsel, char *arg) argument
3810 struct syscall_arg_fmt *fmt = __evsel__syscall_arg_fmt(evsel);
3812 if (evsel->tp_format == NULL || fmt == NULL)
3815 for (field = evsel->tp_format->format.fields; field; field = field->next, ++fmt)
3822 static int trace__expand_filter(struct trace *trace __maybe_unused, struct evsel *evsel) argument
3824 char *tok, *left = evsel->filter, *new_filter = evsel->filter;
3862 fmt = evsel__find_syscall_arg_fmt_by_name(evsel, arg);
3865 arg, evsel->name, evsel->filter);
3890 if (new_filter != evsel->filter)
3896 right_size, right, arg, evsel->name, evsel->filter);
3901 arg, evsel->name, evsel->filter);
3911 if (new_filter != evsel->filter) {
3912 pr_debug("New filter for %s: %s\n", evsel->name, new_filter);
3913 evsel__set_filter(evsel, new_filter);
3920 static int trace__expand_filters(struct trace *trace, struct evsel **err_evsel)
3923 struct evsel *evsel; local
3925 evlist__for_each_entry(evlist, evsel) {
3926 if (evsel->filter == NULL)
3929 if (trace__expand_filter(trace, evsel)) {
3930 *err_evsel = evsel;
3941 struct evsel *evsel, *pgfault_maj = NULL, *pgfault_min = NULL; local
4078 err = trace__expand_filters(trace, &evsel);
4081 err = evlist__apply_filters(evlist, &evsel);
4113 evlist__for_each_entry(evlist, evsel) {
4114 if (evsel__has_callchain(evsel) &&
4115 evsel->core.attr.sample_max_stack == 0)
4116 evsel->core.attr.sample_max_stack = trace->max_stack;
4219 evsel->filter, evsel__name(evsel), errno,
4243 struct evsel *evsel; local
4282 evsel = evlist__find_tracepoint_by_name(session->evlist, "raw_syscalls:sys_enter");
4283 trace->syscalls.events.sys_enter = evsel;
4285 if (evsel == NULL)
4286 evsel = evlist__find_tracepoint_by_name(session->evlist, "syscalls:sys_enter");
4288 if (evsel &&
4289 (evsel__init_raw_syscall_tp(evsel, trace__sys_enter) < 0 ||
4290 perf_evsel__init_sc_tp_ptr_field(evsel, args))) {
4295 evsel = evlist__find_tracepoint_by_name(session->evlist, "raw_syscalls:sys_exit");
4296 trace->syscalls.events.sys_exit = evsel;
4297 if (evsel == NULL)
4298 evsel = evlist__find_tracepoint_by_name(session->evlist, "syscalls:sys_exit");
4299 if (evsel &&
4300 (evsel__init_raw_syscall_tp(evsel, trace__sys_exit) < 0 ||
4301 perf_evsel__init_sc_tp_uint_field(evsel, ret))) {
4306 evlist__for_each_entry(session->evlist, evsel) {
4307 if (evsel->core.attr.type == PERF_TYPE_SOFTWARE &&
4308 (evsel->core.attr.config == PERF_COUNT_SW_PAGE_FAULTS_MAJ ||
4309 evsel->core.attr.config == PERF_COUNT_SW_PAGE_FAULTS_MIN ||
4310 evsel->core.attr.config == PERF_COUNT_SW_PAGE_FAULTS))
4311 evsel->handler = trace__pgfault;
4544 struct evsel *evsel; local
4546 evlist__for_each_entry(evlist, evsel) {
4547 if (evsel->handler == NULL)
4548 evsel->handler = handler;
4552 static void evsel__set_syscall_arg_fmt(struct evsel *evsel, const char *name) argument
4554 struct syscall_arg_fmt *fmt = evsel__syscall_arg_fmt(evsel);
4562 if (strcmp(evsel->tp_format->format.fields->name, "__syscall_nr") == 0 ||
4563 strcmp(evsel->tp_format->format.fields->name, "nr") == 0)
4566 memcpy(fmt + skip, scfmt->arg, (evsel->tp_format->format.nr_fields - skip) * sizeof(*fmt));
4573 struct evsel *evsel; local
4575 evlist__for_each_entry(evlist, evsel) {
4576 if (evsel->priv || !evsel->tp_format)
4579 if (strcmp(evsel->tp_format->system, "syscalls")) {
4580 evsel__init_tp_arg_scnprintf(evsel);
4584 if (evsel__init_syscall_tp(evsel))
4587 if (!strncmp(evsel->tp_format->name, "sys_enter_", 10)) {
4588 struct syscall_tp *sc = __evsel__syscall_tp(evsel);
4593 evsel__set_syscall_arg_fmt(evsel, evsel->tp_format->name + sizeof("sys_enter_") - 1);
4594 } else if (!strncmp(evsel->tp_format->name, "sys_exit_", 9)) {
4595 struct syscall_tp *sc = __evsel__syscall_tp(evsel);
4597 if (__tp_field__init_uint(&sc->ret, sizeof(u64), sc->id.offset + sizeof(u64), evsel->needs_swap))
4600 evsel__set_syscall_arg_fmt(evsel, evsel->tp_format->name + sizeof("sys_exit_") - 1);
4895 struct evsel *evsel; local
4973 evsel = bpf__setup_output_event(trace.evlist, "__augmented_syscalls__");
4974 if (IS_ERR(evsel)) {
4975 bpf__strerror_setup_output_event(trace.evlist, PTR_ERR(evsel), bf, sizeof(bf));
4980 if (evsel) {
4981 trace.syscalls.events.augmented = evsel;
4983 evsel = evlist__find_tracepoint_by_name(trace.evlist, "raw_syscalls:sys_enter");
4984 if (evsel == NULL) {
4989 if (evsel->bpf_obj == NULL) {
4994 trace.bpf_obj = evsel->bpf_obj;
5105 evlist__for_each_entry(trace.evlist, evsel) {
5106 bool raw_syscalls_sys_exit = strcmp(evsel__name(evsel), "raw_syscalls:sys_exit") == 0;
5114 strstr(evsel__name(evsel), "syscalls:sys_enter")) {
5115 struct evsel *augmented = trace.syscalls.events.augmented;
5116 if (evsel__init_augmented_syscall_tp(augmented, evsel) ||
5131 if (evsel__init_augmented_syscall_tp(evsel, evsel) ||
5132 evsel__init_augmented_syscall_tp_args(evsel))
5134 evsel->handler = trace__sys_enter;
5137 if (strstarts(evsel__name(evsel), "syscalls:sys_exit_")) {
5140 if (evsel__init_augmented_syscall_tp(evsel, evsel))
5142 sc = __evsel__syscall_tp(evsel);
5164 evsel__init_augmented_syscall_tp_ret(evsel);
5165 evsel->handler = trace__sys_exit;