Projectname large_stringclasses 15
values | Filepath large_stringlengths 4 106 ⌀ | Function large_stringlengths 11 3.45k | Label list |
|---|---|---|---|
Linux Kernel | tools/perf/util/bpf-loader.c | static int preproc_gen_prologue(struct bpf_program *prog, int n,
const struct bpf_insn *orig_insns,
int orig_insns_cnt,
struct bpf_preproc_result *res) {
struct bpf_prog_priv *priv = program_priv(prog);
struct probe_trac... | [
1,
0
] |
Linux Kernel | tools/perf/util/bpf-loader.c | static int hook_load_preprocessor(struct bpf_program *prog) {
struct bpf_prog_priv *priv = program_priv(prog);
struct perf_probe_event *pev;
bool need_prologue = false;
int i;
if (IS_ERR_OR_NULL(priv)) {
pr_debug("Internal error when hook preprocessor\n");
return -BPF_LOADER_ERRNO__INTERNAL;
}
i... | [
1,
0
] |
Linux Kernel | tools/perf/util/bpf-loader.c |
int bpf__foreach_event(struct bpf_object *obj, bpf_prog_iter_callback_t func,
void *arg) {
struct bpf_program *prog;
int err;
bpf_object__for_each_program(prog, obj) {
struct bpf_prog_priv *priv = program_priv(prog);
struct probe_trace_event *tev;
struct perf_probe_event *pev;... | [
0,
0
] |
Linux Kernel | tools/perf/util/bpf-loader.c |
static void bpf_map_priv__purge(struct bpf_map_priv *priv) {
struct bpf_map_op *pos, *n;
list_for_each_entry_safe(pos, n, &priv->ops_list, list) {
list_del_init(&pos->list);
bpf_map_op__delete(pos);
}
} | [
0,
0
] |
Linux Kernel | tools/perf/util/bpf-loader.c |
static int bpf_map_op_setkey(struct bpf_map_op *op,
struct parse_events_term *term) {
op->key_type = BPF_MAP_KEY_ALL;
if (!term)
return 0;
if (term->array.nr_ranges) {
size_t memsz = term->array.nr_ranges * sizeof(op->k.array.ranges[0]);
op->k.array.ranges = memdup(term... | [
1,
0
] |
Linux Kernel | tools/perf/util/bpf-loader.c |
static struct bpf_map_priv *bpf_map_priv__clone(struct bpf_map_priv *priv) {
struct bpf_map_priv *newpriv;
struct bpf_map_op *pos, *newop;
newpriv = zalloc(sizeof(*newpriv));
if (!newpriv) {
pr_debug("Not enough memory to alloc map private\n");
return NULL;
}
INIT_LIST_HEAD(&newpriv->ops_list);
... | [
0,
0
] |
Linux Kernel | tools/perf/util/bpf-loader.c |
static int bpf_map__add_op(struct bpf_map *map, struct bpf_map_op *op) {
const char *map_name = bpf_map__name(map);
struct bpf_map_priv *priv = map_priv(map);
if (IS_ERR(priv)) {
pr_debug("Failed to get private from map %s\n", map_name);
return PTR_ERR(priv);
}
if (!priv) {
priv = zalloc(sizeof... | [
1,
0
] |
Linux Kernel | tools/perf/util/bpf-loader.c |
static int __bpf_map__config_value(struct bpf_map *map,
struct parse_events_term *term) {
struct bpf_map_op *op;
const char *map_name = bpf_map__name(map);
if (!map) {
pr_debug("Map '%s' is invalid\n", map_name);
return -BPF_LOADER_ERRNO__INTERNAL;
}
if (bpf_map__... | [
1,
0
] |
Linux Kernel | tools/perf/util/bpf-loader.c |
static int config_map_indices_range_check(struct parse_events_term *term,
struct bpf_map *map,
const char *map_name) {
struct parse_events_array *array = &term->array;
unsigned int i;
if (!array->nr_ranges)
return 0;
if (!... | [
1,
0
] |
Linux Kernel | tools/perf/util/bpf-loader.c |
static int bpf_map_config_foreach_key(struct bpf_map *map,
map_config_func_t func, void *arg) {
int err, map_fd, type;
struct bpf_map_op *op;
const char *name = bpf_map__name(map);
struct bpf_map_priv *priv = map_priv(map);
if (IS_ERR(priv)) {
pr_debug("ERROR: faile... | [
0,
0
] |
Linux Kernel | tools/perf/util/bpf-loader.c |
int bpf__apply_obj_config(void) {
struct bpf_perf_object *perf_obj, *tmp;
int err;
bpf_perf_object__for_each(perf_obj, tmp) {
err = apply_obj_config_object(perf_obj->obj);
if (err)
return err;
}
return 0;
}
#define bpf__perf_for_each_map(map, pobj, tmp) \
bp... | [
1,
0
] |
Linux Kernel | tools/perf/util/bpf-loader.c |
static int bpf_loader_strerror(int err, char *buf, size_t size) {
char sbuf[STRERR_BUFSIZE];
const char *msg;
if (!buf || !size)
return -1;
err = err > 0 ? err : -err;
if (err >= __LIBBPF_ERRNO__START)
return libbpf_strerror(err, buf, size);
if (err >= __BPF_LOADER_ERRNO__START && err < __BPF_L... | [
1,
0
] |
Linux Kernel | tools/perf/util/bpf-loader.c |
int bpf__strerror_prepare_load(const char *filename, bool source, int err,
char *buf, size_t size) {
size_t n;
int ret;
n = snprintf(buf, size, "Failed to load %s%s: ", filename,
source ? " from source" : "");
if (n >= size) {
buf[size - 1] = '\0';
return ... | [
0,
0
] |
Linux Kernel | tools/perf/util/bpf-loader.c |
int bpf__strerror_setup_output_event(struct evlist *evlist __maybe_unused,
int err, char *buf, size_t size) {
bpf__strerror_head(err, buf, size);
bpf__strerror_end(buf, size);
return 0;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/bpf-loader.h |
static inline int
bpf__strerror_config_obj(struct bpf_object *obj __maybe_unused,
struct parse_events_term *term __maybe_unused,
struct evlist *evlist __maybe_unused,
int *error_pos __maybe_unused, int err __maybe_unused,
... | [
0,
0
] |
Linux Kernel | tools/perf/util/bpf-prologue.c | static int gen_read_mem(struct bpf_insn_pos *pos, int src_base_addr_reg,
int dst_addr_reg, long offset, int probeid) {
if (src_base_addr_reg != BPF_REG_ARG3)
ins(BPF_MOV64_REG(BPF_REG_ARG3, src_base_addr_reg), pos);
/* add arg3, #offset */
if (offset)
ins(BPF_ALU64_IMM(BPF_ADD, BP... | [
0,
0
] |
Linux Kernel | tools/perf/util/bpf-prologue.c |
static int prologue_relocate(struct bpf_insn_pos *pos,
struct bpf_insn *error_code,
struct bpf_insn *success_code,
struct bpf_insn *user_code) {
struct bpf_insn *insn;
if (check_pos(pos))
return -BPF_LOADER_ERRNO__PROLOGUE2... | [
0,
0
] |
Linux Kernel | tools/perf/util/bpf-prologue.h |
static inline int bpf__gen_prologue(struct probe_trace_arg *args __maybe_unused,
int nargs __maybe_unused,
struct bpf_insn *new_prog __maybe_unused,
size_t *new_cnt,
size_t cn... | [
0,
0
] |
Linux Kernel | tools/perf/util/bpf-utils.c |
static void bpf_prog_info_set_offset_u64(struct bpf_prog_info *info, int offset,
__u64 val) {
__u64 *array = (__u64 *)info;
if (offset >= 0)
array[offset / sizeof(__u64)] = val;
} | [
1,
0
] |
Linux Kernel | tools/perf/util/bpf_counter.c |
static int bpf_program_profiler__disable(struct evsel *evsel) {
struct bpf_counter *counter;
list_for_each_entry(counter, &evsel->bpf_counter_list, list) {
assert(counter->skel != NULL);
bpf_prog_profiler_bpf__detach(counter->skel);
}
return 0;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/bpf_counter.c | static int bpf_program_profiler__read(struct evsel *evsel) {
// Sometimes possible > online, like on a Ryzen 3900X that has 24
// threads but its possible showed 0-31 -acme
int num_cpu_bpf = libbpf_num_possible_cpus();
struct bpf_perf_event_value values[num_cpu_bpf];
struct bpf_counter *counter;
struct per... | [
0,
0
] |
Linux Kernel | tools/perf/util/bpf_counter.c |
static bool bperf_attr_map_compatible(int attr_map_fd) {
struct bpf_map_info map_info = {0};
__u32 map_info_len = sizeof(map_info);
int err;
err = bpf_obj_get_info_by_fd(attr_map_fd, &map_info, &map_info_len);
if (err)
return false;
return (map_info.key_size == sizeof(struct perf_event_attr)) &&
... | [
1,
0
] |
Linux Kernel | tools/perf/util/bpf_counter.c |
static int bperf__enable(struct evsel *evsel) {
evsel->follower_skel->bss->enabled = 1;
return 0;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/bpf_counter.c |
static int bperf__disable(struct evsel *evsel) {
evsel->follower_skel->bss->enabled = 0;
return 0;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/bpf_counter.c |
static inline bool bpf_counter_skip(struct evsel *evsel) {
return list_empty(&evsel->bpf_counter_list) && evsel->follower_skel == NULL;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/bpf_counter.c |
int bpf_counter__load(struct evsel *evsel, struct target *target) {
if (target->bpf_str)
evsel->bpf_counter_ops = &bpf_program_profiler_ops;
else if (cgrp_event_expanded && target->use_bpf)
evsel->bpf_counter_ops = &bperf_cgrp_ops;
else if (target->use_bpf || evsel->bpf_counter ||
evsel__match... | [
1,
0
] |
Linux Kernel | tools/perf/util/bpf_counter.c |
int bpf_counter__enable(struct evsel *evsel) {
if (bpf_counter_skip(evsel))
return 0;
return evsel->bpf_counter_ops->enable(evsel);
} | [
0,
0
] |
Linux Kernel | tools/perf/util/bpf_counter.h |
static inline int bpf_counter__load(struct evsel *evsel __maybe_unused,
struct target *target __maybe_unused) {
return 0;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/bpf_counter.h |
static inline int bpf_counter__enable(struct evsel *evsel __maybe_unused) {
return 0;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/bpf_counter.h |
static inline __u32 bpf_link_get_prog_id(int fd) {
struct bpf_link_info link_info = {
.id = 0,
};
__u32 link_info_len = sizeof(link_info);
bpf_obj_get_info_by_fd(fd, &link_info, &link_info_len);
return link_info.prog_id;
} | [
1,
0
] |
Linux Kernel | tools/perf/util/bpf_counter.h |
static inline __u32 bpf_map_get_id(int fd) {
struct bpf_map_info map_info = {
.id = 0,
};
__u32 map_info_len = sizeof(map_info);
bpf_obj_get_info_by_fd(fd, &map_info, &map_info_len);
return map_info.id;
} | [
1,
0
] |
Linux Kernel | tools/perf/util/bpf_counter.h | static inline int bperf_trigger_reading(int prog_fd, int cpu) {
DECLARE_LIBBPF_OPTS(bpf_test_run_opts, opts, .ctx_in = NULL, .ctx_size_in = 0,
.flags = BPF_F_TEST_RUN_ON_CPU, .cpu = cpu,
.retval = 0, );
return bpf_prog_test_run_opts(prog_fd, &opts);
} | [
0,
0
] |
Linux Kernel | tools/perf/util/bpf_counter_cgroup.c |
static int bperf_cgrp__disable(struct evsel *evsel) {
if (evsel->core.idx)
return 0;
bperf_cgrp__sync_counters(evsel->evlist);
skel->bss->enabled = 0;
return 0;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/bpf_counter_cgroup.c |
static int bperf_cgrp__read(struct evsel *evsel) {
struct evlist *evlist = evsel->evlist;
int total_cpus = cpu__max_cpu().cpu;
struct perf_counts_values *counts;
struct bpf_perf_event_value *values;
int reading_map_fd, err = 0;
if (evsel->core.idx)
return 0;
bperf_cgrp__sync_counters(evsel->evlist)... | [
1,
0
] |
Linux Kernel | tools/perf/util/bpf_ftrace.c |
int perf_ftrace__latency_read_bpf(struct perf_ftrace *ftrace __maybe_unused,
int buckets[]) {
int i, fd, err;
u32 idx;
u64 *hist;
int ncpus = cpu__max_cpu().cpu;
fd = bpf_map__fd(skel->maps.latency);
hist = calloc(ncpus, sizeof(*hist));
if (hist == NULL)
return -EN... | [
1,
0
] |
Linux Kernel | tools/perf/util/bpf_ftrace.c |
int perf_ftrace__latency_cleanup_bpf(
struct perf_ftrace *ftrace __maybe_unused) {
func_latency_bpf__destroy(skel);
return 0;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/bpf_kwork.c |
void perf_kwork__trace_start(void) {
clock_gettime(CLOCK_MONOTONIC, &ts_start);
skel->bss->enabled = 1;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/bpf_kwork.c |
static void softirq_load_prepare(struct perf_kwork *kwork) {
if (kwork->report == KWORK_REPORT_RUNTIME) {
bpf_program__set_autoload(skel->progs.report_softirq_entry, true);
bpf_program__set_autoload(skel->progs.report_softirq_exit, true);
} else if (kwork->report == KWORK_REPORT_LATENCY) {
bpf_program_... | [
0,
0
] |
Linux Kernel | tools/perf/util/bpf_kwork.c | int perf_kwork__trace_prepare_bpf(struct perf_kwork *kwork) {
struct bpf_program *prog;
struct kwork_class *class;
struct kwork_class_bpf *class_bpf;
enum kwork_class_type type;
skel = kwork_trace_bpf__open();
if (!skel) {
pr_debug("Failed to open kwork trace skeleton\n");
return -1;
}
bpf_obj... | [
0,
0
] |
Linux Kernel | tools/perf/util/bpf_kwork.c |
int perf_kwork__report_read_bpf(struct perf_kwork *kwork) {
struct report_data data;
struct work_key key = {
.type = 0,
.cpu = 0,
.id = 0,
};
struct work_key prev = {
.type = 0,
.cpu = 0,
.id = 0,
};
int fd = bpf_map__fd(skel->maps.perf_kwork_report);
if (fd < 0) {
... | [
0,
0
] |
Linux Kernel | tools/perf/util/bpf_kwork.c |
void perf_kwork__report_cleanup_bpf(void) { kwork_trace_bpf__destroy(skel); } | [
0,
0
] |
Linux Kernel | tools/perf/util/bpf_lock_contention.c |
int lock_contention_start(void) {
skel->bss->enabled = 1;
return 0;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/bpf_map.h |
static inline int bpf_map__fprintf(struct bpf_map *map __maybe_unused,
FILE *fp __maybe_unused) {
return 0;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/bpf_off_cpu.c | static void check_sched_switch_args(void) {
const struct btf *btf = bpf_object__btf(skel->obj);
const struct btf_type *t1, *t2, *t3;
u32 type_id;
type_id =
btf__find_by_name_kind(btf, "bpf_trace_sched_switch", BTF_KIND_TYPEDEF);
if ((s32)type_id < 0)
return;
t1 = btf__type_by_id(btf, type_id);
... | [
0,
0
] |
Linux Kernel | tools/perf/util/bpf_skel/bperf_cgroup.bpf.c | static inline __u64 get_cgroup_v1_ancestor_id(struct cgroup *cgrp, int level) {
struct cgroup___new *cgrp_new = (void *)cgrp;
if (bpf_core_field_exists(cgrp_new->ancestors)) {
return BPF_CORE_READ(cgrp_new, ancestors[level], kn, id);
} else {
/* recast pointer to capture old type for compiler */
str... | [
0,
0
] |
Linux Kernel | tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c | int BPF_PROG(fentry_XXX) {
__u32 key = bpf_get_smp_processor_id();
struct bpf_perf_event_value *ptr;
__u32 zero = 0;
long err;
ptr = bpf_map_lookup_elem(&fentry_readings, &zero);
if (!ptr)
return 0;
err = bpf_perf_event_read_value(&events, key, ptr, sizeof(*ptr));
if (err)
return 0;
return ... | [
1,
0
] |
Linux Kernel | tools/perf/util/bpf_skel/kwork_trace.bpf.c |
static __always_inline void do_update_time(void *map, struct work_key *key,
__u64 time_start, __u64 time_end) {
struct report_data zero, *data;
__s64 delta = time_end - time_start;
if (delta < 0)
return;
data = bpf_map_lookup_elem(map, key);
if (!data) {
_... | [
1,
0
] |
Linux Kernel | tools/perf/util/bpf_skel/kwork_trace.bpf.c |
static __always_inline int
update_timeend_and_name(void *report_map, void *time_map, void *names_map,
struct work_key *key, char *name) {
if (!trace_event_match(key, name))
return 0;
do_update_timeend(report_map, time_map, key);
do_update_name(names_map, key, name);
return 0;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/bpf_skel/kwork_trace.bpf.c | int report_irq_handler_entry(struct trace_event_raw_irq_handler_entry *ctx) {
char name[MAX_KWORKNAME];
struct work_key key = {
.type = KWORK_CLASS_IRQ,
.cpu = bpf_get_smp_processor_id(),
.id = (__u64)ctx->irq,
};
void *name_addr = (void *)ctx + (ctx->__data_loc_name & 0xffff);
bpf_probe_re... | [
1,
0
] |
Linux Kernel | tools/perf/util/bpf_skel/kwork_trace.bpf.c | int report_irq_handler_exit(struct trace_event_raw_irq_handler_exit *ctx) {
struct work_key key = {
.type = KWORK_CLASS_IRQ,
.cpu = bpf_get_smp_processor_id(),
.id = (__u64)ctx->irq,
};
return update_timeend(&perf_kwork_report, &perf_kwork_time, &key);
} | [
0,
0
] |
Linux Kernel | tools/perf/util/bpf_skel/kwork_trace.bpf.c | int latency_workqueue_activate_work(
struct trace_event_raw_workqueue_activate_work *ctx) {
struct work_key key = {
.type = KWORK_CLASS_WORKQUEUE,
.cpu = bpf_get_smp_processor_id(),
.id = (__u64)ctx->work,
};
return update_timestart(&perf_kwork_time, &key);
} | [
0,
0
] |
Linux Kernel | tools/perf/util/bpf_skel/lock_contention.bpf.c | int contention_end(u64 *ctx) {
struct task_struct *curr;
struct tstamp_data *pelem;
struct contention_key key;
struct contention_data *data;
__u64 duration;
if (!enabled)
return 0;
curr = bpf_get_current_task_btf();
pelem = bpf_task_storage_get(&tstamp, curr, NULL, 0);
if (!pelem || pelem->lock ... | [
1,
1
] |
Linux Kernel | tools/perf/util/bpf_skel/off_cpu.bpf.c |
static inline __u64 get_cgroup_id(struct task_struct *t) {
struct cgroup *cgrp;
if (!uses_cgroup_v1)
return BPF_CORE_READ(t, cgroups, dfl_cgrp, kn, id);
if (perf_subsys_id == -1) {
#if __has_builtin(__builtin_preserve_enum_value)
perf_subsys_id =
bpf_core_enum_value(enum cgroup_subsys_id, perf_... | [
0,
0
] |
Linux Kernel | tools/perf/util/bpf_skel/off_cpu.bpf.c | int on_switch(u64 *ctx) {
struct task_struct *prev, *next;
int prev_state;
if (!enabled)
return 0;
prev = (struct task_struct *)ctx[1];
next = (struct task_struct *)ctx[2];
if (has_prev_state)
prev_state = (int)ctx[3];
else
prev_state = get_task_state(prev);
return off_cpu_stat(ctx, prev... | [
0,
0
] |
Linux Kernel | tools/perf/util/build-id.c |
int build_id__mark_dso_hit(struct perf_tool *tool __maybe_unused,
union perf_event *event, struct perf_sample *sample,
struct evsel *evsel __maybe_unused,
struct machine *machine) {
struct addr_location al;
struct thread *thread =
... | [
0,
0
] |
Linux Kernel | tools/perf/util/build-id.c | static int asnprintf(char **strp, size_t size, const char *fmt, ...) {
va_list ap;
int ret;
if (!strp)
return -EINVAL;
va_start(ap, fmt);
if (*strp)
ret = vsnprintf(*strp, size, fmt, ap);
else
ret = vasprintf(strp, fmt, ap);
va_end(ap);
return ret;
} | [
1,
0
] |
Linux Kernel | tools/perf/util/build-id.c |
char *build_id_cache__linkname(const char *sbuild_id, char *bf, size_t size) {
char *tmp = bf;
int ret = asnprintf(&bf, size, "%s/.build-id/%.2s/%s", buildid_dir, sbuild_id,
sbuild_id + 2);
if (ret < 0 || (tmp && size < (unsigned int)ret))
return NULL;
return bf;
} | [
1,
0
] |
Linux Kernel | tools/perf/util/build-id.c |
static int machine__write_buildid_table(struct machine *machine,
struct feat_fd *fd) {
int err = 0;
struct dso *pos;
u16 kmisc = PERF_RECORD_MISC_KERNEL, umisc = PERF_RECORD_MISC_USER;
if (!machine__is_host(machine)) {
kmisc = PERF_RECORD_MISC_GUEST_KERNEL;
umis... | [
0,
0
] |
Linux Kernel | tools/perf/util/build-id.c |
static int machine__hit_all_dsos(struct machine *machine) {
return __dsos__hit_all(&machine->dsos.head);
} | [
0,
0
] |
Linux Kernel | tools/perf/util/build-id.c |
static bool lsdir_bid_head_filter(const char *name __maybe_unused,
struct dirent *d) {
return (strlen(d->d_name) == 2) && isxdigit(d->d_name[0]) &&
isxdigit(d->d_name[1]);
} | [
0,
0
] |
Linux Kernel | tools/perf/util/build-id.c |
static int machines__for_each_dso(struct machines *machines, machine__dso_t fn,
void *priv) {
int ret = machine__for_each_dso(&machines->host, fn, priv);
struct rb_node *nd;
for (nd = rb_first_cached(&machines->guests); nd; nd = rb_next(nd)) {
struct machine *pos = rb_entry... | [
0,
0
] |
Linux Kernel | tools/perf/util/build-id.c |
void build_id__init(struct build_id *bid, const u8 *data, size_t size) {
WARN_ON(size > BUILD_ID_SIZE);
memcpy(bid->data, data, size);
bid->size = size;
} | [
1,
0
] |
Linux Kernel | tools/perf/util/build-id.c |
bool build_id__is_defined(const struct build_id *bid) {
return bid && bid->size ? !!memchr_inv(bid->data, 0, bid->size) : false;
} | [
1,
0
] |
Linux Kernel | tools/perf/util/build-id.h | static inline int build_id_cache__add_s(const char *sbuild_id, const char *name,
struct nsinfo *nsi, bool is_kallsyms,
bool is_vdso) {
return __build_id_cache__add_s(sbuild_id, name, nsi, is_kallsyms, is_vdso,
... | [
0,
0
] |
Linux Kernel | tools/perf/util/cache.h |
static inline int is_absolute_path(const char *path) { return path[0] == '/'; } | [
0,
0
] |
Linux Kernel | tools/perf/util/cacheline.c |
int cacheline_size(void) {
static int size;
if (!size)
cache_line_size(&size);
return size;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/cacheline.h | static inline u64 cl_address(u64 address) {
return (address & ~(cacheline_size() - 1));
} | [
0,
0
] |
Linux Kernel | tools/perf/util/cacheline.h | static inline u64 cl_offset(u64 address) {
return (address & (cacheline_size() - 1));
} | [
0,
0
] |
Linux Kernel | tools/perf/util/call-path.c |
struct call_path_root *call_path_root__new(void) {
struct call_path_root *cpr;
cpr = zalloc(sizeof(struct call_path_root));
if (!cpr)
return NULL;
call_path__init(&cpr->call_path, NULL, NULL, 0, false);
INIT_LIST_HEAD(&cpr->blocks);
return cpr;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/call-path.c |
void call_path_root__free(struct call_path_root *cpr) {
struct call_path_block *pos, *n;
list_for_each_entry_safe(pos, n, &cpr->blocks, node) {
list_del_init(&pos->node);
free(pos);
}
free(cpr);
} | [
1,
0
] |
Linux Kernel | tools/perf/util/callchain.c |
static int get_stack_size(const char *str, unsigned long *_size) {
char *endptr;
unsigned long size;
unsigned long max_size = round_down(USHRT_MAX, sizeof(u64));
size = strtoul(str, &endptr, 0);
do {
if (*endptr)
break;
size = round_up(size, sizeof(u64));
if (!size || size > max_size)
... | [
1,
0
] |
Linux Kernel | tools/perf/util/callchain.c | static int __parse_callchain_report_opt(const char *arg,
bool allow_record_opt) {
char *tok;
char *endptr, *saveptr = NULL;
bool minpcnt_set = false;
bool record_opt_set = false;
bool try_stack_size = false;
callchain_param.enabled = true;
symbol_conf.use_callchain... | [
1,
0
] |
Linux Kernel | tools/perf/util/callchain.c |
int parse_callchain_top_opt(const char *arg) {
return __parse_callchain_report_opt(arg, true);
} | [
0,
0
] |
Linux Kernel | tools/perf/util/callchain.c | static void sort_chain_flat(struct rb_root *rb_root,
struct callchain_root *root, u64 min_hit,
struct callchain_param *param __maybe_unused) {
*rb_root = RB_ROOT;
__sort_chain_flat(rb_root, &root->node, min_hit);
} | [
0,
0
] |
Linux Kernel | tools/perf/util/callchain.c |
static void __sort_chain_graph_abs(struct callchain_node *node, u64 min_hit) {
struct rb_node *n;
struct callchain_node *child;
node->rb_root = RB_ROOT;
n = rb_first(&node->rb_root_in);
while (n) {
child = rb_entry(n, struct callchain_node, rb_node_in);
n = rb_next(n);
__sort_chain_graph_abs(c... | [
0,
0
] |
Linux Kernel | tools/perf/util/callchain.c |
static void sort_chain_graph_rel(struct rb_root *rb_root,
struct callchain_root *chain_root,
u64 min_hit __maybe_unused,
struct callchain_param *param) {
__sort_chain_graph_rel(&chain_root->node, param->min_percent / 1... | [
0,
0
] |
Linux Kernel | tools/perf/util/callchain.c | static int fill_node(struct callchain_node *node,
struct callchain_cursor *cursor) {
struct callchain_cursor_node *cursor_node;
node->val_nr = cursor->nr - cursor->pos;
if (!node->val_nr)
pr_warning("Warning: empty node in callchain tree\n");
cursor_node = callchain_cursor_current(cur... | [
1,
0
] |
Linux Kernel | tools/perf/util/callchain.c | static enum match_result match_chain_dso_addresses(struct map *left_map,
u64 left_ip,
struct map *right_map,
u64 right_ip) {
struct dso *left_dso = left_map ? left_m... | [
0,
0
] |
Linux Kernel | tools/perf/util/callchain.c | static int append_chain_children(struct callchain_node *root,
struct callchain_cursor *cursor, u64 period) {
struct callchain_node *rnode;
struct callchain_cursor_node *node;
struct rb_node **p = &root->rb_root_in.rb_node;
struct rb_node *parent = NULL;
node = callchain_curso... | [
0,
0
] |
Linux Kernel | tools/perf/util/callchain.c |
static int merge_chain_branch(struct callchain_cursor *cursor,
struct callchain_node *dst,
struct callchain_node *src) {
struct callchain_cursor_node **old_last = cursor->last;
struct callchain_node *child;
struct callchain_list *list, *next_list;
str... | [
1,
0
] |
Linux Kernel | tools/perf/util/callchain.c |
char *callchain_node__scnprintf_value(struct callchain_node *node, char *bf,
size_t bfsize, u64 total) {
double percent = 0.0;
u64 period = callchain_cumul_hits(node);
unsigned count = callchain_cumul_counts(node);
if (callchain_param.mode == CHAIN_FOLDED) {
period = ... | [
1,
0
] |
Linux Kernel | tools/perf/util/callchain.c |
static int callchain_node_branch_counts_cumul(struct callchain_node *node,
u64 *branch_count,
u64 *predicted_count,
u64 *abort_count,
u... | [
0,
0
] |
Linux Kernel | tools/perf/util/callchain.c |
static int count_float_printf(int idx, const char *str, float value, char *bf,
int bfsize, float threshold) {
if (threshold != 0.0 && value < threshold)
return 0;
return scnprintf(bf, bfsize, "%s%s:%.1f%%", (idx) ? " " : " (", str, value);
} | [
1,
0
] |
Linux Kernel | tools/perf/util/callchain.c |
static void free_callchain_node(struct callchain_node *node) {
struct callchain_list *list, *tmp;
struct callchain_node *child;
struct rb_node *n;
list_for_each_entry_safe(list, tmp, &node->parent_val, list) {
list_del_init(&list->list);
map__zput(list->ms.map);
free(list);
}
list_for_each_en... | [
1,
0
] |
Linux Kernel | tools/perf/util/callchain.c |
void decay_callchain(struct callchain_root *root) {
if (!symbol_conf.use_callchain)
return;
decay_callchain_node(&root->node);
} | [
0,
0
] |
Linux Kernel | tools/perf/util/callchain.c |
int callchain_node__make_parent_list(struct callchain_node *node) {
struct callchain_node *parent = node->parent;
struct callchain_list *chain, *new;
LIST_HEAD(head);
while (parent) {
list_for_each_entry_reverse(chain, &parent->val, list) {
new = malloc(sizeof(*new));
if (new == NULL)
... | [
1,
0
] |
Linux Kernel | tools/perf/util/callchain.c |
int callchain_cursor__copy(struct callchain_cursor *dst,
struct callchain_cursor *src) {
int rc = 0;
callchain_cursor_reset(dst);
callchain_cursor_commit(src);
while (true) {
struct callchain_cursor_node *node;
node = callchain_cursor_current(src);
if (node == NULL)
... | [
0,
0
] |
Linux Kernel | tools/perf/util/callchain.c | void callchain_param_setup(u64 sample_type, const char *arch) {
if (symbol_conf.use_callchain || symbol_conf.cumulate_callchain) {
if ((sample_type & PERF_SAMPLE_REGS_USER) &&
(sample_type & PERF_SAMPLE_STACK_USER)) {
callchain_param.record_mode = CALLCHAIN_DWARF;
dwarf_callchain_users = true;... | [
0,
0
] |
Linux Kernel | tools/perf/util/callchain.c | bool callchain_cnode_matched(struct callchain_node *base_cnode,
struct callchain_node *pair_cnode) {
struct callchain_list *base_chain, *pair_chain;
bool match = false;
pair_chain = list_first_entry(&pair_cnode->val, struct callchain_list, list);
list_for_each_entry(base_chain, &b... | [
0,
0
] |
Linux Kernel | tools/perf/util/callchain.c |
static u64 count_callchain_hits(struct hist_entry *he) {
struct rb_root *root = &he->sorted_chain;
struct rb_node *rb_node = rb_first(root);
struct callchain_node *node;
u64 chain_hits = 0;
while (rb_node) {
node = rb_entry(rb_node, struct callchain_node, rb_node);
chain_hits += node->hit;
rb_no... | [
0,
0
] |
Linux Kernel | tools/perf/util/callchain.c |
u64 callchain_total_hits(struct hists *hists) {
struct rb_node *next = rb_first_cached(&hists->entries);
u64 chain_hits = 0;
while (next) {
struct hist_entry *he = rb_entry(next, struct hist_entry, rb_node);
chain_hits += count_callchain_hits(he);
next = rb_next(&he->rb_node);
}
return chain_h... | [
0,
0
] |
Linux Kernel | tools/perf/util/callchain.h |
static inline unsigned callchain_cumul_counts(struct callchain_node *node) {
return node->count + node->children_count;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/callchain.h | static inline struct callchain_cursor_node *
callchain_cursor_current(struct callchain_cursor *cursor) {
if (cursor->pos == cursor->nr)
return NULL;
return cursor->curr;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/callchain.h |
static inline void callchain_cursor_snapshot(struct callchain_cursor *dest,
struct callchain_cursor *src) {
*dest = *src;
dest->first = src->curr;
dest->nr -= src->pos;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/cgroup.c |
static int open_cgroup(const char *name) {
char path[PATH_MAX + 1];
char mnt[PATH_MAX + 1];
int fd;
if (cgroupfs_find_mountpoint(mnt, PATH_MAX + 1, "perf_event"))
return -1;
scnprintf(path, PATH_MAX, "%s/%s", mnt, name);
fd = open(path, O_RDONLY);
if (fd == -1)
fprintf(stderr, "no access to cg... | [
0,
0
] |
Linux Kernel | tools/perf/util/cgroup.c |
static struct cgroup *cgroup__new(const char *name, bool do_open) {
struct cgroup *cgroup = zalloc(sizeof(*cgroup));
if (cgroup != NULL) {
refcount_set(&cgroup->refcnt, 1);
cgroup->name = strdup(name);
if (!cgroup->name)
goto out_err;
if (do_open) {
cgroup->fd = open_cgroup(name);
... | [
1,
0
] |
Linux Kernel | tools/perf/util/cgroup.c |
struct cgroup *cgroup__get(struct cgroup *cgroup) {
if (cgroup)
refcount_inc(&cgroup->refcnt);
return cgroup;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/cgroup.c | static int match_cgroups(const char *str) {
char mnt[PATH_MAX];
const char *p, *e, *eos = str + strlen(str);
struct cgroup_name *cn;
regex_t reg;
int prefix_len;
char *s;
if (cgroupfs_find_mountpoint(mnt, sizeof(mnt), "perf_event"))
return -1;
prefix_len = strlen(mnt);
/* collect all cgroups in... | [
1,
0
] |
Linux Kernel | tools/perf/util/cgroup.h | static inline int read_cgroup_id(struct cgroup *cgrp __maybe_unused) {
return -1;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/cloexec.c |
int __weak sched_getcpu(void) {
#ifdef __NR_getcpu
unsigned cpu;
int err = syscall(__NR_getcpu, &cpu, NULL, NULL);
if (!err)
return cpu;
#else
errno = ENOSYS;
#endif
return -1;
} | [
0,
0
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.