Projectname
large_stringclasses
15 values
Filepath
large_stringlengths
4
106
⌀
Function
large_stringlengths
11
3.45k
Label
list
Linux Kernel
tools/perf/arch/x86/util/mem-events.c
struct perf_mem_event *perf_mem_events__ptr(int i) { static int is_amd; if (i >= PERF_MEM_EVENTS__MAX) return NULL; if (!is_amd) is_amd = perf_mem_is_amd_cpu(); if (is_amd == 1) return &perf_mem_events_amd[i]; return &perf_mem_events_intel[i]; }
[ 0, 0 ]
Linux Kernel
tools/perf/arch/x86/util/mem-events.c
bool is_mem_loads_aux_event(struct evsel *leader) { if (perf_pmu__find("cpu")) { if (!pmu_have_event("cpu", "mem-loads-aux")) return false; } else if (perf_pmu__find("cpu_core")) { if (!pmu_have_event("cpu_core", "mem-loads-aux")) return false; } return leader->core.attr.config == MEM_LOAD...
[ 0, 0 ]
Linux Kernel
tools/perf/arch/x86/util/perf_regs.c
static void sdt_rename_register(char *sdt_reg, int sdt_len, char *uprobe_reg) { int i = 0; for (i = 0; sdt_reg_tbl[i].sdt_name != NULL; i++) { if (!strncmp(sdt_reg_tbl[i].sdt_name, sdt_reg, sdt_len)) { strcpy(uprobe_reg, sdt_reg_tbl[i].uprobe_name); return; } } strncpy(uprobe_reg, sdt_reg,...
[ 1, 0 ]
Linux Kernel
tools/perf/arch/x86/util/pmu.c
static char *__pmu_find_real_name(const char *name) { struct pmu_alias *pmu_alias; list_for_each_entry(pmu_alias, &pmu_alias_name_list, list) { if (!strcmp(name, pmu_alias->alias)) return pmu_alias->name; } return (char *)name; }
[ 0, 0 ]
Linux Kernel
tools/perf/arch/x86/util/pmu.c
char *pmu_find_alias_name(const char *name) { if (cached_list) return __pmu_find_alias_name(name); setup_pmu_alias_list(); cached_list = true; return __pmu_find_alias_name(name); }
[ 0, 0 ]
Linux Kernel
tools/perf/arch/x86/util/topdown.c
const char *arch_get_topdown_pmu_name(struct evlist *evlist, bool warn) { const char *pmu_name; if (!perf_pmu__has_hybrid()) return "cpu"; if (!evlist->hybrid_pmu_name) { if (warn) pr_warning("WARNING: default to use cpu_core topdown events\n"); evlist->hybrid_pmu_name = perf_pmu__hybrid_type...
[ 0, 0 ]
Linux Kernel
tools/perf/arch/x86/util/topdown.c
int topdown_parse_events(struct evlist *evlist) { const char *topdown_events; const char *pmu_name; if (!topdown_sys_has_perf_metrics()) return 0; pmu_name = arch_get_topdown_pmu_name(evlist, false); if (pmu_have_event(pmu_name, "topdown-heavy-ops")) { if (!strcmp(pmu_name, "cpu_core")) topd...
[ 0, 0 ]
Linux Kernel
tools/perf/arch/xtensa/util/dwarf-regs.c
const char *get_arch_regstr(unsigned int n) { return n < XTENSA_MAX_REGS ? xtensa_regs_table[n] : NULL; }
[ 0, 0 ]
Linux Kernel
tools/perf/bench/breakpoint.c
static int breakpoint_setup(void *addr) { struct perf_event_attr attr = { .size = 0, }; attr.type = PERF_TYPE_BREAKPOINT; attr.size = sizeof(attr); attr.inherit = 1; attr.exclude_kernel = 1; attr.exclude_hv = 1; attr.bp_addr = (unsigned long)addr; attr.bp_type = HW_BREAKPOINT_RW; attr.bp_len...
[ 1, 0 ]
Linux Kernel
tools/perf/bench/breakpoint.c
static void *passive_thread(void *arg) { unsigned int *done = (unsigned int *)arg; while (!__atomic_load_n(done, __ATOMIC_RELAXED)) futex_wait(done, 0, NULL, 0); return NULL; }
[ 0, 0 ]
Linux Kernel
tools/perf/bench/breakpoint.c
static void *active_thread(void *arg) { unsigned int *done = (unsigned int *)arg; while (!__atomic_load_n(done, __ATOMIC_RELAXED)) ; return NULL; }
[ 0, 0 ]
Linux Kernel
tools/perf/bench/epoll-ctl.c
static void nest_epollfd(void) { unsigned int i; struct epoll_event ev; if (nested > EPOLL_MAXNESTS) nested = EPOLL_MAXNESTS; printinfo("Nesting level(s): %d\n", nested); epollfdp = calloc(nested, sizeof(int)); if (!epollfdp) err(EXIT_FAILURE, "calloc"); for (i = 0; i < nested; i++) { epoll...
[ 1, 0 ]
Linux Kernel
tools/perf/bench/epoll-ctl.c
static int do_threads(struct worker *worker, struct perf_cpu_map *cpu) { pthread_attr_t thread_attr, *attrp = NULL; cpu_set_t *cpuset; unsigned int i, j; int ret = 0; int nrcpus; size_t size; if (!noaffinity) pthread_attr_init(&thread_attr); nrcpus = perf_cpu_map__nr(cpu); cpuset = CPU_ALLOC(nrc...
[ 1, 0 ]
Linux Kernel
tools/perf/bench/epoll-wait.c
static void *writerfn(void *p) { struct worker *worker = p; size_t i, j, iter; const uint64_t val = 1; ssize_t sz; struct timespec ts = {.tv_sec = 0, .tv_nsec = 500}; printinfo("starting writer-thread: doing %s writes ...\n", randomize ? "random" : "lineal"); for (iter = 0; !wdone; iter++) ...
[ 1, 0 ]
Linux Kernel
tools/perf/bench/evlist-open-close.c
static char *bench__repeat_event_string(const char *evstr, int n) { char sbuf[STRERR_BUFSIZE]; struct strbuf buf; int i, str_size = strlen(evstr), final_size = str_size * n + n, err = strbuf_init(&buf, final_size); if (err) { pr_err("strbuf_init: %s\n", str_error_r(err, sbuf, sizeof(sbuf))); ...
[ 1, 0 ]
Linux Kernel
tools/perf/bench/find-bit-bench.c
int bench_mem_find_bit(int argc, const char **argv) { int err = 0, i; argc = parse_options(argc, argv, options, bench_usage, 0); if (argc) { usage_with_options(bench_usage, options); exit(EXIT_FAILURE); } for (i = 1; i <= 2048; i <<= 1) do_for_each_set_bit(i); return err; }
[ 1, 0 ]
Linux Kernel
tools/perf/bench/futex-hash.c
static void *workerfn(void *arg) { int ret; struct worker *w = (struct worker *)arg; unsigned int i; unsigned long ops = w->ops; mutex_lock(&thread_lock); threads_starting--; if (!threads_starting) cond_signal(&thread_parent); cond_wait(&thread_worker, &thread_lock); mutex_unlock(&thread_lock); ...
[ 1, 0 ]
Linux Kernel
tools/perf/bench/futex-wake-parallel.c
static void *waking_workerfn(void *arg) { struct thread_data *waker = (struct thread_data *)arg; struct timeval start, end; pthread_barrier_wait(&barrier); gettimeofday(&start, NULL); waker->nwoken = futex_wake(&futex, nwakes, futex_flag); if (waker->nwoken != nwakes) warnx("couldn't wakeup all task...
[ 0, 0 ]
Linux Kernel
tools/perf/bench/futex-wake-parallel.c
static void print_run(struct thread_data *waking_worker, unsigned int run_num) { unsigned int i, wakeup_avg; double waketime_avg, waketime_stddev; struct stats __waketime_stats, __wakeup_stats; init_stats(&__wakeup_stats); init_stats(&__waketime_stats); for (i = 0; i < params.nwakes; i++) { update_st...
[ 1, 0 ]
Linux Kernel
tools/perf/bench/futex-wake-parallel.c
static void do_run_stats(struct thread_data *waking_worker) { unsigned int i; for (i = 0; i < params.nwakes; i++) { update_stats(&waketime_stats, waking_worker[i].runtime.tv_usec); update_stats(&wakeup_stats, waking_worker[i].nwoken); } }
[ 0, 0 ]
Linux Kernel
tools/perf/bench/inject-buildid.c
static ssize_t synthesize_attr(struct bench_data *data) { union perf_event event; memset(&event, 0, sizeof(event.attr) + sizeof(u64)); event.header.type = PERF_RECORD_HEADER_ATTR; event.header.size = sizeof(event.attr) + sizeof(u64); event.attr.attr.type = PERF_TYPE_SOFTWARE; event.attr.attr.config = PE...
[ 1, 0 ]
Linux Kernel
tools/perf/bench/inject-buildid.c
static ssize_t synthesize_fork(struct bench_data *data) { union perf_event event; memset(&event, 0, sizeof(event.fork) + bench_id_hdr_size); event.header.type = PERF_RECORD_FORK; event.header.misc = PERF_RECORD_MISC_FORK_EXEC; event.header.size = sizeof(event.fork) + bench_id_hdr_size; event.fork.ppid =...
[ 1, 0 ]
Linux Kernel
tools/perf/bench/inject-buildid.c
static ssize_t synthesize_mmap(struct bench_data *data, struct bench_dso *dso, u64 timestamp) { union perf_event event; size_t len = offsetof(struct perf_record_mmap2, filename); u64 *id_hdr_ptr = (void *)&event; int ts_idx; len += roundup(strlen(dso->name) + 1, 8) + bench_id_h...
[ 1, 0 ]
Linux Kernel
tools/perf/bench/inject-buildid.c
static ssize_t synthesize_flush(struct bench_data *data) { struct perf_event_header header = { .size = sizeof(header), .type = PERF_RECORD_FINISHED_ROUND, }; return writen(data->input_pipe[1], &header, header.size); }
[ 1, 0 ]
Linux Kernel
tools/perf/bench/inject-buildid.c
static int setup_injection(struct bench_data *data, bool build_id_all) { int ready_pipe[2]; int dev_null_fd; char buf; if (pipe(ready_pipe) < 0) return -1; if (pipe(data->input_pipe) < 0) return -1; if (pipe(data->output_pipe) < 0) return -1; data->pid = fork(); if (data->pid < 0) re...
[ 1, 0 ]
Linux Kernel
tools/perf/bench/inject-buildid.c
int bench_inject_build_id(int argc, const char **argv) { struct bench_data data; argc = parse_options(argc, argv, options, bench_usage, 0); if (argc) { usage_with_options(bench_usage, options); exit(EXIT_FAILURE); } return do_inject_loops(&data); }
[ 0, 0 ]
Linux Kernel
tools/perf/bench/kallsyms-parse.c
static int bench_process_symbol(void *arg __maybe_unused, const char *name __maybe_unused, char type __maybe_unused, u64 start __maybe_unused) { return 0; }
[ 0, 0 ]
Linux Kernel
tools/perf/bench/kallsyms-parse.c
static int do_kallsyms_parse(void) { struct timeval start, end, diff; u64 runtime_us; unsigned int i; double time_average, time_stddev; int err; struct stats time_stats; init_stats(&time_stats); for (i = 0; i < iterations; i++) { gettimeofday(&start, NULL); err = kallsyms__parse("/proc/kallsy...
[ 1, 0 ]
Linux Kernel
tools/perf/bench/mem-functions.c
static int bench_mem_common(int argc, const char **argv, struct bench_mem_info *info) { int i; size_t size; double size_total; argc = parse_options(argc, argv, options, info->usage, 0); if (use_cycles) { i = init_cycles(); if (i < 0) { fprintf(stderr, "Failed to op...
[ 0, 0 ]
Linux Kernel
tools/perf/bench/mem-functions.c
static u64 do_memcpy_cycles(const struct function *r, size_t size, void *src, void *dst) { u64 cycle_start = 0ULL, cycle_end = 0ULL; memcpy_t fn = r->fn.memcpy; int i; memcpy_prefault(fn, size, src, dst); cycle_start = get_cycles(); for (i = 0; i < nr_loops; ++i) fn(dst, s...
[ 0, 0 ]
Linux Kernel
tools/perf/bench/mem-functions.c
static double do_memcpy_gettimeofday(const struct function *r, size_t size, void *src, void *dst) { struct timeval tv_start, tv_end, tv_diff; memcpy_t fn = r->fn.memcpy; int i; memcpy_prefault(fn, size, src, dst); BUG_ON(gettimeofday(&tv_start, NULL)); for (i = 0; i <...
[ 0, 0 ]
Linux Kernel
tools/perf/bench/mem-functions.c
static u64 do_memset_cycles(const struct function *r, size_t size, void *src __maybe_unused, void *dst) { u64 cycle_start = 0ULL, cycle_end = 0ULL; memset_t fn = r->fn.memset; int i; fn(dst, -1, size); cycle_start = get_cycles(); for (i = 0; i < nr_loops; ++i) fn(dst, i, si...
[ 0, 0 ]
Linux Kernel
tools/perf/bench/numa.c
static int nr_numa_nodes(void) { int i, nr_nodes = 0; for (i = 0; i < g->p.nr_nodes; i++) { if (numa_bitmask_isbitset(numa_nodes_ptr, i)) nr_nodes++; } return nr_nodes; }
[ 0, 0 ]
Linux Kernel
tools/perf/bench/numa.c
static int is_node_present(int node) { return numa_bitmask_isbitset(numa_nodes_ptr, node); }
[ 0, 0 ]
Linux Kernel
tools/perf/bench/numa.c
static cpu_set_t *bind_to_cpu(int target_cpu) { int nrcpus = numa_num_possible_cpus(); cpu_set_t *orig_mask, *mask; size_t size; orig_mask = CPU_ALLOC(nrcpus); BUG_ON(!orig_mask); size = CPU_ALLOC_SIZE(nrcpus); CPU_ZERO_S(size, orig_mask); if (sched_getaffinity(0, size, orig_mask)) goto err_out; ...
[ 1, 0 ]
Linux Kernel
tools/perf/bench/numa.c
static cpu_set_t *bind_to_node(int target_node) { int nrcpus = numa_num_possible_cpus(); size_t size; cpu_set_t *orig_mask, *mask; int cpu; orig_mask = CPU_ALLOC(nrcpus); BUG_ON(!orig_mask); size = CPU_ALLOC_SIZE(nrcpus); CPU_ZERO_S(size, orig_mask); if (sched_getaffinity(0, size, orig_mask)) go...
[ 0, 0 ]
Linux Kernel
tools/perf/bench/numa.c
static inline uint32_t lfsr_32(uint32_t lfsr) { const uint32_t taps = BIT(1) | BIT(5) | BIT(6) | BIT(31); return (lfsr >> 1) ^ ((0x0u - (lfsr & 0x1u)) & taps); }
[ 0, 0 ]
Linux Kernel
tools/perf/bench/numa.c
static void deinit_thread_data(void) { ssize_t size = sizeof(*g->threads) * g->p.nr_tasks; int t; for (t = 0; t < g->p.nr_tasks; t++) { struct thread_data *td = g->threads + t; CPU_FREE(td->bind_cpumask); } free_data(g->threads, size); }
[ 1, 0 ]
Linux Kernel
tools/perf/bench/numa.c
static void deinit(void) { free_data(g->data, g->p.bytes_global); g->data = NULL; deinit_thread_data(); free_data(g, sizeof(*g)); g = NULL; }
[ 1, 0 ]
Linux Kernel
tools/perf/bench/numa.c
static void print_res(const char *name, double val, const char *txt_unit, const char *txt_short, const char *txt_long) { if (!name) name = "main,"; if (!g->p.show_quiet) printf(" %-30s %15.3f, %-15s %s\n", name, val, txt_unit, txt_short); else printf(" %14.3f %s\n", val, txt_lon...
[ 1, 0 ]
Linux Kernel
tools/perf/bench/numa.c
static int command_size(const char **argv) { int size = 0; while (*argv) { size++; argv++; } BUG_ON(size >= MAX_ARGS); return size; }
[ 0, 0 ]
Linux Kernel
tools/perf/bench/numa.c
int bench_numa(int argc, const char **argv) { init_params(&p0, "main,", argc, argv); argc = parse_options(argc, argv, options, bench_numa_usage, 0); if (argc) goto err; if (p0.run_all) return bench_all(); if (__bench_numa(NULL)) goto err; return 0; err: usage_with_options(numa_usage, opti...
[ 0, 0 ]
Linux Kernel
tools/perf/bench/sched-messaging.c
static void fdpair(int fds[2]) { if (use_pipes) { if (pipe(fds) == 0) return; } else { if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds) == 0) return; } err(EXIT_FAILURE, use_pipes ? "pipe()" : "socketpair()"); }
[ 0, 0 ]
Linux Kernel
tools/perf/bench/sched-pipe.c
static void *worker_thread(void *__tdata) { struct thread_data *td = __tdata; int m = 0, i; int ret; for (i = 0; i < loops; i++) { if (!td->nr) { ret = read(td->pipe_read, &m, sizeof(int)); BUG_ON(ret != sizeof(int)); ret = write(td->pipe_write, &m, sizeof(int)); BUG_ON(ret != size...
[ 1, 0 ]
Linux Kernel
tools/perf/bench/synthesize.c
static int do_run_single_threaded(struct perf_session *session, struct perf_thread_map *threads, struct target *target, bool data_mmap) { const unsigned int nr_threads_synthesize = 1; struct timeval start, end, diff; u64 runtime_us; unsigned i...
[ 1, 0 ]
Linux Kernel
tools/perf/bench/synthesize.c
static int do_run_multi_threaded(struct target *target, unsigned int nr_threads_synthesize) { struct timeval start, end, diff; u64 runtime_us; unsigned int i; double time_average, time_stddev, event_average, event_stddev; int err; struct stats time_stats, event_stats; str...
[ 1, 0 ]
Linux Kernel
tools/perf/bench/synthesize.c
static int run_multi_threaded(void) { struct target target = {.cpu_list = "0"}; unsigned int nr_threads_synthesize; int err; if (max_threads == UINT_MAX) max_threads = sysconf(_SC_NPROCESSORS_ONLN); puts("Computing performance of multi threaded perf event synthesis by\n" "synthesizing events on ...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-annotate.c
static void process_branch_stack(struct branch_stack *bs, struct addr_location *al, struct perf_sample *sample) { struct addr_map_symbol *prev = NULL; struct branch_info *bi; int i; if (!bs || !bs->nr) return; bi = sample__resolve_bstack(...
[ 1, 1 ]
Linux Kernel
tools/perf/builtin-annotate.c
static int process_branch_callback(struct evsel *evsel, struct perf_sample *sample, struct addr_location *al __maybe_unused, struct perf_annotate *ann, struct machine *machine) { ...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-annotate.c
static int process_feature_event(struct perf_session *session, union perf_event *event) { if (event->feat.feat_id < HEADER_LAST_FEATURE) return perf_event__process_feature(session, event); return 0; }
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-annotate.c
static int hist_entry__tty_annotate(struct hist_entry *he, struct evsel *evsel, struct perf_annotate *ann) { if (!ann->use_stdio2) return symbol__tty_annotate(&he->ms, evsel, &ann->opts); return symbol__tty_annotate2(&he->ms, evsel, &ann->opts); }
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-bench.c
static int bench_str2int(const char *str) { if (!str) return BENCH_FORMAT_DEFAULT; if (!strcmp(str, BENCH_FORMAT_DEFAULT_STR)) return BENCH_FORMAT_DEFAULT; else if (!strcmp(str, BENCH_FORMAT_SIMPLE_STR)) return BENCH_FORMAT_SIMPLE; return BENCH_FORMAT_UNKNOWN; }
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-bench.c
static int run_bench(const char *coll_name, const char *bench_name, bench_fn_t fn, int argc, const char **argv) { int size; char *name; int ret; size = strlen(coll_name) + 1 + strlen(bench_name) + 1; name = zalloc(size); BUG_ON(!name); scnprintf(name, size, "%s-%s", coll_name, benc...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-bench.c
int cmd_bench(int argc, const char **argv) { struct collection *coll; int ret = 0; setvbuf(stdout, NULL, _IONBF, 0); if (argc < 2) { /* No collection specified. */ print_usage(); goto end; } argc = parse_options(argc, argv, bench_options, bench_usage, PARSE_OPT_STOP_AT_...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-buildid-cache.c
static int build_id_cache__kcore_buildid(const char *proc_dir, char *sbuildid) { char root_dir[PATH_MAX]; char *p; strlcpy(root_dir, proc_dir, sizeof(root_dir)); p = strrchr(root_dir, '/'); if (!p) return -1; *p = '\0'; return sysfs__sprintf_build_id(root_dir, sbuildid); }
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-buildid-cache.c
static bool same_kallsyms_reloc(const char *from_dir, char *to_dir) { char from[PATH_MAX]; char to[PATH_MAX]; const char *name; u64 addr1 = 0, addr2 = 0; int i, err = -1; scnprintf(from, sizeof(from), "%s/kallsyms", from_dir); scnprintf(to, sizeof(to), "%s/kallsyms", to_dir); for (i = 0; (name = ref_...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-buildid-cache.c
static int build_id_cache__add_kcore(const char *filename, bool force) { char dir[32], sbuildid[SBUILD_ID_SIZE]; char from_dir[PATH_MAX], to_dir[PATH_MAX]; char *p; strlcpy(from_dir, filename, sizeof(from_dir)); p = strrchr(from_dir, '/'); if (!p || strcmp(p + 1, "kcore")) return -1; *p = '\0'; i...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-buildid-cache.c
static int build_id_cache__remove_file(const char *filename, struct nsinfo *nsi) { char sbuild_id[SBUILD_ID_SIZE]; struct build_id bid; struct nscookie nsc; int err; nsinfo__mountns_enter(nsi, &nsc); err = filename__read_build_id(filename, &bid); nsinfo__mountns_e...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-buildid-cache.c
static int build_id_cache__purge_all(void) { struct strlist *list; struct str_node *pos; int err = 0; char *buf; list = build_id_cache__list_all(false); if (!list) { pr_debug("Failed to get buildids: -%d\n", errno); return -EINVAL; } strlist__for_each_entry(pos, list) { buf = build_id_cac...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-buildid-list.c
static int sysfs__fprintf_build_id(FILE *fp) { char sbuild_id[SBUILD_ID_SIZE]; int ret; ret = sysfs__sprintf_build_id("/", sbuild_id); if (ret != sizeof(sbuild_id)) return ret < 0 ? ret : -EINVAL; return fprintf(fp, "%s\n", sbuild_id); }
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-buildid-list.c
static int filename__fprintf_build_id(const char *name, FILE *fp) { char sbuild_id[SBUILD_ID_SIZE]; int ret; ret = filename__sprintf_build_id(name, sbuild_id); if (ret != sizeof(sbuild_id)) return ret < 0 ? ret : -EINVAL; return fprintf(fp, "%s\n", sbuild_id); }
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-buildid-list.c
static int perf_session__list_build_ids(bool force, bool with_hits) { struct perf_session *session; struct perf_data data = { .path = input_name, .mode = PERF_DATA_MODE_READ, .force = force, }; symbol__elf_init(); if (filename__fprintf_build_id(input_name, stdout) > 0) goto out; ses...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-c2c.c
static void c2c_he__set_cpu(struct c2c_hist_entry *c2c_he, struct perf_sample *sample) { if (WARN_ONCE(sample->cpu == (unsigned int)-1, "WARNING: no sample cpu value")) return; set_bit(sample->cpu, c2c_he->cpuset); }
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-c2c.c
static void compute_stats(struct c2c_hist_entry *c2c_he, struct c2c_stats *stats, u64 weight) { struct compute_stats *cstats = &c2c_he->cstats; if (stats->rmt_hitm) update_stats(&cstats->rmt_hitm, weight); else if (stats->lcl_hitm) update_stats(&cstats->lcl_hitm, weight); els...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-c2c.c
static int c2c_width(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp __maybe_unused, struct hists *hists) { struct c2c_fmt *c2c_fmt; struct c2c_dimension *dim; c2c_fmt = container_of(fmt, struct c2c_fmt, fmt); dim = c2c_fmt->dim; if (dim == &dim_symbol || dim == &dim_srcline) return...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-c2c.c
static int offset_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, struct hist_entry *he) { uint64_t addr = 0; int width = c2c_width(fmt, hpp, he->hists); char buf[20]; if (he->mem_info) addr = cl_offset(he->mem_info->daddr.al_addr); return scnprintf(hpp->buf, hpp->size, "%...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-c2c.c
static int64_t offset_cmp(struct perf_hpp_fmt *fmt __maybe_unused, struct hist_entry *left, struct hist_entry *right) { uint64_t l = 0, r = 0; if (left->mem_info) l = cl_offset(left->mem_info->daddr.addr); if (right->mem_info) r = cl_offset(right->mem_info->daddr.addr); retu...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-c2c.c
static uint64_t get_load_llc_misses(struct c2c_stats *stats) { return stats->lcl_dram + stats->rmt_dram + stats->rmt_hitm + stats->rmt_hit; }
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-c2c.c
static uint64_t get_load_cache_hits(struct c2c_stats *stats) { return stats->ld_fbhit + stats->ld_l1hit + stats->ld_l2hit + stats->ld_llchit + stats->lcl_hitm; }
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-c2c.c
static int64_t tot_loads_cmp(struct perf_hpp_fmt *fmt __maybe_unused, struct hist_entry *left, struct hist_entry *right) { struct c2c_hist_entry *c2c_left; struct c2c_hist_entry *c2c_right; uint64_t tot_recs_left; uint64_t tot_recs_right; c2c_left = ...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-c2c.c
static int percent_color(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, struct hist_entry *he, get_percent_cb get_percent) { struct c2c_hist_entry *c2c_he; int width = c2c_width(fmt, hpp, he->hists); double per; c2c_he = container_of(he, struct c2c_hist_entry, he); per = get_percen...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-c2c.c
static int64_t percent_costly_snoop_cmp(struct perf_hpp_fmt *fmt __maybe_unused, struct hist_entry *left, struct hist_entry *right) { struct c2c_hist_entry *c2c_left; struct c2c_hist_entry *c2c_right; double per_left; double per_ri...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-c2c.c
static struct c2c_stats *total_stats(struct hist_entry *he) { struct c2c_hists *hists; hists = container_of(he->hists, struct c2c_hists, hists); return &hists->stats; }
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-c2c.c
static int percent_rmt_hitm_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, struct hist_entry *he) { int width = c2c_width(fmt, hpp, he->hists); double per = PERCENT(he, rmt_hitm); char buf[10]; return scnprintf(hpp->buf, hpp->size, "%*s", width, PERC_STR(buf, per)); }
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-c2c.c
static int percent_lcl_hitm_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, struct hist_entry *he) { int width = c2c_width(fmt, hpp, he->hists); double per = PERCENT(he, lcl_hitm); char buf[10]; return scnprintf(hpp->buf, hpp->size, "%*s", width, PERC_STR(buf, per)); }
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-c2c.c
static int pid_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, struct hist_entry *he) { int width = c2c_width(fmt, hpp, he->hists); return scnprintf(hpp->buf, hpp->size, "%*d", width, he->thread->pid_); }
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-c2c.c
static int c2c_se_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, struct hist_entry *he) { struct c2c_fmt *c2c_fmt = container_of(fmt, struct c2c_fmt, fmt); struct c2c_dimension *dim = c2c_fmt->dim; size_t len = fmt->user_len; if (!len) { len = hists__col_len(he->hists, dim->...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-c2c.c
static int c2c_hists__init_output(struct perf_hpp_list *hpp_list, char *name) { struct c2c_fmt *c2c_fmt = get_format(name); if (!c2c_fmt) { reset_dimensions(); return output_field_add(hpp_list, name); } perf_hpp_list__column_register(hpp_list, &c2c_fmt->fmt); return 0; }
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-c2c.c
static bool he__display(struct hist_entry *he, struct c2c_stats *stats) { struct c2c_hist_entry *c2c_he; if (c2c.show_all) return true; c2c_he = container_of(he, struct c2c_hist_entry, he); switch (c2c.display) { case DISPLAY_LCL_HITM: he->filtered = filter_display(c2c_he->stats.lcl_hitm, stats->l...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-c2c.c
static void set_node_width(struct c2c_hist_entry *c2c_he, int len) { struct c2c_dimension *dim; dim = &c2c.hists == c2c_he->hists ? &dim_dcacheline_node : &dim_offset_node; if (len > dim->width) dim->width = len; }
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-c2c.c
static void calc_width(struct c2c_hist_entry *c2c_he) { struct c2c_hists *c2c_hists; c2c_hists = container_of(c2c_he->he.hists, struct c2c_hists, hists); hists__calc_col_len(&c2c_hists->hists, &c2c_he->he); set_nodestr(c2c_he); }
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-c2c.c
static int filter_cb(struct hist_entry *he, void *arg __maybe_unused) { struct c2c_hist_entry *c2c_he; c2c_he = container_of(he, struct c2c_hist_entry, he); if (c2c.show_src && !he->srcline) he->srcline = hist_entry__srcline(he); calc_width(c2c_he); if (!is_valid_hist_entry(he)) he->filtered = HI...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-c2c.c
static int resort_cl_cb(struct hist_entry *he, void *arg __maybe_unused) { struct c2c_hist_entry *c2c_he; struct c2c_hists *c2c_hists; bool display = he__display(he, &c2c.shared_clines_stats); c2c_he = container_of(he, struct c2c_hist_entry, he); c2c_hists = c2c_he->hists; if (display && c2c_hists) { ...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-c2c.c
static void print_pareto(FILE *out) { struct perf_hpp_list hpp_list; struct rb_node *nd; int ret; const char *cl_output; if (c2c.display != DISPLAY_SNP_PEER) cl_output = "cl_num," "cl_rmt_hitm," "cl_lcl_hitm," "cl_stores_l1hit," "cl_stores_...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-c2c.c
static void print_c2c_info(FILE *out, struct perf_session *session) { struct evlist *evlist = session->evlist; struct evsel *evsel; bool first = true; fprintf(out, "=================================================\n"); fprintf(out, " c2c details \n"); fprintf(out, "===...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-c2c.c
static void perf_c2c__hists_fprintf(FILE *out, struct perf_session *session) { setup_pager(); print_c2c__display_stats(out); fprintf(out, "\n"); print_shared_cacheline_info(out); fprintf(out, "\n"); print_c2c_info(out, session); if (c2c.stats_only) return; fprintf(out, "\n"); fprintf(out, "===...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-c2c.c
static void perf_c2c_display(struct perf_session *session) { use_browser = 0; perf_c2c__hists_fprintf(stdout, session); } #endif
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-c2c.c
static char *fill_line(const char *orig, int len) { int i, j, olen = strlen(orig); char *buf; buf = zalloc(len + 1); if (!buf) return NULL; j = len / 2 - olen / 2; for (i = 0; i < j - 1; i++) buf[i] = '-'; buf[i++] = ' '; strcpy(buf + i, orig); i += olen; buf[i++] = ' '; for (; i ...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-c2c.c
static int ui_quirks(void) { const char *nodestr = "Data address"; char *buf; if (!c2c.use_stdio) { dim_offset.width = 5; dim_offset.header = header_offset_tui; nodestr = "CL"; } dim_percent_costly_snoop.header = percent_costly_snoop_header[c2c.display]; buf = fill_line("Cacheline", dim...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-c2c.c
static int parse_callchain_opt(const struct option *opt, const char *arg, int unset) { struct callchain_param *callchain = opt->value; callchain->enabled = !unset; if (unset) { symbol_conf.use_callchain = false; callchain->mode = CHAIN_NONE; return 0; } return par...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-c2c.c
static int setup_display(const char *str) { const char *display = str; if (!strcmp(display, "tot")) c2c.display = DISPLAY_TOT_HITM; else if (!strcmp(display, "rmt")) c2c.display = DISPLAY_RMT_HITM; else if (!strcmp(display, "lcl")) c2c.display = DISPLAY_LCL_HITM; else if (!strcmp(display, "peer"...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-c2c.c
static int parse_record_events(const struct option *opt, const char *str, int unset __maybe_unused) { bool *event_set = (bool *)opt->value; if (!strcmp(str, "list")) { perf_mem_events__list(); exit(0); } if (perf_mem_events__parse(str)) exit(-1); *event_set = true...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-config.c
static int show_spec_config(struct perf_config_set *set, const char *var) { struct perf_config_section *section; struct perf_config_item *item; if (set == NULL) return -1; perf_config_items__for_each_entry(&set->sections, section) { if (!strstarts(var, section->name)) continue; perf_config...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-daemon.c
static void sig_handler(int sig __maybe_unused) { done = true; }
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-daemon.c
static int get_session_name(const char *var, char *session, int len) { const char *p = var + sizeof("session-") - 1; while (*p != '.' && *p != 0x0 && len--) *session++ = *p++; *session = 0; return *p == '.' ? 0 : -EINVAL; }
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-daemon.c
static int server_config(const char *var, const char *value, void *cb) { struct daemon *daemon = cb; if (strstarts(var, "session-")) { return session_config(daemon, var, value); } else if (!strcmp(var, "daemon.base") && !daemon->base_user) { if (daemon->base && strcmp(daemon->base, value)) { pr_er...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-daemon.c
static pid_t handle_signalfd(struct daemon *daemon) { struct daemon_session *session; struct signalfd_siginfo si; ssize_t err; int status; pid_t pid; err = read(daemon->signal_fd, &si, sizeof(struct signalfd_siginfo)); if (err != sizeof(struct signalfd_siginfo)) { pr_err("failed to read signal fd\n")...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-daemon.c
static int daemon_session__wait(struct daemon_session *session, struct daemon *daemon, int secs) { struct pollfd pollfd = { .fd = daemon->signal_fd, .events = POLLIN, }; time_t start; start = time(NULL); do { int err = poll(&pollfd, 1, 1000); if (err > 0...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-daemon.c
static int daemon__wait(struct daemon *daemon, int secs) { struct pollfd pollfd = { .fd = daemon->signal_fd, .events = POLLIN, }; time_t start; start = time(NULL); do { int err = poll(&pollfd, 1, 1000); if (err > 0) { handle_signalfd(daemon); } else if (err < 0) { perro...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-daemon.c
static int setup_server_socket(struct daemon *daemon) { struct sockaddr_un addr; char path[PATH_MAX]; int fd = socket(AF_UNIX, SOCK_STREAM, 0); if (fd < 0) { fprintf(stderr, "socket: %s\n", strerror(errno)); return -1; } if (fcntl(fd, F_SETFD, FD_CLOEXEC)) { perror("failed: fcntl FD_CLOEXEC")...
[ 1, 0 ]