Lines Matching full:con
22 int lock_contention_prepare(struct lock_contention *con) in lock_contention_prepare() argument
26 struct evlist *evlist = con->evlist; in lock_contention_prepare()
27 struct target *target = con->target; in lock_contention_prepare()
35 bpf_map__set_value_size(skel->maps.stacks, con->max_stack * sizeof(u64)); in lock_contention_prepare()
36 bpf_map__set_max_entries(skel->maps.lock_stat, con->map_nr_entries); in lock_contention_prepare()
37 bpf_map__set_max_entries(skel->maps.tstamp, con->map_nr_entries); in lock_contention_prepare()
39 if (con->aggr_mode == LOCK_AGGR_TASK) in lock_contention_prepare()
40 bpf_map__set_max_entries(skel->maps.task_data, con->map_nr_entries); in lock_contention_prepare()
44 if (con->save_callstack) in lock_contention_prepare()
45 bpf_map__set_max_entries(skel->maps.stacks, con->map_nr_entries); in lock_contention_prepare()
57 if (con->filters->nr_types) { in lock_contention_prepare()
59 ntypes = con->filters->nr_types; in lock_contention_prepare()
61 if (con->filters->nr_cgrps) { in lock_contention_prepare()
63 ncgrps = con->filters->nr_cgrps; in lock_contention_prepare()
67 if (con->filters->nr_syms) { in lock_contention_prepare()
72 for (i = 0; i < con->filters->nr_syms; i++) { in lock_contention_prepare()
73 sym = machine__find_kernel_symbol_by_name(con->machine, in lock_contention_prepare()
74 con->filters->syms[i], in lock_contention_prepare()
78 con->filters->syms[i]); in lock_contention_prepare()
82 addrs = realloc(con->filters->addrs, in lock_contention_prepare()
83 (con->filters->nr_addrs + 1) * sizeof(*addrs)); in lock_contention_prepare()
89 addrs[con->filters->nr_addrs++] = map__unmap_ip(kmap, sym->start); in lock_contention_prepare()
90 con->filters->addrs = addrs; in lock_contention_prepare()
92 naddrs = con->filters->nr_addrs; in lock_contention_prepare()
102 skel->rodata->stack_skip = con->stack_skip; in lock_contention_prepare()
103 skel->rodata->aggr_mode = con->aggr_mode; in lock_contention_prepare()
104 skel->rodata->needs_callstack = con->save_callstack; in lock_contention_prepare()
105 skel->rodata->lock_owner = con->owner; in lock_contention_prepare()
107 if (con->aggr_mode == LOCK_AGGR_CGROUP || con->filters->nr_cgrps) { in lock_contention_prepare()
149 if (con->filters->nr_types) { in lock_contention_prepare()
154 for (i = 0; i < con->filters->nr_types; i++) in lock_contention_prepare()
155 bpf_map_update_elem(fd, &con->filters->types[i], &val, BPF_ANY); in lock_contention_prepare()
158 if (con->filters->nr_addrs) { in lock_contention_prepare()
163 for (i = 0; i < con->filters->nr_addrs; i++) in lock_contention_prepare()
164 bpf_map_update_elem(fd, &con->filters->addrs[i], &val, BPF_ANY); in lock_contention_prepare()
167 if (con->filters->nr_cgrps) { in lock_contention_prepare()
172 for (i = 0; i < con->filters->nr_cgrps; i++) in lock_contention_prepare()
173 bpf_map_update_elem(fd, &con->filters->cgrps[i], &val, BPF_ANY); in lock_contention_prepare()
176 if (con->aggr_mode == LOCK_AGGR_CGROUP) in lock_contention_prepare()
177 read_all_cgroups(&con->cgroups); in lock_contention_prepare()
247 static void account_end_timestamp(struct lock_contention *con) in account_end_timestamp() argument
253 enum lock_aggr_mode aggr_mode = con->aggr_mode; in account_end_timestamp()
265 if (aggr_mode == LOCK_AGGR_TASK && con->owner) in account_end_timestamp()
318 static const char *lock_contention_get_name(struct lock_contention *con, in lock_contention_get_name() argument
328 struct machine *machine = con->machine; in lock_contention_get_name()
330 if (con->aggr_mode == LOCK_AGGR_TASK) { in lock_contention_get_name()
348 if (con->aggr_mode == LOCK_AGGR_ADDR) { in lock_contention_get_name()
371 if (con->aggr_mode == LOCK_AGGR_CGROUP) { in lock_contention_get_name()
373 struct cgroup *cgrp = __cgroup__find(&con->cgroups, cgrp_id); in lock_contention_get_name()
384 idx < con->max_stack - 1) in lock_contention_get_name()
406 int lock_contention_read(struct lock_contention *con) in lock_contention_read() argument
412 struct machine *machine = con->machine; in lock_contention_read()
414 size_t stack_size = con->max_stack * sizeof(*stack_trace); in lock_contention_read()
419 con->fails.task = skel->bss->task_fail; in lock_contention_read()
420 con->fails.stack = skel->bss->stack_fail; in lock_contention_read()
421 con->fails.time = skel->bss->time_fail; in lock_contention_read()
422 con->fails.data = skel->bss->data_fail; in lock_contention_read()
428 account_end_timestamp(con); in lock_contention_read()
430 if (con->aggr_mode == LOCK_AGGR_TASK) { in lock_contention_read()
437 if (con->aggr_mode == LOCK_AGGR_ADDR) { in lock_contention_read()
458 if (con->save_callstack) { in lock_contention_read()
462 con->nr_filtered += data.count; in lock_contention_read()
467 switch (con->aggr_mode) { in lock_contention_read()
496 name = lock_contention_get_name(con, &key, stack_trace, data.flags); in lock_contention_read()
509 if (con->aggr_mode == LOCK_AGGR_CALLER && verbose > 0) { in lock_contention_read()
527 int lock_contention_finish(struct lock_contention *con) in lock_contention_finish() argument
534 while (!RB_EMPTY_ROOT(&con->cgroups)) { in lock_contention_finish()
535 struct rb_node *node = rb_first(&con->cgroups); in lock_contention_finish()
538 rb_erase(node, &con->cgroups); in lock_contention_finish()