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); \
1830 static int evsel__init_tp_arg_scnprintf(struct evsel *evsel) in evsel__init_tp_arg_scnprintf() argument
1832 struct syscall_arg_fmt *fmt = evsel__syscall_arg_fmt(evsel); in evsel__init_tp_arg_scnprintf()
1835 syscall_arg_fmt__init_array(fmt, evsel->tp_format->format.fields); in evsel__init_tp_arg_scnprintf()
2079 typedef int (*tracepoint_handler)(struct trace *trace, struct evsel *evsel,
2084 struct evsel *evsel, int id) argument
2103 id, evsel__name(evsel), ++n);
2238 static int trace__fprintf_sample(struct trace *trace, struct evsel *evsel, argument
2247 evsel__name(evsel), ts,
2289 static int trace__sys_enter(struct trace *trace, struct evsel *evsel, argument
2297 int id = perf_evsel__sc_tp_uint(evsel, id, sample), err = -1;
2300 struct syscall *sc = trace__syscall_info(trace, evsel, id);
2311 trace__fprintf_sample(trace, evsel, sample, thread);
2313 args = perf_evsel__sc_tp_ptr(evsel, args, sample);
2333 if (evsel != trace->syscalls.events.sys_enter)
2368 static int trace__fprintf_sys_enter(struct trace *trace, struct evsel *evsel, argument
2373 int id = perf_evsel__sc_tp_uint(evsel, id, sample), err = -1;
2374 struct syscall *sc = trace__syscall_info(trace, evsel, id);
2391 args = perf_evsel__sc_tp_ptr(evsel, args, sample);
2401 static int trace__resolve_callchain(struct trace *trace, struct evsel *evsel, argument
2406 int max_stack = evsel->core.attr.sample_max_stack ?
2407 evsel->core.attr.sample_max_stack :
2414 err = thread__resolve_callchain(al.thread, cursor, evsel, sample, NULL, NULL, max_stack);
2429 static const char *errno_to_name(struct evsel *evsel, int err) argument
2431 struct perf_env *env = evsel__env(evsel);
2437 static int trace__sys_exit(struct trace *trace, struct evsel *evsel, argument
2445 int id = perf_evsel__sc_tp_uint(evsel, id, sample), err = -1, callchain_ret = 0, printed = 0;
2447 struct syscall *sc = trace__syscall_info(trace, evsel, id);
2458 trace__fprintf_sample(trace, evsel, sample, thread);
2460 ret = perf_evsel__sc_tp_uint(evsel, ret, sample);
2480 callchain_ret = trace__resolve_callchain(trace, evsel, sample, &callchain_cursor);
2520 *e = errno_to_name(evsel, -ret);
2562 pr_err("Problem processing %s callchain, skipping...\n", evsel__name(evsel));
2571 static int trace__vfs_getname(struct trace *trace, struct evsel *evsel, argument
2580 const char *filename = evsel__rawptr(evsel, sample, "pathname");
2632 static int trace__sched_stat_runtime(struct trace *trace, struct evsel *evsel, argument
2636 u64 runtime = evsel__intval(evsel, sample, "runtime");
2654 evsel->name,
2655 evsel__strval(evsel, sample, "comm"),
2656 (pid_t)evsel__intval(evsel, sample, "pid"),
2658 evsel__intval(evsel, sample, "vruntime"));
2694 static size_t trace__fprintf_tp_fields(struct trace *trace, struct evsel *evsel, struct perf_sample… argument
2699 struct tep_format_field *field = evsel->tp_format->format.fields;
2700 struct syscall_arg_fmt *arg = __evsel__syscall_arg_fmt(evsel);
2726 offset = format_field__intval(field, sample, evsel->needs_swap);
2733 val = format_field__intval(field, sample, evsel->needs_swap);
2768 static int trace__event_handler(struct trace *trace, struct evsel *evsel, argument
2780 if (evsel->disabled)
2786 callchain_ret = trace__resolve_callchain(trace, evsel, sample, &callchain_cursor);
2803 if (evsel == trace->syscalls.events.augmented) {
2804 int id = perf_evsel__sc_tp_uint(evsel, id, sample);
2805 struct syscall *sc = trace__syscall_info(trace, evsel, id);
2809 trace__fprintf_sys_enter(trace, evsel, sample);
2821 fprintf(trace->output, "%s(", evsel->name);
2823 if (evsel__is_bpf_output(evsel)) {
2825 } else if (evsel->tp_format) {
2826 if (strncmp(evsel->tp_format->name, "sys_enter_", 10) ||
2827 trace__fprintf_sys_enter(trace, evsel, sample)) {
2829 event_format__fprintf(evsel->tp_format, sample->cpu,
2833 trace__fprintf_tp_fields(trace, evsel, sample, thread, NULL, 0);
2844 pr_err("Problem processing %s callchain, skipping...\n", evsel__name(evsel));
2848 if (evsel->max_events != ULONG_MAX && ++evsel->nr_events_printed == evsel->max_events) {
2849 evsel__disable(evsel);
2850 evsel__close(evsel);
2875 struct evsel *evsel, argument
2889 callchain_ret = trace__resolve_callchain(trace, evsel, sample, &callchain_cursor);
2901 if (evsel->core.attr.config == PERF_COUNT_SW_PAGE_FAULTS_MAJ)
2914 evsel->core.attr.config == PERF_COUNT_SW_PAGE_FAULTS_MAJ ?
2939 pr_err("Problem processing %s callchain, skipping...\n", evsel__name(evsel));
2950 struct evsel *evsel, argument
2962 (evsel->core.attr.sample_type & PERF_SAMPLE_TIME))
2969 struct evsel *evsel, argument
2976 tracepoint_handler handler = evsel->handler;
2982 trace__set_base_time(trace, evsel, sample);
2986 handler(trace, evsel, event, sample);
3066 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
4055 err = trace__expand_filters(trace, &evsel);
4058 err = evlist__apply_filters(evlist, &evsel);
4090 evlist__for_each_entry(evlist, evsel) {
4091 if (evsel__has_callchain(evsel) &&
4092 evsel->core.attr.sample_max_stack == 0)
4093 evsel->core.attr.sample_max_stack = trace->max_stack;
4196 evsel->filter, evsel__name(evsel), errno,
4220 struct evsel *evsel; local
4259 evsel = evlist__find_tracepoint_by_name(session->evlist, "raw_syscalls:sys_enter");
4261 if (evsel == NULL)
4262 evsel = evlist__find_tracepoint_by_name(session->evlist, "syscalls:sys_enter");
4264 if (evsel &&
4265 (evsel__init_raw_syscall_tp(evsel, trace__sys_enter) < 0 ||
4266 perf_evsel__init_sc_tp_ptr_field(evsel, args))) {
4271 evsel = evlist__find_tracepoint_by_name(session->evlist, "raw_syscalls:sys_exit");
4272 if (evsel == NULL)
4273 evsel = evlist__find_tracepoint_by_name(session->evlist, "syscalls:sys_exit");
4274 if (evsel &&
4275 (evsel__init_raw_syscall_tp(evsel, trace__sys_exit) < 0 ||
4276 perf_evsel__init_sc_tp_uint_field(evsel, ret))) {
4281 evlist__for_each_entry(session->evlist, evsel) {
4282 if (evsel->core.attr.type == PERF_TYPE_SOFTWARE &&
4283 (evsel->core.attr.config == PERF_COUNT_SW_PAGE_FAULTS_MAJ ||
4284 evsel->core.attr.config == PERF_COUNT_SW_PAGE_FAULTS_MIN ||
4285 evsel->core.attr.config == PERF_COUNT_SW_PAGE_FAULTS))
4286 evsel->handler = trace__pgfault;
4519 struct evsel *evsel; local
4521 evlist__for_each_entry(evlist, evsel) {
4522 if (evsel->handler == NULL)
4523 evsel->handler = handler;
4527 static void evsel__set_syscall_arg_fmt(struct evsel *evsel, const char *name) argument
4529 struct syscall_arg_fmt *fmt = evsel__syscall_arg_fmt(evsel);
4537 if (strcmp(evsel->tp_format->format.fields->name, "__syscall_nr") == 0 ||
4538 strcmp(evsel->tp_format->format.fields->name, "nr") == 0)
4541 memcpy(fmt + skip, scfmt->arg, (evsel->tp_format->format.nr_fields - skip) * sizeof(*fmt));
4548 struct evsel *evsel; local
4550 evlist__for_each_entry(evlist, evsel) {
4551 if (evsel->priv || !evsel->tp_format)
4554 if (strcmp(evsel->tp_format->system, "syscalls")) {
4555 evsel__init_tp_arg_scnprintf(evsel);
4559 if (evsel__init_syscall_tp(evsel))
4562 if (!strncmp(evsel->tp_format->name, "sys_enter_", 10)) {
4563 struct syscall_tp *sc = __evsel__syscall_tp(evsel);
4568 evsel__set_syscall_arg_fmt(evsel, evsel->tp_format->name + sizeof("sys_enter_") - 1);
4569 } else if (!strncmp(evsel->tp_format->name, "sys_exit_", 9)) {
4570 struct syscall_tp *sc = __evsel__syscall_tp(evsel);
4572 if (__tp_field__init_uint(&sc->ret, sizeof(u64), sc->id.offset + sizeof(u64), evsel->needs_swap))
4575 evsel__set_syscall_arg_fmt(evsel, evsel->tp_format->name + sizeof("sys_exit_") - 1);
4870 struct evsel *evsel; local
4942 evsel = bpf__setup_output_event(trace.evlist, "__augmented_syscalls__");
4943 if (IS_ERR(evsel)) {
4944 bpf__strerror_setup_output_event(trace.evlist, PTR_ERR(evsel), bf, sizeof(bf));
4949 if (evsel) {
4950 trace.syscalls.events.augmented = evsel;
4952 evsel = evlist__find_tracepoint_by_name(trace.evlist, "raw_syscalls:sys_enter");
4953 if (evsel == NULL) {
4958 if (evsel->bpf_obj == NULL) {
4963 trace.bpf_obj = evsel->bpf_obj;
5074 evlist__for_each_entry(trace.evlist, evsel) {
5075 bool raw_syscalls_sys_exit = strcmp(evsel__name(evsel), "raw_syscalls:sys_exit") == 0;
5083 strstr(evsel__name(evsel), "syscalls:sys_enter")) {
5084 struct evsel *augmented = trace.syscalls.events.augmented;
5085 if (evsel__init_augmented_syscall_tp(augmented, evsel) ||
5100 if (evsel__init_augmented_syscall_tp(evsel, evsel) ||
5101 evsel__init_augmented_syscall_tp_args(evsel))
5103 evsel->handler = trace__sys_enter;
5106 if (strstarts(evsel__name(evsel), "syscalls:sys_exit_")) {
5109 if (evsel__init_augmented_syscall_tp(evsel, evsel))
5111 sc = __evsel__syscall_tp(evsel);
5133 evsel__init_augmented_syscall_tp_ret(evsel);
5134 evsel->handler = trace__sys_exit;