Projectname
large_stringclasses
15 values
Filepath
large_stringlengths
4
106
⌀
Function
large_stringlengths
11
3.45k
Label
list
Linux Kernel
tools/perf/builtin-report.c
static void sig_handler(int sig __maybe_unused) { session_done = 1; }
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-report.c
static int report__browse_hists(struct report *rep) { int ret; struct perf_session *session = rep->session; struct evlist *evlist = session->evlist; char *help = NULL, *path = NULL; path = system_path(TIPDIR); if (perf_tip(&help, path) || help == NULL) { free(path); path = system_path(DOCDIR); ...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-report.c
static void tasks_setup(struct report *rep) { memset(&rep->tool, 0, sizeof(rep->tool)); rep->tool.ordered_events = true; if (rep->mmaps_mode) { rep->tool.mmap = perf_event__process_mmap; rep->tool.mmap2 = perf_event__process_mmap2; } rep->tool.attr = process_attr; rep->tool.comm = perf_event__proce...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-report.c
static int tasks_print(struct report *rep, FILE *fp) { struct perf_session *session = rep->session; struct machine *machine = &session->machines.host; struct task *tasks, *task; unsigned int nr = 0, itask = 0, i; struct rb_node *nd; LIST_HEAD(list); /* Count all the threads. */ for (i = 0; i < THREADS_...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-sched.c
static void calibrate_sleep_measurement_overhead(struct perf_sched *sched) { u64 T0, T1, delta, min_delta = NSEC_PER_SEC; int i; for (i = 0; i < 10; i++) { T0 = get_nsecs(); sleep_nsecs(10000); T1 = get_nsecs(); delta = T1 - T0; min_delta = min(min_delta, delta); } min_delta -= 10000; ...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-sched.c
static void add_sched_event_sleep(struct perf_sched *sched, struct task_desc *task, u64 timestamp, u64 task_state __maybe_unused) { struct sched_atom *event = get_new_event(task, timestamp); event->type = SCHED_EVENT_SLEEP; sched->nr_sleep_eve...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-sched.c
static struct task_desc *register_pid(struct perf_sched *sched, unsigned long pid, const char *comm) { struct task_desc *task; static int pid_max; if (sched->pid_to_task == NULL) { if (sysctl__read_int("kernel/pid_max", &pid_max) < 0) pid_max = MAX_PID; BUG_ON(...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-sched.c
static void add_cross_task_wakeups(struct perf_sched *sched) { struct task_desc *task1, *task2; unsigned long i, j; for (i = 0; i < sched->nr_tasks; i++) { task1 = sched->tasks[i]; j = i + 1; if (j == sched->nr_tasks) j = 0; task2 = sched->tasks[j]; add_sched_event_wakeup(sched, task1,...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-sched.c
static void perf_sched__process_event(struct perf_sched *sched, struct sched_atom *atom) { int ret = 0; switch (atom->type) { case SCHED_EVENT_RUN: burn_nsecs(sched, atom->duration); break; case SCHED_EVENT_SLEEP: if (atom->wait_sem) ret = sem_wait(atom-...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-sched.c
static int self_open_counters(struct perf_sched *sched, unsigned long cur_task) { struct perf_event_attr attr; char sbuf[STRERR_BUFSIZE], info[STRERR_BUFSIZE]; int fd; struct rlimit limit; bool need_privilege = false; memset(&attr, 0, sizeof(attr)); attr.type = PERF_TYPE_S...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-sched.c
static void *thread_func(void *ctx) { struct sched_thread_parms *parms = ctx; struct task_desc *this_task = parms->task; struct perf_sched *sched = parms->sched; u64 cpu_usage_0, cpu_usage_1; unsigned long i, ret; char comm2[22]; int fd = parms->fd; zfree(&parms); sprintf(comm2, ":%s", this_task->c...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-sched.c
static void create_tasks(struct perf_sched *sched) EXCLUSIVE_LOCK_FUNCTION(sched->start_work_mutex) EXCLUSIVE_LOCK_FUNCTION(sched->work_done_wait_mutex) { struct task_desc *task; pthread_attr_t attr; unsigned long i; int err; err = pthread_attr_init(&attr); BUG_ON(err); err = pthread_attr_se...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-sched.c
static void wait_for_tasks(struct perf_sched *sched) EXCLUSIVE_LOCKS_REQUIRED(sched->work_done_wait_mutex) EXCLUSIVE_LOCKS_REQUIRED(sched->start_work_mutex) { u64 cpu_usage_0, cpu_usage_1; struct task_desc *task; unsigned long i, ret; sched->start_time = get_nsecs(); sched->cpu_usage = 0; mute...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-sched.c
static void run_one_test(struct perf_sched *sched) EXCLUSIVE_LOCKS_REQUIRED(sched->work_done_wait_mutex) EXCLUSIVE_LOCKS_REQUIRED(sched->start_work_mutex) { u64 T0, T1, delta, avg_delta, fluct; T0 = get_nsecs(); wait_for_tasks(sched); T1 = get_nsecs(); delta = T1 - T0; sched->sum_runtime += de...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-sched.c
static void test_calibrations(struct perf_sched *sched) { u64 T0, T1; T0 = get_nsecs(); burn_nsecs(sched, NSEC_PER_MSEC); T1 = get_nsecs(); printf("the run test took %" PRIu64 " nsecs\n", T1 - T0); T0 = get_nsecs(); sleep_nsecs(NSEC_PER_MSEC); T1 = get_nsecs(); printf("the sleep test took %" PRIu...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-sched.c
static int replay_fork_event(struct perf_sched *sched, union perf_event *event, struct machine *machine) { struct thread *child, *parent; child = machine__findnew_thread(machine, event->fork.pid, event->fork.tid); parent = machine__findnew_thread(machine, event->fork.ppid, event->fo...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-sched.c
static void add_sched_in_event(struct work_atoms *atoms, u64 timestamp) { struct work_atom *atom; u64 delta; if (list_empty(&atoms->work_list)) return; atom = list_entry(atoms->work_list.prev, struct work_atom, list); if (atom->state != THREAD_WAIT_CPU) return; if (timestamp < atom->wake_up_tim...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-sched.c
static int latency_wakeup_event(struct perf_sched *sched, struct evsel *evsel, struct perf_sample *sample, struct machine *machine) { const u32 pid = evsel__intval(evsel, sample, "pid"); struct work_atoms *atoms; struct work_atom *atom; struct thre...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-sched.c
static int latency_migrate_task_event(struct perf_sched *sched, struct evsel *evsel, struct perf_sample *sample, struct machine *machine) { const u32 pid = evsel__intval(evsel, sample, "pid"); u64 times...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-sched.c
static int pid_cmp(struct work_atoms *l, struct work_atoms *r) { if (l->thread == r->thread) return 0; if (l->thread->tid < r->thread->tid) return -1; if (l->thread->tid > r->thread->tid) return 1; return (int)(l->thread - r->thread); }
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-sched.c
static int max_cmp(struct work_atoms *l, struct work_atoms *r) { if (l->max_lat < r->max_lat) return -1; if (l->max_lat > r->max_lat) return 1; return 0; }
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-sched.c
static int runtime_cmp(struct work_atoms *l, struct work_atoms *r) { if (l->total_runtime < r->total_runtime) return -1; if (l->total_runtime > r->total_runtime) return 1; return 0; }
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-sched.c
static int process_sched_wakeup_event(struct perf_tool *tool, struct evsel *evsel, struct perf_sample *sample, struct machine *machine) { struct perf_sched *sched = container_of(tool, struct perf_sched, ...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-sched.c
static struct thread *map__findnew_thread(struct perf_sched *sched, struct machine *machine, pid_t pid, pid_t tid) { struct thread *thread = machine__findnew_thread(machine, pid, tid); union map_priv priv = { .color = false, ...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-sched.c
static int process_sched_switch_event(struct perf_tool *tool, struct evsel *evsel, struct perf_sample *sample, struct machine *machine) { struct perf_sched *sched = container_of(tool, struct perf_sched, t...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-sched.c
static int perf_sched__process_fork_event(struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine) { struct perf_sched *sched = container_of(tool, ...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-sched.c
static int perf_sched__read_events(struct perf_sched *sched) { const struct evsel_str_handler handlers[] = { { "sched:sched_switch", process_sched_switch_event, }, { "sched:sched_stat_runtime", process_sched_runtime_event, }, { "sched:sc...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-sched.c
static void timehist_header(struct perf_sched *sched) { u32 ncpus = sched->max_cpu.cpu + 1; u32 i, j; printf("%15s %6s ", "time", "cpu"); if (sched->show_cpu_visual) { printf(" "); for (i = 0, j = 0; i < ncpus; ++i) { printf("%x", j++); if (j > 15) j = 0; } printf(" "); }...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-sched.c
static char task_state_char(struct thread *thread, int state) { static const char state_to_char[] = TASK_STATE_TO_CHAR_STR; unsigned bit = state ? ffs(state) : 0; if (thread->tid == 0) return 'I'; return bit < sizeof(state_to_char) - 1 ? state_to_char[bit] : '?'; }
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-sched.c
static int timehist_sched_wakeup_event(struct perf_tool *tool, union perf_event *event __maybe_unused, struct evsel *evsel, struct perf_sample *sample, struct machi...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-sched.c
static int process_lost(struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample, struct machine *machine __maybe_unused) { char tstr[64]; timestamp__scnprintf_usec(sample->time, tstr, sizeof(tstr)); printf("%15s ", tstr); print...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-sched.c
static void print_thread_runtime(struct thread *t, struct thread_runtime *r) { double mean = avg_stats(&r->run_stats); float stddev; printf("%*s %5d %9" PRIu64 " ", comm_width, timehist_get_commstr(t), t->ppid, (u64)r->run_stats.n); print_sched_time(r->total_run_time, 8); stddev = rel_stddev_s...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-sched.c
static size_t callchain__fprintf_folded(FILE *fp, struct callchain_node *node) { const char *sep = " <- "; struct callchain_list *chain; size_t ret = 0; char bf[1024]; bool first; if (node == NULL) return 0; ret = callchain__fprintf_folded(fp, node->parent); first = (ret == 0); list_for_each_e...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-sched.c
static size_t timehist_print_idlehist_callchain(struct rb_root_cached *root) { size_t ret = 0; FILE *fp = stdout; struct callchain_node *chain; struct rb_node *rb_node = rb_first_cached(root); printf(" %16s %8s %s\n", "Idle time (msec)", "Count", "Callchains"); printf(" %.16s %.8s %.50s\n", graph_dot...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-sched.c
static void __merge_work_atoms(struct rb_root_cached *root, struct work_atoms *data) { struct rb_node **new = &(root->rb_root.rb_node), *parent = NULL; struct work_atoms *this; const char *comm = thread__comm_str(data->thread), *this_comm; bool leftmost = true; while (*new) { ...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-sched.c
static int perf_sched__lat(struct perf_sched *sched) { struct rb_node *next; setup_pager(); if (perf_sched__read_events(sched)) return -1; perf_sched__merge_lat(sched); perf_sched__sort_lat(sched); printf( "\n " "------------------------------------------------------------------------" ...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-sched.c
static int perf_sched__replay(struct perf_sched *sched) { unsigned long i; calibrate_run_measurement_overhead(sched); calibrate_sleep_measurement_overhead(sched); test_calibrations(sched); if (perf_sched__read_events(sched)) return -1; printf("nr_run_events: %ld\n", sched->nr_run_events); ...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-script.c
static void evsel_script__delete(struct evsel_script *es) { zfree(&es->filename); fclose(es->fp); es->fp = NULL; free(es); }
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-script.c
static int perf_sample__fprintf_iregs(struct perf_sample *sample, struct perf_event_attr *attr, const char *arch, FILE *fp) { return perf_sample__fprintf_regs(&sample->intr_regs, attr->sample_regs_intr, arc...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-script.c
static inline char mispred_str(struct branch_entry *br) { if (!(br->flags.mispred || br->flags.predicted)) return '-'; return br->flags.predicted ? 'P' : 'M'; }
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-script.c
static int perf_sample__fprintf_brstack(struct perf_sample *sample, struct thread *thread, struct perf_event_attr *attr, FILE *fp) { struct branch_stack *br = sample->branch_stack; struct branch_...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-script.c
static int perf_sample__fprintf_brstacksym(struct perf_sample *sample, struct thread *thread, struct perf_event_attr *attr, FILE *fp) { struct branch_stack *br = sample->branch_stack; st...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-script.c
static int print_srccode(struct thread *thread, u8 cpumode, uint64_t addr) { struct addr_location al; int ret = 0; memset(&al, 0, sizeof(al)); thread__find_map(thread, cpumode, addr, &al); if (!al.map) return 0; ret = map__fprintf_srccode(al.map, al.addr, stdout, &thread->srccode_state); if (ret) ...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-script.c
static int ip__fprintf_sym(uint64_t addr, struct thread *thread, u8 cpumode, int cpu, struct symbol **lastsym, struct perf_event_attr *attr, FILE *fp) { struct addr_location al; int off, printed = 0; memset(&al, 0, sizeof(al)); thread__find_map(thread, cp...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-script.c
static int perf_sample__fprintf_callindent(struct perf_sample *sample, struct evsel *evsel, struct thread *thread, struct addr_location *al, struct addr_location *addr_al, FILE *fp) { struct perf_event_attr *attr = &evsel->core.attr; size_t depth = thr...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-script.c
static int perf_sample__fprintf_insn(struct perf_sample *sample, struct perf_event_attr *attr, struct thread *thread, struct machine *machine, FILE *fp) { int printed = 0; script_fetch_insn(sample, threa...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-script.c
static int sample__fprintf_bpf_output(enum binary_printer_ops op, unsigned int val, void *extra, FILE *fp) { unsigned char ch = (unsigned char)val; struct printer_data *printer_data = extra; int printed = 0; switch (op) { case BINARY_PRINT_DATA_BEGIN: printed += fpr...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-script.c
static int perf_sample__fprintf_synth_ptwrite(struct perf_sample *sample, FILE *fp) { struct perf_synth_intel_ptwrite *data = perf_sample__synth_ptr(sample); char str[sizeof(u64) + 1] = ""; int len; u64 val; if (perf_sample__bad_synth_size(sample, *data)) re...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-script.c
static int perf_sample__fprintf_synth_mwait(struct perf_sample *sample, FILE *fp) { struct perf_synth_intel_mwait *data = perf_sample__synth_ptr(sample); int len; if (perf_sample__bad_synth_size(sample, *data)) return 0; len = fprintf(fp, " hints: %#x extension...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-script.c
static int perf_sample__fprintf_synth_cbr(struct perf_sample *sample, FILE *fp) { struct perf_synth_intel_cbr *data = perf_sample__synth_ptr(sample); unsigned int percent, freq; int len; if (perf_sample__bad_synth_size(sample, *data)) return 0; freq = (le32_to_...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-script.c
static int perf_sample__fprintf_synth_iflag_chg(struct perf_sample *sample, FILE *fp) { struct perf_synth_intel_iflag_chg *data = perf_sample__synth_ptr(sample); int len; if (perf_sample__bad_synth_size(sample, *data)) return 0; len = fprintf(fp, " IFLAG: %...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-script.c
static void process_stat_interval(u64 tstamp) { if (scripting_ops && scripting_ops->process_stat_interval) scripting_ops->process_stat_interval(tstamp); }
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-script.c
static void setup_scripting(void) { setup_perl_scripting(); setup_python_scripting(); }
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-script.c
static int process_attr(struct perf_tool *tool, union perf_event *event, struct evlist **pevlist) { struct perf_script *scr = container_of(tool, struct perf_script, tool); struct evlist *evlist; struct evsel *evsel, *pos; u64 sample_type; int err; static struct evsel_script *es; e...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-script.c
static int process_bpf_events(struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample, struct machine *machine) { if (machine__process_ksymbol(machine, event, sample) < 0) return -1; re...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-script.c
static int process_text_poke_events(struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine) { if (perf_event__process_text_poke(tool, event, sample, machine) < 0) ...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-script.c
static void perf_script__exit(struct perf_script *script) { perf_thread_map__put(script->threads); perf_cpu_map__put(script->cpus); }
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-script.c
static struct script_spec *script_spec__new(const char *spec, struct scripting_ops *ops) { struct script_spec *s = malloc(sizeof(*s) + strlen(spec) + 1); if (s != NULL) { strcpy(s->spec, spec); s->ops = ops; } return s; }
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-script.c
int script_spec_register(const char *spec, struct scripting_ops *ops) { struct script_spec *s; s = script_spec__find(spec); if (s) return -1; s = script_spec__new(spec, ops); if (!s) return -1; else script_spec__add(s); return 0; }
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-script.c
static char *find_script(const char *script) { char path[PATH_MAX]; if (!scripting_ops) { const char *ext = strrchr(script, '.'); if (!ext) return NULL; scripting_ops = script_spec__lookup(++ext); if (!scripting_ops) return NULL; } if (access(script, R_OK)) { char *exec_path ...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-script.c
static struct script_desc *script_desc__findnew(const char *name) { struct script_desc *s = script_desc__find(name); if (s) return s; s = script_desc__new(name); if (!s) return NULL; script_desc__add(s); return s; }
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-script.c
static const char *ends_with(const char *str, const char *suffix) { size_t suffix_len = strlen(suffix); const char *p = str; if (strlen(str) > suffix_len) { p = str + strlen(str) - suffix_len; if (!strncmp(p, suffix, suffix_len)) return p; } return NULL; }
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-script.c
static int read_script_info(struct script_desc *desc, const char *filename) { char line[BUFSIZ], *p; FILE *fp; fp = fopen(filename, "r"); if (!fp) return -1; while (fgets(line, sizeof(line), fp)) { p = skip_spaces(line); if (strlen(p) == 0) continue; if (*p != '#') continue; ...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-script.c
static char *get_script_root(struct dirent *script_dirent, const char *suffix) { char *script_root, *str; script_root = strdup(script_dirent->d_name); if (!script_root) return NULL; str = (char *)ends_with(script_root, suffix); if (!str) { free(script_root); return NULL; } *str = '\0'; r...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-script.c
static int add_dlarg(const struct option *opt __maybe_unused, const char *s, int unset __maybe_unused) { char *arg = strdup(s); void *a; if (!arg) return -1; a = realloc(dlargv, sizeof(dlargv[0]) * (dlargc + 1)); if (!a) { free(arg); return -1; } dlargv = a; dlargv[d...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-script.c
static bool is_top_script(const char *script_path) { return ends_with(script_path, "top") != NULL; }
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-script.c
static int set_maps(struct perf_script *script) { struct evlist *evlist = script->session->evlist; if (!script->cpus || !script->threads) return 0; if (WARN_ONCE(script->allocated, "stats double allocation\n")) return -EINVAL; perf_evlist__set_maps(&evlist->core, script->cpus, script->threads); i...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-script.c
static int process_thread_map_event(struct perf_session *session, union perf_event *event) { struct perf_tool *tool = session->tool; struct perf_script *script = container_of(tool, struct perf_script, tool); if (dump_trace) perf_event__fprintf_thread_map(event, stdout); ...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-script.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-script.c
static int perf_script__process_auxtrace_info(struct perf_session *session, union perf_event *event) { struct perf_tool *tool = session->tool; int ret = perf_event__process_auxtrace_info(session, event); if (ret == 0) { struct perf_script *script = container_of(...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-stat.c
static bool cpus_map_matched(struct evsel *a, struct evsel *b) { if (!a->core.cpus && !b->core.cpus) return true; if (!a->core.cpus || !b->core.cpus) return false; if (perf_cpu_map__nr(a->core.cpus) != perf_cpu_map__nr(b->core.cpus)) return false; for (int i = 0; i < perf_cpu_map__nr(a->core.cpu...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-stat.c
static void evlist__check_cpu_maps(struct evlist *evlist) { struct evsel *evsel, *pos, *leader; char buf[1024]; if (evlist__has_hybrid(evlist)) evlist__warn_hybrid_group(evlist); evlist__for_each_entry(evlist, evsel) { leader = evsel__leader(evsel); if (leader == evsel) continue; if (cp...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-stat.c
static int read_counter_cpu(struct evsel *counter, struct timespec *rs, int cpu_map_idx) { int nthreads = perf_thread_map__nr(evsel_list->core.threads); int thread; if (!counter->supported) return -ENOENT; for (thread = 0; thread < nthreads; thread++) { struct perf_counts_v...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-stat.c
static int read_bpf_map_counters(void) { struct evsel *counter; int err; evlist__for_each_entry(evsel_list, counter) { if (!evsel__is_bpf(counter)) continue; err = bpf_counter__read(counter); if (err) return err; } return 0; }
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-stat.c
static void disable_counters(void) { struct evsel *counter; if (!target__none(&target)) { evlist__for_each_entry(evsel_list, counter) bpf_counter__disable(counter); if (!all_counters_use_bpf) evlist__disable(evsel_list); } }
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-stat.c
static bool is_target_alive(struct target *_target, struct perf_thread_map *threads) { struct stat st; int i; if (!target__has_task(_target)) return true; for (i = 0; i < threads->nr; i++) { char path[PATH_MAX]; scnprintf(path, PATH_MAX, "%s/%d", procfs__mountpoint(),...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-stat.c
static int dispatch_events(bool forks, int timeout, int interval, int *times) { int child_exited = 0, status = 0; int time_to_sleep, sleep_time; struct timespec time_start, time_stop; if (interval) sleep_time = interval; else if (timeout) sleep_time = timeout; else sleep_time = 1000; time_to...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-stat.c
static int run_perf_stat(int argc, const char **argv, int run_idx) { int ret; if (pre_cmd) { ret = system(pre_cmd); if (ret) return ret; } if (sync_run) sync(); ret = __run_perf_stat(argc, argv, run_idx); if (ret) return ret; if (post_cmd) { ret = system(post_cmd); if (r...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-stat.c
static void sig_atexit(void) { sigset_t set, oset; sigemptyset(&set); sigaddset(&set, SIGCHLD); sigprocmask(SIG_BLOCK, &set, &oset); if (child_pid != -1) kill(child_pid, SIGTERM); sigprocmask(SIG_SETMASK, &oset, NULL); if (signr == -1) return; signal(signr, SIG_DFL); kill(getpid(), signr)...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-stat.c
static struct aggr_cpu_id perf_stat__get_socket(struct perf_stat_config *config __maybe_unused, struct perf_cpu cpu) { return aggr_cpu_id__socket(cpu, NULL); }
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-stat.c
static struct aggr_cpu_id perf_stat__get_core(struct perf_stat_config *config __maybe_unused, struct perf_cpu cpu) { return aggr_cpu_id__core(cpu, NULL); }
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-stat.c
static struct aggr_cpu_id perf_stat__get_aggr(struct perf_stat_config *config, aggr_get_id_t get_id, struct perf_cpu cpu) { struct aggr_cpu_id id = aggr_cpu_id__empty(); if (aggr_cpu_id__is_empty(&config->cpus_aggr_map->ma...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-stat.c
static struct aggr_cpu_id perf_stat__get_socket_cached(struct perf_stat_config *config, struct perf_cpu cpu) { return perf_stat__get_aggr(config, perf_stat__get_socket, cpu); }
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-stat.c
static bool term_percore_set(void) { struct evsel *counter; evlist__for_each_entry(evsel_list, counter) { if (counter->percore) return true; } return false; }
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-stat.c
static void cpu_aggr_map__delete(struct cpu_aggr_map *map) { if (map) { WARN_ONCE(refcount_read(&map->refcnt) != 0, "cpu_aggr_map refcnt unbalanced\n"); free(map); } }
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-stat.c
static void perf_stat__exit_aggr_mode(void) { cpu_aggr_map__put(stat_config.aggr_map); cpu_aggr_map__put(stat_config.cpus_aggr_map); stat_config.aggr_map = NULL; stat_config.cpus_aggr_map = NULL; }
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-stat.c
static struct aggr_cpu_id perf_env__get_core_aggr_by_cpu(struct perf_cpu cpu, void *data) { struct perf_env *env = data; struct aggr_cpu_id id = aggr_cpu_id__empty(); if (cpu.cpu != -1) { id.socket = env->cpu[cpu.cpu].socket_id; id.die = env->cpu[...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-stat.c
static struct aggr_cpu_id perf_stat__get_die_file(struct perf_stat_config *config __maybe_unused, struct perf_cpu cpu) { return perf_env__get_die_aggr_by_cpu(cpu, &perf_stat.session->header.env); }
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-stat.c
static struct aggr_cpu_id perf_stat__get_node_file(struct perf_stat_config *config __maybe_unused, struct perf_cpu cpu) { return perf_env__get_node_aggr_by_cpu(cpu, &perf_stat.session->header.env); }
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-stat.c
static void init_features(struct perf_session *session) { int feat; for (feat = HEADER_FIRST_FEATURE; feat < HEADER_LAST_FEATURE; feat++) perf_header__set_feat(&session->header, feat); perf_header__clear_feat(&session->header, HEADER_DIR_FORMAT); perf_header__clear_feat(&session->header, HEADER_BUILD_ID)...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-stat.c
static int process_thread_map_event(struct perf_session *session, union perf_event *event) { struct perf_tool *tool = session->tool; struct perf_stat *st = container_of(tool, struct perf_stat, tool); if (st->threads) { pr_warning("Extra thread map event, ignoring.\n"); ...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-stat.c
static int process_cpu_map_event(struct perf_session *session, union perf_event *event) { struct perf_tool *tool = session->tool; struct perf_stat *st = container_of(tool, struct perf_stat, tool); struct perf_cpu_map *cpus; if (st->cpus) { pr_warning("Extra cpu map event, ...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-stat.c
static void setup_system_wide(int forks) { if (!target__none(&target)) return; if (!forks) target.system_wide = true; else { struct evsel *counter; evlist__for_each_entry(evsel_list, counter) { if (!counter->core.requires_cpu && strcmp(counter->name, "duration_time")) { ...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-timechart.c
static struct per_pid *find_create_pid(struct timechart *tchart, int pid) { struct per_pid *cursor = tchart->all_data; while (cursor) { if (cursor->pid == pid) return cursor; cursor = cursor->next; } cursor = zalloc(sizeof(*cursor)); assert(cursor != NULL); cursor->pid = pid; cursor->next...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-timechart.c
static int process_exit_event(struct perf_tool *tool, union perf_event *event, struct perf_sample *sample __maybe_unused, struct machine *machine __maybe_unused) { struct timechart *tchart = container_of(tool, struct timechart, tool); pid_exit(tchart, eve...
[ 0, 0 ]
Linux Kernel
tools/perf/builtin-timechart.c
static void p_state_change(struct timechart *tchart, int cpu, u64 timestamp, u64 new_freq) { struct power_event *pwr; if (new_freq > 8000000) return; pwr = p_state_end(tchart, cpu, timestamp); if (!pwr) return; cpus_pstate_state[cpu] = new_freq; cpus_pstate_start_times[...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-timechart.c
static void sched_switch(struct timechart *tchart, int cpu, u64 timestamp, int prev_pid, int next_pid, u64 prev_state, const char *backtrace) { struct per_pid *p = NULL, *prev_p; prev_p = find_create_pid(tchart, prev_pid); p = find_create_pid(tchart, next_pid);...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-timechart.c
static const char *cat_backtrace(union perf_event *event, struct perf_sample *sample, struct machine *machine) { struct addr_location al; unsigned int i; char *p = NULL; size_t p_len; u8 cpumode = PERF_RECORD_MISC_USER; struct addr_location t...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-timechart.c
static int process_sample_event(struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct evsel *evsel, struct machine *machine) { struct timechart *tchart = container_of(tool, struct timechart, tool); if (evsel->core.attr.s...
[ 1, 0 ]
Linux Kernel
tools/perf/builtin-timechart.c
static int process_enter_poll(struct timechart *tchart, struct evsel *evsel, struct perf_sample *sample) { long fd = evsel__intval(evsel, sample, "fd"); return pid_begin_io_sample(tchart, sample->tid, IOTYPE_POLL, sample->time, fd); }
[ 0, 0 ]