Projectname large_stringclasses 15
values | Filepath large_stringlengths 4 106 ⌀ | Function large_stringlengths 11 3.45k | Label list |
|---|---|---|---|
Linux Kernel | tools/perf/util/pmu.c |
static int perf_pmu__parse_unit(struct perf_pmu_alias *alias, char *dir,
char *name) {
char path[PATH_MAX];
ssize_t sret;
int fd;
scnprintf(path, PATH_MAX, "%s/%s.unit", dir, name);
fd = open(path, O_RDONLY);
if (fd == -1)
return -1;
sret = read(fd, alias->unit, UNI... | [
0,
0
] |
Linux Kernel | tools/perf/util/pmu.c |
static int perf_pmu__parse_snapshot(struct perf_pmu_alias *alias, char *dir,
char *name) {
char path[PATH_MAX];
int fd;
scnprintf(path, PATH_MAX, "%s/%s.snapshot", dir, name);
fd = open(path, O_RDONLY);
if (fd == -1)
return -1;
alias->snapshot = true;
close(fd);... | [
0,
0
] |
Linux Kernel | tools/perf/util/pmu.c | static void perf_pmu_assign_str(char *name, const char *field, char **old_str,
char **new_str) {
if (!*old_str)
goto set_new;
if (*new_str) {
if (strcasecmp(*old_str, *new_str))
pr_debug("alias %s differs in field '%s'\n", name, field);
zfree(old_str);
} else /* ... | [
0,
0
] |
Linux Kernel | tools/perf/util/pmu.c |
static void perf_pmu_update_alias(struct perf_pmu_alias *old,
struct perf_pmu_alias *newalias) {
perf_pmu_assign_str(old->name, "desc", &old->desc, &newalias->desc);
perf_pmu_assign_str(old->name, "long_desc", &old->long_desc,
&newalias->long_desc);
perf_pm... | [
1,
0
] |
Linux Kernel | tools/perf/util/pmu.c | static int perf_pmu__new_alias(struct list_head *list, char *dir, char *name,
FILE *file) {
char buf[256];
int ret;
ret = fread(buf, 1, sizeof(buf), file);
if (ret == 0)
return -EINVAL;
buf[ret] = 0;
strim(buf);
return __perf_pmu__new_alias(list, dir, name, NULL, buf... | [
1,
0
] |
Linux Kernel | tools/perf/util/pmu.c | static int pmu_aliases_parse(char *dir, struct list_head *head) {
struct dirent *evt_ent;
DIR *event_dir;
event_dir = opendir(dir);
if (!event_dir)
return -EINVAL;
while ((evt_ent = readdir(event_dir))) {
char path[PATH_MAX];
char *name = evt_ent->d_name;
FILE *file;
if (!strcmp(name, "... | [
1,
0
] |
Linux Kernel | tools/perf/util/pmu.c | static struct perf_cpu_map *__pmu_cpumask(const char *path) {
FILE *file;
struct perf_cpu_map *cpus;
file = fopen(path, "r");
if (!file)
return NULL;
cpus = perf_cpu_map__read(file);
fclose(file);
return cpus;
} | [
1,
0
] |
Linux Kernel | tools/perf/util/pmu.c | static char *pmu_id(const char *name) {
char path[PATH_MAX], *str;
size_t len;
snprintf(path, PATH_MAX, SYS_TEMPLATE_ID, name);
if (sysfs__read_str(path, &str, &len) < 0)
return NULL;
str[len - 1] = 0;
return str;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/pmu.c | static int is_arm_pmu_core(const char *name) {
char path[PATH_MAX];
const char *sysfs = sysfs__mountpoint();
if (!sysfs)
return 0;
scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/%s/cpus", sysfs, name);
return file_available(path);
} | [
0,
0
] |
Linux Kernel | tools/perf/util/pmu.c | bool pmu_uncore_alias_match(const char *pmu_name, const char *name) {
char *tmp = NULL, *tok, *str;
bool res;
str = strdup(pmu_name);
if (!str)
return false;
tok = strtok_r(str, ",", &tmp);
if (strncmp(pmu_name, tok, strlen(tok))) {
res = false;
goto out;
}
/*
* Match more complex alia... | [
1,
0
] |
Linux Kernel | tools/perf/util/pmu.c |
void pmu_add_sys_aliases(struct list_head *head, struct perf_pmu *pmu) {
struct pmu_sys_event_iter_data idata = {
.head = head,
.pmu = pmu,
};
if (!pmu->id)
return;
pmu_for_each_sys_event(pmu_add_sys_aliases_iter_fn, &idata);
} | [
0,
0
] |
Linux Kernel | tools/perf/util/pmu.c |
static int pmu_max_precise(const char *name) {
char path[PATH_MAX];
int max_precise = -1;
scnprintf(path, PATH_MAX, "bus/event_source/devices/%s/caps/max_precise",
name);
sysfs__read_int(path, &max_precise);
return max_precise;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/pmu.c | void perf_pmu__warn_invalid_formats(struct perf_pmu *pmu) {
struct perf_pmu_format *format;
if (pmu == &perf_pmu__fake)
return;
list_for_each_entry(format, &pmu->format,
list) if (format->value >=
PERF_PMU_FORMAT_VALUE_CONFIG_END) {
pr_warning("WARNI... | [
0,
0
] |
Linux Kernel | tools/perf/util/pmu.c |
static __u64 pmu_format_max_value(const unsigned long *format) {
int w;
w = bitmap_weight(format, PERF_PMU_FORMAT_BITS);
if (!w)
return 0;
if (w < 64)
return (1ULL << w) - 1;
return -1;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/pmu.c | static char *pmu_formats_string(struct list_head *formats) {
struct perf_pmu_format *format;
char *str = NULL;
struct strbuf buf = STRBUF_INIT;
unsigned int i = 0;
if (!formats)
return NULL;
list_for_each_entry(format, formats,
list) if (strbuf_addf(&buf, i++ ? ",%s" : "%s",
... | [
1,
0
] |
Linux Kernel | tools/perf/util/pmu.c |
int perf_pmu__config_terms(const char *pmu_name, struct list_head *formats,
struct perf_event_attr *attr,
struct list_head *head_terms, bool zero,
struct parse_events_error *err) {
struct parse_events_term *term;
list_for_each_entry(... | [
0,
0
] |
Linux Kernel | tools/perf/util/pmu.c |
static char *format_alias(char *buf, int len, struct perf_pmu *pmu,
struct perf_pmu_alias *alias) {
struct parse_events_term *term;
int used = snprintf(buf, len, "%s/%s", pmu->name, alias->name);
list_for_each_entry(term, &alias->terms, list) {
if (term->type_val == PARSE_EVENTS__T... | [
1,
0
] |
Linux Kernel | tools/perf/util/pmu.c | static int cmp_sevent(const void *a, const void *b) {
const struct sevent *as = a;
const struct sevent *bs = b;
int ret;
if (!!as->desc != !!bs->desc)
return !!as->desc - !!bs->desc;
if (as->topic && bs->topic) {
int n = strcmp(as->topic, bs->topic);
if (n)
return n;
}
/* Order CPU co... | [
1,
0
] |
Linux Kernel | tools/perf/util/pmu.c | int perf_pmu__caps_parse(struct perf_pmu *pmu) {
struct stat st;
char caps_path[PATH_MAX];
const char *sysfs = sysfs__mountpoint();
DIR *caps_dir;
struct dirent *evt_ent;
if (pmu->caps_initialized)
return pmu->nr_caps;
pmu->nr_caps = 0;
if (!sysfs)
return -1;
snprintf(caps_path, PATH_MAX, ... | [
1,
0
] |
Linux Kernel | tools/perf/util/pmu.c |
bool perf_pmu__has_hybrid(void) {
if (!hybrid_scanned) {
hybrid_scanned = true;
perf_pmu__scan(NULL);
}
return !list_empty(&perf_pmu__hybrid_pmus);
} | [
0,
0
] |
Linux Kernel | tools/perf/util/print_binary.c |
int binary__fprintf(unsigned char *data, size_t len, size_t bytes_per_line,
binary__fprintf_t printer, void *extra, FILE *fp) {
size_t i, j, mask;
int printed = 0;
if (!printer)
return 0;
bytes_per_line = roundup_pow_of_two(bytes_per_line);
mask = bytes_per_line - 1;
printed += p... | [
1,
0
] |
Linux Kernel | tools/perf/util/probe-event.c |
static struct ref_reloc_sym *kernel_get_ref_reloc_sym(struct map **pmap) {
struct kmap *kmap;
struct map *map = machine__kernel_map(host_machine);
if (map__load(map) < 0)
return NULL;
kmap = map__kmap(map);
if (!kmap)
return NULL;
if (pmap)
*pmap = map;
return kmap->ref_reloc_sym;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/probe-event.c |
static void clear_perf_probe_point(struct perf_probe_point *pp) {
zfree(&pp->file);
zfree(&pp->function);
zfree(&pp->lazy_line);
} | [
0,
0
] |
Linux Kernel | tools/perf/util/probe-event.c |
static void clear_probe_trace_events(struct probe_trace_event *tevs,
int ntevs) {
int i;
for (i = 0; i < ntevs; i++)
clear_probe_trace_event(tevs + i);
} | [
0,
0
] |
Linux Kernel | tools/perf/util/probe-event.c |
static int get_alternative_probe_event(struct debuginfo *dinfo,
struct perf_probe_event *pev,
struct perf_probe_point *tmp) {
int ret;
memcpy(tmp, &pev->point, sizeof(*tmp));
memset(&pev->point, 0, sizeof(pev->point));
ret = find_al... | [
1,
0
] |
Linux Kernel | tools/perf/util/probe-event.c |
static int get_alternative_line_range(struct debuginfo *dinfo,
struct line_range *lr, const char *target,
bool user) {
struct perf_probe_point pp = {
.function = lr->function, .file = lr->file, .line = lr->start};
struct perf_probe_p... | [
1,
0
] |
Linux Kernel | tools/perf/util/probe-event.c | static struct debuginfo *open_from_debuginfod(struct dso *dso,
struct nsinfo *nsi, bool silent) {
debuginfod_client *c = debuginfod_begin();
char sbuild_id[SBUILD_ID_SIZE + 1];
struct debuginfo *ret = NULL;
struct nscookie nsc;
char *path;
int fd;
if (!c)
... | [
0,
0
] |
Linux Kernel | tools/perf/util/probe-event.c | static int
post_process_kernel_probe_trace_events(struct probe_trace_event *tevs,
int ntevs) {
struct ref_reloc_sym *reloc_sym;
struct map *map;
char *tmp;
int i, skipped = 0;
if (symbol_conf.ignore_vmlinux_buildid)
return post_process_offline_probe_trace_events(tev... | [
1,
0
] |
Linux Kernel | tools/perf/util/probe-event.c | static int post_process_probe_trace_events(struct perf_probe_event *pev,
struct probe_trace_event *tevs,
int ntevs, const char *module,
bool uprobe,
... | [
0,
0
] |
Linux Kernel | tools/perf/util/probe-event.c |
static int __show_one_line(FILE *fp, int l, bool skip, bool show_num) {
char buf[LINEBUF_SIZE], sbuf[STRERR_BUFSIZE];
const char *color = show_num ? "" : PERF_COLOR_BLUE;
const char *prefix = NULL;
do {
if (fgets(buf, LINEBUF_SIZE, fp) == NULL)
goto error;
if (skip)
continue;
if (!pref... | [
1,
0
] |
Linux Kernel | tools/perf/util/probe-event.c | int show_available_vars(struct perf_probe_event *pevs, int npevs,
struct strfilter *_filter) {
int i, ret = 0;
struct debuginfo *dinfo;
ret = init_probe_symbol_maps(pevs->uprobes);
if (ret < 0)
return ret;
dinfo = open_debuginfo(pevs->target, pevs->nsi, false);
if (!dinfo) {
... | [
1,
0
] |
Linux Kernel | tools/perf/util/probe-event.c |
static int
find_perf_probe_point_from_dwarf(struct probe_trace_point *tp __maybe_unused,
struct perf_probe_point *pp __maybe_unused,
bool is_kprobe __maybe_unused) {
return -ENOSYS;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/probe-event.c |
static int parse_perf_probe_event_name(char **arg,
struct perf_probe_event *pev) {
char *ptr;
ptr = strpbrk_esc(*arg, ":");
if (ptr) {
*ptr = '\0';
if (!pev->sdt && !is_c_func_name(*arg))
goto ng_name;
pev->group = strdup_esc(*arg);
if (!pev->group)
... | [
0,
0
] |
Linux Kernel | tools/perf/util/probe-event.c | bool perf_probe_with_var(struct perf_probe_event *pev) {
int i = 0;
for (i = 0; i < pev->nargs; i++)
if (is_c_varname(pev->args[i].var) ||
!strcmp(pev->args[i].var, PROBE_ARG_PARAMS) ||
!strcmp(pev->args[i].var, PROBE_ARG_VARS))
return true;
return false;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/probe-event.c |
char *synthesize_perf_probe_command(struct perf_probe_event *pev) {
struct strbuf buf;
char *tmp, *ret = NULL;
int i;
if (strbuf_init(&buf, 64))
return NULL;
if (pev->event)
if (strbuf_addf(&buf, "%s:%s=", pev->group ?: PERFPROBE_GROUP, pev->event) <
0)
goto out;
tmp = synthesize_pe... | [
1,
0
] |
Linux Kernel | tools/perf/util/probe-event.c | static int synthesize_probe_trace_arg(struct probe_trace_arg *arg,
struct strbuf *buf) {
struct probe_trace_arg_ref *ref = arg->ref;
int depth = 0, err;
if (arg->name)
err = strbuf_addf(buf, " %s=", arg->name);
else
err = strbuf_addch(buf, ' ');
if (err)
retu... | [
1,
1
] |
Linux Kernel | tools/perf/util/probe-event.c | static int synthesize_kprobe_trace_def(struct probe_trace_point *tp,
struct strbuf *buf) {
if (!strncmp(tp->symbol, "0x", 2)) {
return strbuf_addf(buf, "%s%s0x%" PRIx64, tp->module ?: "",
tp->module ? ":" : "", tp->address);
} else {
return strb... | [
1,
0
] |
Linux Kernel | tools/perf/util/probe-event.c |
char *synthesize_probe_trace_command(struct probe_trace_event *tev) {
struct probe_trace_point *tp = &tev->point;
struct strbuf buf;
char *ret = NULL;
int err;
if (strbuf_init(&buf, 32) < 0)
return NULL;
if (strbuf_addf(&buf, "%c:%s/%s ", tp->retprobe ? 'r' : 'p', tev->group,
tev->e... | [
1,
0
] |
Linux Kernel | tools/perf/util/probe-event.c |
static int convert_to_perf_probe_point(struct probe_trace_point *tp,
struct perf_probe_point *pp,
bool is_kprobe) {
char buf[128];
int ret;
ret = find_perf_probe_point_from_dwarf(tp, pp, is_kprobe);
if (!ret)
return 0;
ret = f... | [
0,
0
] |
Linux Kernel | tools/perf/util/probe-event.c | static int convert_to_perf_probe_event(struct probe_trace_event *tev,
struct perf_probe_event *pev,
bool is_kprobe) {
struct strbuf buf = STRBUF_INIT;
int i, ret;
pev->event = strdup(tev->event);
pev->group = strdup(tev->group);
if... | [
1,
0
] |
Linux Kernel | tools/perf/util/probe-event.c |
static void kprobe_blacklist__delete(struct list_head *blacklist) {
struct kprobe_blacklist_node *node;
while (!list_empty(blacklist)) {
node = list_first_entry(blacklist, struct kprobe_blacklist_node, list);
list_del_init(&node->list);
zfree(&node->symbol);
free(node);
}
} | [
1,
0
] |
Linux Kernel | tools/perf/util/probe-event.c | static int perf_probe_event__sprintf(const char *group, const char *event,
struct perf_probe_event *pev,
const char *module,
struct strbuf *result) {
int i, ret;
char *buf;
if (asprintf(&buf, "%s:%s", g... | [
1,
0
] |
Linux Kernel | tools/perf/util/probe-event.c | int show_perf_probe_events(struct strfilter *filter) {
int kp_fd, up_fd, ret;
setup_pager();
if (probe_conf.cache)
return probe_cache__show_all_caches(filter);
ret = init_probe_symbol_maps(false);
if (ret < 0)
return ret;
ret = probe_file__open_both(&kp_fd, &up_fd, 0);
if (ret < 0)
return ... | [
1,
0
] |
Linux Kernel | tools/perf/util/probe-event.c | static void warn_uprobe_event_compat(struct probe_trace_event *tev) {
int i;
char *buf = synthesize_probe_trace_command(tev);
struct probe_trace_point *tp = &tev->point;
if (tp->ref_ctr_offset && !uprobe_ref_ctr_is_supported()) {
pr_warning("A semaphore is associated with %s:%s and "
"seems ... | [
1,
0
] |
Linux Kernel | tools/perf/util/probe-event.c | static int probe_trace_event__set_name(struct probe_trace_event *tev,
struct perf_probe_event *pev,
struct strlist *namelist,
bool allow_suffix) {
const char *event, *group;
char buf[64];
int ret;
... | [
1,
0
] |
Linux Kernel | tools/perf/util/probe-event.c | static int find_cached_events(struct perf_probe_event *pev,
struct probe_trace_event **tevs,
const char *target) {
struct probe_cache *cache;
struct probe_cache_entry *entry;
struct probe_trace_event *tmp_tevs = NULL;
int ntevs = 0;
int ret = 0;
c... | [
1,
0
] |
Linux Kernel | tools/perf/util/probe-event.c | static int find_probe_trace_events_from_cache(struct perf_probe_event *pev,
struct probe_trace_event **tevs) {
struct probe_cache *cache;
struct probe_cache_entry *entry;
struct probe_trace_event *tev;
struct str_node *node;
int ret, i;
if (pev->sdt) {
if ... | [
1,
0
] |
Linux Kernel | tools/perf/util/probe-event.c | static int show_probe_trace_event(struct probe_trace_event *tev) {
char *buf = synthesize_probe_trace_command(tev);
if (!buf) {
pr_debug("Failed to synthesize probe trace event.\n");
return -EINVAL;
}
printf("%s\n", buf);
free(buf);
return 0;
} | [
1,
0
] |
Linux Kernel | tools/perf/util/probe-event.c |
static int show_bootconfig_event(struct probe_trace_event *tev) {
struct probe_trace_point *tp = &tev->point;
struct strbuf buf;
char *ret = NULL;
int err;
if (strbuf_init(&buf, 32) < 0)
return -ENOMEM;
err = synthesize_kprobe_trace_def(tp, &buf);
if (err >= 0)
err = synthesize_probe_trace_args... | [
1,
0
] |
Linux Kernel | tools/perf/util/probe-event.c | int show_bootconfig_events(struct perf_probe_event *pevs, int npevs) {
struct strlist *namelist = strlist__new(NULL, NULL);
struct probe_trace_event *tev;
struct perf_probe_event *pev;
char *cur_name = NULL;
int i, j, ret = 0;
if (!namelist)
return -ENOMEM;
for (j = 0; j < npevs && !ret; j++) {
... | [
1,
0
] |
Linux Kernel | tools/perf/util/probe-event.c | int del_perf_probe_events(struct strfilter *filter) {
int ret, ret2, ufd = -1, kfd = -1;
char *str = strfilter__string(filter);
if (!str)
return -EINVAL;
ret = probe_file__open_both(&kfd, &ufd, PF_FL_RW);
if (ret < 0)
goto out;
ret = probe_file__del_events(kfd, filter);
if (ret < 0 && ret != -E... | [
1,
0
] |
Linux Kernel | tools/perf/util/probe-event.c | int show_available_funcs(const char *target, struct nsinfo *nsi,
struct strfilter *_filter, bool user) {
struct rb_node *nd;
struct map *map;
int ret;
ret = init_probe_symbol_maps(user);
if (ret < 0)
return ret;
map = get_target_map(target, nsi, user);
if (!map) {
pr_err... | [
1,
0
] |
Linux Kernel | tools/perf/util/probe-file.c |
static bool print_common_warning(int err, bool readwrite) {
if (err == -EACCES)
pr_warning(
"No permission to %s tracefs.\nPlease %s\n",
readwrite ? "write" : "read",
readwrite
? "run this command again with sudo."
: "try 'sudo mount -o remount,mode=755 /sys/kernel... | [
1,
0
] |
Linux Kernel | tools/perf/util/probe-file.c |
static void print_open_warning(int err, bool uprobe, bool readwrite) {
char sbuf[STRERR_BUFSIZE];
if (print_common_warning(err, readwrite))
return;
if (print_configure_probe_event(uprobe ? 0 : err, uprobe ? err : 0))
return;
pr_warning("Failed to open %s/%cprobe_events: %s\n", tracing_path_mount(),
... | [
1,
0
] |
Linux Kernel | tools/perf/util/probe-file.c |
static void print_both_open_warning(int kerr, int uerr, bool readwrite) {
char sbuf[STRERR_BUFSIZE];
if (kerr == uerr && print_common_warning(kerr, readwrite))
return;
if (print_configure_probe_event(kerr, uerr))
return;
if (kerr < 0)
pr_warning("Failed to open %s/kprobe_events: %s.\n", tracing_... | [
1,
0
] |
Linux Kernel | tools/perf/util/probe-file.c |
int probe_file__open(int flag) {
int fd;
if (flag & PF_FL_UPROBE)
fd = open_uprobe_events(flag & PF_FL_RW);
else
fd = open_kprobe_events(flag & PF_FL_RW);
if (fd < 0)
print_open_warning(fd, flag & PF_FL_UPROBE, flag & PF_FL_RW);
return fd;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/probe-file.c |
int probe_file__open_both(int *kfd, int *ufd, int flag) {
if (!kfd || !ufd)
return -EINVAL;
*kfd = open_kprobe_events(flag & PF_FL_RW);
*ufd = open_uprobe_events(flag & PF_FL_RW);
if (*kfd < 0 && *ufd < 0) {
print_both_open_warning(*kfd, *ufd, flag & PF_FL_RW);
return *kfd;
}
return 0;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/probe-file.c | static struct strlist *__probe_file__get_namelist(int fd, bool include_group) {
char buf[128];
struct strlist *sl, *rawlist;
struct str_node *ent;
struct probe_trace_event tev;
int ret = 0;
memset(&tev, 0, sizeof(tev));
rawlist = probe_file__get_rawlist(fd);
if (!rawlist)
return NULL;
sl = strlis... | [
1,
0
] |
Linux Kernel | tools/perf/util/probe-file.c | struct strlist *probe_file__get_namelist(int fd) {
return __probe_file__get_namelist(fd, false);
} | [
0,
0
] |
Linux Kernel | tools/perf/util/probe-file.c | static int __del_trace_probe_event(int fd, struct str_node *ent) {
char *p;
char buf[128];
int ret;
ret = e_snprintf(buf, 128, "-:%s", ent->s);
if (ret < 0)
goto error;
p = strchr(buf + 2, ':');
if (!p) {
pr_debug("Internal error: %s should have ':' but not.\n", ent->s);
ret = -ENOTSUP;
... | [
1,
0
] |
Linux Kernel | tools/perf/util/probe-file.c |
int probe_file__del_events(int fd, struct strfilter *filter) {
struct strlist *namelist;
int ret;
namelist = strlist__new(NULL, NULL);
if (!namelist)
return -ENOMEM;
ret = probe_file__get_events(fd, filter, namelist);
if (ret < 0)
goto out;
ret = probe_file__del_strlist(fd, namelist);
out:
s... | [
0,
0
] |
Linux Kernel | tools/perf/util/probe-file.c | static int probe_cache__open(struct probe_cache *pcache, const char *target,
struct nsinfo *nsi) {
char cpath[PATH_MAX];
char sbuildid[SBUILD_ID_SIZE];
char *dir_name = NULL;
bool is_kallsyms = false;
int ret, fd;
struct nscookie nsc;
if (target && build_id_cache__cached(targ... | [
1,
0
] |
Linux Kernel | tools/perf/util/probe-file.c | static int probe_cache__load(struct probe_cache *pcache) {
struct probe_cache_entry *entry = NULL;
char buf[MAX_CMDLEN], *p;
int ret = 0, fddup;
FILE *fp;
fddup = dup(pcache->fd);
if (fddup < 0)
return -errno;
fp = fdopen(fddup, "r");
if (!fp) {
close(fddup);
return -EINVAL;
}
while (!... | [
1,
0
] |
Linux Kernel | tools/perf/util/probe-file.c |
static struct probe_cache *probe_cache__alloc(void) {
struct probe_cache *pcache = zalloc(sizeof(*pcache));
if (pcache) {
INIT_LIST_HEAD(&pcache->entries);
pcache->fd = -EINVAL;
}
return pcache;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/probe-file.c | static char *synthesize_sdt_probe_command(struct sdt_note *note,
const char *pathname,
const char *sdtgrp) {
struct strbuf buf;
char *ret = NULL;
int i, args_count, err;
unsigned long long ref_ctr_offset;
char *arg;
int arg_... | [
1,
0
] |
Linux Kernel | tools/perf/util/probe-file.c | int probe_cache__scan_sdt(struct probe_cache *pcache, const char *pathname) {
struct probe_cache_entry *entry = NULL;
struct list_head sdtlist;
struct sdt_note *note;
char *buf;
char sdtgrp[64];
int ret;
INIT_LIST_HEAD(&sdtlist);
ret = get_sdt_note_list(&sdtlist, pathname);
if (ret < 0) {
pr_debu... | [
1,
0
] |
Linux Kernel | tools/perf/util/probe-file.c | static int probe_cache_entry__write(struct probe_cache_entry *entry, int fd) {
struct str_node *snode;
struct stat st;
struct iovec iov[3];
const char *prefix = entry->sdt ? "%" : "#";
int ret;
ret = fstat(fd, &st);
if (ret < 0)
return ret;
pr_debug("Writing cache: %s%s\n", prefix, entry->spev);
... | [
0,
0
] |
Linux Kernel | tools/perf/util/probe-file.c | int probe_cache__commit(struct probe_cache *pcache) {
struct probe_cache_entry *entry;
int ret = 0;
ret = lseek(pcache->fd, 0, SEEK_SET);
if (ret < 0)
goto out;
ret = ftruncate(pcache->fd, 0);
if (ret < 0)
goto out;
for_each_probe_cache_entry(entry, pcache) {
ret = probe_cache_entry__write(... | [
0,
0
] |
Linux Kernel | tools/perf/util/probe-file.c |
static bool probe_cache_entry__compare(struct probe_cache_entry *entry,
struct strfilter *filter) {
char buf[128], *ptr = entry->spev;
if (entry->pev.event) {
snprintf(buf, 128, "%s:%s", entry->pev.group, entry->pev.event);
ptr = buf;
}
return strfilter__compare(... | [
1,
0
] |
Linux Kernel | tools/perf/util/probe-file.c |
static bool scan_ftrace_readme(enum ftrace_readme type) {
int fd;
FILE *fp;
char *buf = NULL;
size_t len = 0;
bool ret = false;
static bool scanned = false;
if (scanned)
goto result;
fd = open_trace_file("README", false);
if (fd < 0)
return ret;
fp = fdopen(fd, "r");
if (!fp) {
clo... | [
1,
0
] |
Linux Kernel | tools/perf/util/probe-file.c |
bool uprobe_ref_ctr_is_supported(void) {
return scan_ftrace_readme(FTRACE_README_UPROBE_REF_CTR);
} | [
0,
0
] |
Linux Kernel | tools/perf/util/probe-finder.c |
static struct debuginfo *__debuginfo__new(const char *path) {
struct debuginfo *dbg = zalloc(sizeof(*dbg));
if (!dbg)
return NULL;
if (debuginfo__init_offline_dwarf(dbg, path) < 0)
zfree(&dbg);
if (dbg)
pr_debug("Open Debuginfo file: %s\n", path);
return dbg;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/probe-finder.c | static struct probe_trace_arg_ref *alloc_trace_arg_ref(long offs) {
struct probe_trace_arg_ref *ref;
ref = zalloc(sizeof(struct probe_trace_arg_ref));
if (ref != NULL)
ref->offset = offs;
return ref;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/probe-finder.c | static int convert_to_trace_point(Dwarf_Die *sp_die, Dwfl_Module *mod,
Dwarf_Addr paddr, bool retprobe,
const char *function,
struct probe_trace_point *tp) {
Dwarf_Addr eaddr;
GElf_Sym sym;
const char *symbol;
... | [
0,
0
] |
Linux Kernel | tools/perf/util/probe-finder.c | static int find_inner_scope_cb(Dwarf_Die *fn_die, void *data) {
struct find_scope_param *fsp = data;
memcpy(fsp->die_mem, fn_die, sizeof(Dwarf_Die));
fsp->found = true;
return 1;
} | [
1,
0
] |
Linux Kernel | tools/perf/util/probe-finder.c | static int verify_representive_line(struct probe_finder *pf, const char *fname,
int lineno, Dwarf_Addr addr) {
const char *__fname, *__func = NULL;
Dwarf_Die die_mem;
int __lineno;
if (cu_find_lineinfo(&pf->cu_die, addr, &__fname, &__lineno) < 0)
return 0;
pr_debug2("... | [
0,
0
] |
Linux Kernel | tools/perf/util/probe-finder.c | static int collect_variables_cb(Dwarf_Die *die_mem, void *data) {
struct available_var_finder *af = data;
struct variable_list *vl;
struct strbuf buf = STRBUF_INIT;
int tag, ret;
vl = &af->vls[af->nvls - 1];
tag = dwarf_tag(die_mem);
if (tag == DW_TAG_formal_parameter || tag == DW_TAG_variable) {
re... | [
0,
0
] |
Linux Kernel | tools/perf/util/probe-finder.c |
static bool available_var_finder_overlap(struct available_var_finder *af) {
int i;
for (i = 0; i < af->nvls; i++) {
if (af->pf.addr == af->vls[i].point.address)
return true;
}
return false;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/probe-finder.c | static int add_available_vars(Dwarf_Die *sc_die, struct probe_finder *pf) {
struct available_var_finder *af =
container_of(pf, struct available_var_finder, pf);
struct perf_probe_point *pp = &pf->pev->point;
struct variable_list *vl;
Dwarf_Die die_mem;
int ret;
if (available_var_finder_overlap(af))
... | [
1,
0
] |
Linux Kernel | tools/perf/util/probe-finder.c |
static int find_line_range_by_func(struct line_finder *lf) {
struct dwarf_callback_param param = {.data = (void *)lf, .retval = 0};
dwarf_getfuncs(&lf->cu_die, line_range_search_cb, ¶m, 0);
return param.retval;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/pstack.c |
struct pstack *pstack__new(unsigned short max_nr_entries) {
struct pstack *pstack =
zalloc((sizeof(*pstack) + max_nr_entries * sizeof(void *)));
if (pstack != NULL)
pstack->max_nr_entries = max_nr_entries;
return pstack;
} | [
1,
0
] |
Linux Kernel | tools/perf/util/pstack.c |
void pstack__delete(struct pstack *pstack) { free(pstack); } | [
1,
0
] |
Linux Kernel | tools/perf/util/pstack.c |
bool pstack__empty(const struct pstack *pstack) { return pstack->top == 0; } | [
0,
0
] |
Linux Kernel | tools/perf/util/pstack.c |
void pstack__remove(struct pstack *pstack, void *key) {
unsigned short i = pstack->top, last_index = pstack->top - 1;
while (i-- != 0) {
if (pstack->entries[i] == key) {
if (i < last_index)
memmove(pstack->entries + i, pstack->entries + i + 1,
(last_index - i) * sizeof(void *));
... | [
1,
0
] |
Linux Kernel | tools/perf/util/pstack.c |
void pstack__push(struct pstack *pstack, void *key) {
if (pstack->top == pstack->max_nr_entries) {
pr_err("%s: top=%d, overflow!\n", __func__, pstack->top);
return;
}
pstack->entries[pstack->top++] = key;
} | [
1,
0
] |
Linux Kernel | tools/perf/util/pstack.c |
void *pstack__peek(struct pstack *pstack) {
if (pstack->top == 0)
return NULL;
return pstack->entries[pstack->top - 1];
} | [
1,
0
] |
Linux Kernel | tools/perf/util/python.c |
void bpf_counter__destroy(struct evsel *evsel __maybe_unused) {} | [
0,
0
] |
Linux Kernel | tools/perf/util/python.c |
static PyObject *pyrf_comm_event__repr(struct pyrf_event *pevent) {
return _PyUnicode_FromFormat("{ type: comm, pid: %u, tid: %u, comm: %s }",
pevent->event.comm.pid, pevent->event.comm.tid,
pevent->event.comm.comm);
} | [
0,
0
] |
Linux Kernel | tools/perf/util/python.c | static PyObject *pyrf_read_event__repr(struct pyrf_event *pevent) {
return _PyUnicode_FromFormat("{ type: read, pid: %u, tid: %u }",
pevent->event.read.pid, pevent->event.read.tid);
/*
* FIXME: return the array of read values,
* making this method useful ;-)
*/
} | [
0,
1
] |
Linux Kernel | tools/perf/util/python.c |
static PyObject *get_tracepoint_field(struct pyrf_event *pevent,
PyObject *attr_name) {
const char *str = _PyUnicode_AsString(PyObject_Str(attr_name));
struct evsel *evsel = pevent->evsel;
struct tep_format_field *field;
if (!evsel->tp_format) {
struct tep_event *tp_f... | [
0,
0
] |
Linux Kernel | tools/perf/util/python.c |
static PyObject *pyrf_event__new(union perf_event *event) {
struct pyrf_event *pevent;
PyTypeObject *ptype;
if ((event->header.type < PERF_RECORD_MMAP ||
event->header.type > PERF_RECORD_SAMPLE) &&
!(event->header.type == PERF_RECORD_SWITCH ||
event->header.type == PERF_RECORD_SWITCH_CPU_WI... | [
1,
0
] |
Linux Kernel | tools/perf/util/python.c |
static int pyrf_cpu_map__init(struct pyrf_cpu_map *pcpus, PyObject *args,
PyObject *kwargs) {
static char *kwlist[] = {"cpustr", NULL};
char *cpustr = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|s", kwlist, &cpustr))
return -1;
pcpus->cpus = perf_cpu_map__new(cpus... | [
0,
0
] |
Linux Kernel | tools/perf/util/python.c |
static PyObject *pyrf_cpu_map__item(PyObject *obj, Py_ssize_t i) {
struct pyrf_cpu_map *pcpus = (void *)obj;
if (i >= perf_cpu_map__nr(pcpus->cpus))
return NULL;
return Py_BuildValue("i", perf_cpu_map__cpu(pcpus->cpus, i).cpu);
} | [
0,
0
] |
Linux Kernel | tools/perf/util/python.c |
static int pyrf_cpu_map__setup_types(void) {
pyrf_cpu_map__type.tp_new = PyType_GenericNew;
return PyType_Ready(&pyrf_cpu_map__type);
} | [
0,
0
] |
Linux Kernel | tools/perf/util/python.c |
static int pyrf_thread_map__init(struct pyrf_thread_map *pthreads,
PyObject *args, PyObject *kwargs) {
static char *kwlist[] = {"pid", "tid", "uid", NULL};
int pid = -1, tid = -1, uid = UINT_MAX;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|iii", kwlist, &pid, &tid,
... | [
0,
0
] |
Linux Kernel | tools/perf/util/python.c |
static Py_ssize_t pyrf_thread_map__length(PyObject *obj) {
struct pyrf_thread_map *pthreads = (void *)obj;
return pthreads->threads->nr;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/python.c |
static int pyrf_evsel__setup_types(void) {
pyrf_evsel__type.tp_new = PyType_GenericNew;
return PyType_Ready(&pyrf_evsel__type);
} | [
0,
0
] |
Linux Kernel | tools/perf/util/python.c |
static int pyrf_evlist__init(struct pyrf_evlist *pevlist, PyObject *args,
PyObject *kwargs __maybe_unused) {
PyObject *pcpus = NULL, *pthreads = NULL;
struct perf_cpu_map *cpus;
struct perf_thread_map *threads;
if (!PyArg_ParseTuple(args, "OO", &pcpus, &pthreads))
return -1;
... | [
0,
0
] |
Linux Kernel | tools/perf/util/python.c |
static PyObject *pyrf_evlist__add(struct pyrf_evlist *pevlist, PyObject *args,
PyObject *kwargs __maybe_unused) {
struct evlist *evlist = &pevlist->evlist;
PyObject *pevsel;
struct evsel *evsel;
if (!PyArg_ParseTuple(args, "O", &pevsel))
return NULL;
Py_INCREF(pevsel)... | [
0,
0
] |
Linux Kernel | tools/perf/util/python.c |
static int pyrf_evlist__setup_types(void) {
pyrf_evlist__type.tp_new = PyType_GenericNew;
return PyType_Ready(&pyrf_evlist__type);
} | [
0,
0
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.