Projectname large_stringclasses 15
values | Filepath large_stringlengths 4 106 ⌀ | Function large_stringlengths 11 3.45k | Label list |
|---|---|---|---|
Linux Kernel | tools/perf/builtin-timechart.c | static void sort_pids(struct timechart *tchart) {
struct per_pid *new_list, *p, *cursor, *prev;
new_list = NULL;
while (tchart->all_data) {
p = tchart->all_data;
tchart->all_data = p->next;
p->next = NULL;
if (new_list == NULL) {
new_list = p;
p->next = NULL;
continue;
}
... | [
1,
0
] |
Linux Kernel | tools/perf/builtin-timechart.c |
static void draw_cpu_usage(struct timechart *tchart) {
struct per_pid *p;
struct per_pidcomm *c;
struct cpu_sample *sample;
p = tchart->all_data;
while (p) {
c = p->all;
while (c) {
sample = c->samples;
while (sample) {
if (sample->type == TYPE_RUNNING) {
svg_process(sam... | [
0,
0
] |
Linux Kernel | tools/perf/builtin-timechart.c | static void draw_process_bars(struct timechart *tchart) {
struct per_pid *p;
struct per_pidcomm *c;
struct cpu_sample *sample;
int Y = 0;
Y = 2 * tchart->numcpus + 2;
p = tchart->all_data;
while (p) {
c = p->all;
while (c) {
if (!c->display) {
c->Y = 0;
c = c->next;
... | [
1,
0
] |
Linux Kernel | tools/perf/builtin-timechart.c | static int determine_display_io_tasks(struct timechart *timechart,
u64 threshold) {
struct per_pid *p;
struct per_pidcomm *c;
int count = 0;
p = timechart->all_data;
while (p) {
if (p->end_time == 0)
p->end_time = timechart->last_time;
c = p->all;
wh... | [
0,
0
] |
Linux Kernel | tools/perf/builtin-top.c |
static void perf_top__resize(struct perf_top *top) {
get_term_dimensions(&top->winsize);
perf_top__update_print_entries(top);
} | [
0,
0
] |
Linux Kernel | tools/perf/builtin-top.c |
static void ui__warn_map_erange(struct map *map, struct symbol *sym, u64 ip) {
struct utsname uts;
int err = uname(&uts);
ui__warning("Out of bounds address found:\n\n"
"Addr: %" PRIx64 "\n"
"DSO: %s %c\n"
"Map: %" PRIx64 "-%" PRIx64 "\n"
"Symbol: ... | [
1,
0
] |
Linux Kernel | tools/perf/builtin-top.c |
static void perf_top__show_details(struct perf_top *top) {
struct hist_entry *he = top->sym_filter_entry;
struct evsel *evsel;
struct annotation *notes;
struct symbol *symbol;
int more;
if (!he)
return;
evsel = hists_to_evsel(he->hists);
symbol = he->ms.sym;
notes = symbol__annotation(symbol);... | [
1,
0
] |
Linux Kernel | tools/perf/builtin-top.c |
static int perf_top__key_mapped(struct perf_top *top, int c) {
switch (c) {
case 'd':
case 'e':
case 'f':
case 'z':
case 'q':
case 'Q':
case 'K':
case 'U':
case 'F':
case 's':
case 'S':
return 1;
case 'E':
return top->evlist->core.nr_entries > 1 ? 1 : 0;
default:
break;
}
r... | [
1,
0
] |
Linux Kernel | tools/perf/builtin-top.c |
static void perf_top__sort_new_samples(void *arg) {
struct perf_top *t = arg;
if (t->evlist->selected != NULL)
t->sym_evsel = t->evlist->selected;
perf_top__resort_hists(t);
if (t->lost || t->drop)
pr_warning("Too slow to read ring buffer (change period (-c/-F) or limit "
"CPUs (-C)\n... | [
1,
0
] |
Linux Kernel | tools/perf/builtin-top.c | static void *display_thread_tui(void *arg) {
struct evsel *pos;
struct perf_top *top = arg;
const char *help =
"For a higher level overview, try: perf top --sort comm,dso";
struct hist_browser_timer hbt = {
.timer = perf_top__sort_new_samples,
.arg = top,
.refresh = top->delay_secs,
};... | [
1,
0
] |
Linux Kernel | tools/perf/builtin-top.c |
static void display_sig(int sig __maybe_unused) { stop_top(); } | [
0,
0
] |
Linux Kernel | tools/perf/builtin-top.c | static void *display_thread(void *arg) {
struct pollfd stdin_poll = {.fd = 0, .events = POLLIN};
struct termios save;
struct perf_top *top = arg;
int delay_msecs, c;
unshare(CLONE_FS);
prctl(PR_SET_NAME, "perf-top-UI", 0, 0, 0);
display_setup_sig();
pthread__unblock_sigwinch();
repeat:
delay_msecs ... | [
0,
0
] |
Linux Kernel | tools/perf/builtin-top.c |
static void perf_top__process_lost_samples(struct perf_top *top,
union perf_event *event,
struct evsel *evsel) {
top->lost += event->lost_samples.lost;
top->lost_total += event->lost_samples.lost;
evsel->evlist->stats.total_los... | [
1,
0
] |
Linux Kernel | tools/perf/builtin-top.c | static int parse_callchain_opt(const struct option *opt, const char *arg,
int unset) {
struct callchain_param *callchain = opt->value;
callchain->enabled = !unset;
callchain->record_mode = CALLCHAIN_FP;
if (unset) {
symbol_conf.use_callchain = false;
callchain->record_mo... | [
0,
0
] |
Linux Kernel | tools/perf/builtin-trace.c |
static void evsel_trace__delete(struct evsel_trace *et) {
if (et == NULL)
return;
zfree(&et->fmt);
free(et);
} | [
1,
0
] |
Linux Kernel | tools/perf/builtin-trace.c |
static int evsel__init_tp_ptr_field(struct evsel *evsel, struct tp_field *field,
const char *name) {
struct tep_format_field *format_field = evsel__field(evsel, name);
if (format_field == NULL)
return -1;
return tp_field__init_ptr(field, format_field);
}
#define perf_ev... | [
0,
0
] |
Linux Kernel | tools/perf/builtin-trace.c |
static int evsel__init_augmented_syscall_tp_args(struct evsel *evsel) {
struct syscall_tp *sc = __evsel__syscall_tp(evsel);
return __tp_field__init_ptr(&sc->args, sc->id.offset + sizeof(u64));
} | [
1,
0
] |
Linux Kernel | tools/perf/builtin-trace.c | static struct evsel *perf_evsel__raw_syscall_newtp(const char *direction,
void *handler) {
struct evsel *evsel = evsel__newtp("raw_syscalls", direction);
if (IS_ERR(evsel))
evsel = evsel__newtp("syscalls", direction);
if (IS_ERR(evsel))
return NULL;
... | [
0,
0
] |
Linux Kernel | tools/perf/builtin-trace.c |
bool syscall_arg__strtoul_strarray_flags(char *bf, size_t size,
struct syscall_arg *arg, u64 *ret) {
return strarray__strtoul_flags(arg->parm, bf, size, ret);
} | [
0,
0
] |
Linux Kernel | tools/perf/builtin-trace.c |
bool strarray__strtoul(struct strarray *sa, char *bf, size_t size, u64 *ret) {
int i;
for (i = 0; i < sa->nr_entries; ++i) {
if (sa->entries[i] && strncmp(sa->entries[i], bf, size) == 0 &&
sa->entries[i][size] == '\0') {
*ret = sa->offset + i;
return true;
}
}
return false;
} | [
0,
0
] |
Linux Kernel | tools/perf/builtin-trace.c |
static size_t syscall_arg__scnprintf_fd_at(char *bf, size_t size,
struct syscall_arg *arg) {
int fd = arg->val;
const char *prefix = "AT_FD";
if (fd == AT_FDCWD)
return scnprintf(bf, size, "%s%s", arg->show_string_prefix ? prefix : "",
"CWD");
... | [
0,
0
] |
Linux Kernel | tools/perf/builtin-trace.c |
size_t syscall_arg__scnprintf_hex(char *bf, size_t size,
struct syscall_arg *arg) {
return scnprintf(bf, size, "%#lx", arg->val);
} | [
0,
0
] |
Linux Kernel | tools/perf/builtin-trace.c |
size_t syscall_arg__scnprintf_long(char *bf, size_t size,
struct syscall_arg *arg) {
return scnprintf(bf, size, "%ld", arg->val);
} | [
0,
0
] |
Linux Kernel | tools/perf/builtin-trace.c | static size_t syscall_arg__scnprintf_access_mode(char *bf, size_t size,
struct syscall_arg *arg) {
bool show_prefix = arg->show_string_prefix;
const char *suffix = "_OK";
size_t printed = 0;
int mode = arg->val;
if (mode == F_OK)
return scnprintf(bf, size,... | [
1,
0
] |
Linux Kernel | tools/perf/builtin-trace.c |
static int syscall_fmt__cmp(const void *name, const void *fmtp) {
const struct syscall_fmt *fmt = fmtp;
return strcmp(name, fmt->name);
} | [
0,
0
] |
Linux Kernel | tools/perf/builtin-trace.c |
static struct syscall_fmt *syscall_fmt__find(const char *name) {
const int nmemb = ARRAY_SIZE(syscall_fmts);
return __syscall_fmt__find(syscall_fmts, nmemb, name);
} | [
0,
0
] |
Linux Kernel | tools/perf/builtin-trace.c |
size_t pid__scnprintf_fd(struct trace *trace, pid_t pid, int fd, char *bf,
size_t size) {
size_t printed = scnprintf(bf, size, "%d", fd);
struct thread *thread = machine__find_thread(trace->host, pid, pid);
if (thread) {
const char *path = thread__fd_path(thread, fd, trace);
if... | [
1,
0
] |
Linux Kernel | tools/perf/builtin-trace.c | static size_t syscall_arg__scnprintf_augmented_string(struct syscall_arg *arg,
char *bf, size_t size) {
struct augmented_arg *augmented_arg = arg->augmented.args;
size_t printed = scnprintf(bf, size, "\"%.*s\"", augmented_arg->size,
... | [
1,
0
] |
Linux Kernel | tools/perf/builtin-trace.c |
static size_t syscall_arg__scnprintf_filename(char *bf, size_t size,
struct syscall_arg *arg) {
unsigned long ptr = arg->val;
if (arg->augmented.args)
return syscall_arg__scnprintf_augmented_string(arg, bf, size);
if (!arg->trace->vfs_getname)
return scnpri... | [
1,
0
] |
Linux Kernel | tools/perf/builtin-trace.c |
static bool trace__filter_duration(struct trace *trace, double t) {
return t < (trace->duration_filter * NSEC_PER_MSEC);
} | [
0,
0
] |
Linux Kernel | tools/perf/builtin-trace.c |
static void sighandler_chld(int sig __maybe_unused, siginfo_t *info,
void *context __maybe_unused) {
if (info->si_pid == workload_pid)
done = true;
} | [
0,
0
] |
Linux Kernel | tools/perf/builtin-trace.c |
static size_t trace__fprintf_comm_tid(struct trace *trace,
struct thread *thread, FILE *fp) {
size_t printed = 0;
if (trace->multiple_threads) {
if (trace->show_comm)
printed += fprintf(fp, "%.14s/", thread__comm_str(thread));
printed += fprintf(fp, "%d ", threa... | [
0,
0
] |
Linux Kernel | tools/perf/builtin-trace.c |
static void trace__symbols__exit(struct trace *trace) {
machine__exit(trace->host);
trace->host = NULL;
symbol__exit();
} | [
0,
0
] |
Linux Kernel | tools/perf/builtin-trace.c |
static int syscall__set_arg_fmts(struct syscall *sc) {
struct tep_format_field *last_field =
syscall_arg_fmt__init_array(sc->arg_fmt, sc->args);
if (last_field)
sc->args_size = last_field->offset + last_field->size;
return 0;
} | [
1,
0
] |
Linux Kernel | tools/perf/builtin-trace.c | unsigned long syscall_arg__val(struct syscall_arg *arg, u8 idx) {
unsigned long val;
unsigned char *p = arg->args + sizeof(unsigned long) * idx;
memcpy(&val, p, sizeof(val));
return val;
} | [
1,
0
] |
Linux Kernel | tools/perf/dlfilters/dlfilter-show-cycles.c |
int filter_event(void *data, const struct perf_dlfilter_sample *sample,
void *ctx) {
__s32 cpu = sample->cpu;
__s32 tid = sample->tid;
int pos;
pos = event_entry(sample->event);
if (cpu >= 0 && cpu < MAX_CPU) {
print_vals(cycles[cpu][pos], cycles[cpu][pos] - cycles_rpt[cpu][pos]);
... | [
1,
0
] |
Linux Kernel | tools/perf/dlfilters/dlfilter-test-api-v0.c |
int filter_event(void *data, const struct perf_dlfilter_sample *sample,
void *ctx) {
pr_debug("%s API\n", __func__);
return do_checks(data, sample, ctx, false);
} | [
0,
0
] |
Linux Kernel | tools/perf/examples/bpf/augmented_raw_syscalls.c | int sys_enter_sendto(struct syscall_enter_args *args) {
struct augmented_args_payload *augmented_args = augmented_args_payload();
const void *sockaddr_arg = (const void *)args->args[4];
unsigned int socklen = args->args[5];
unsigned int len = sizeof(augmented_args->args);
if (augmented_args == NULL)
retu... | [
1,
0
] |
Linux Kernel | tools/perf/examples/bpf/augmented_raw_syscalls.c | int sys_enter_rename(struct syscall_enter_args *args) {
struct augmented_args_payload *augmented_args = augmented_args_payload();
const void *oldpath_arg = (const void *)args->args[0],
*newpath_arg = (const void *)args->args[1];
unsigned int len = sizeof(augmented_args->args), oldpath_len;
if (aug... | [
1,
0
] |
Linux Kernel | tools/perf/examples/bpf/augmented_raw_syscalls.c | int sys_enter_renameat(struct syscall_enter_args *args) {
struct augmented_args_payload *augmented_args = augmented_args_payload();
const void *oldpath_arg = (const void *)args->args[1],
*newpath_arg = (const void *)args->args[3];
unsigned int len = sizeof(augmented_args->args), oldpath_len;
if (a... | [
1,
0
] |
Linux Kernel | tools/perf/examples/bpf/hello.c |
int syscall_enter(openat)(void *args) {
puts("Hello, world\n");
return 0;
} | [
0,
0
] |
Linux Kernel | tools/perf/jvmti/jvmti_agent.c | static int get_e_machine(struct jitheader *hdr) {
ssize_t sret;
char id[16];
int fd, ret = -1;
struct {
uint16_t e_type;
uint16_t e_machine;
} info;
fd = open("/proc/self/exe", O_RDONLY);
if (fd == -1)
return -1;
sret = read(fd, id, sizeof(id));
if (sret != sizeof(id))
goto error;
... | [
1,
0
] |
Linux Kernel | tools/perf/jvmti/jvmti_agent.c |
static inline uint64_t timespec_to_ns(const struct timespec *ts) {
return ((uint64_t)ts->tv_sec * NSEC_PER_SEC) + ts->tv_nsec;
} | [
0,
0
] |
Linux Kernel | tools/perf/jvmti/jvmti_agent.c |
static void init_arch_timestamp(void) {
char *str = getenv("JITDUMP_USE_ARCH_TIMESTAMP");
if (!str || !*str || !strcmp(str, "0"))
return;
use_arch_timestamp = 1;
} | [
0,
0
] |
Linux Kernel | tools/perf/perf.c |
static int browser_command_config(const char *var, const char *value,
void *data) {
struct pager_config *c = data;
if (same_cmd_with_prefix(var, c, "tui."))
c->val = perf_config_bool(var, value);
if (same_cmd_with_prefix(var, c, "gtk."))
c->val = perf_config_bool(var, va... | [
0,
0
] |
Linux Kernel | tools/perf/perf.c | static int check_browser_config(const char *cmd) {
int err;
struct pager_config c;
c.cmd = cmd;
c.val = -1;
err = perf_config(browser_command_config, &c);
return err ?: c.val;
} | [
0,
0
] |
Linux Kernel | tools/perf/perf.c | static void handle_internal_command(int argc, const char **argv) {
const char *cmd = argv[0];
unsigned int i;
if (argc > 1 && !strcmp(argv[1], "--help")) {
argv[1] = argv[0];
argv[0] = cmd = "help";
}
for (i = 0; i < ARRAY_SIZE(commands); i++) {
struct cmd_struct *p = commands + i;
if (p->fn... | [
1,
0
] |
Linux Kernel | tools/perf/perf.c | static void execv_dashed_external(const char **argv) {
char *cmd;
const char *tmp;
int status;
if (asprintf(&cmd, "perf-%s", argv[0]) < 0)
goto do_die;
tmp = argv[0];
argv[0] = cmd;
/*
* if we fail because the command is not found, it is
* OK to return. Otherwise, we just pass along the statu... | [
1,
0
] |
Linux Kernel | tools/perf/pmu-events/empty-pmu-events.c |
const struct pmu_events_table *find_core_events_table(const char *arch,
const char *cpuid) {
for (const struct pmu_events_map *tables = &pmu_events_map[0]; tables->arch;
tables++) {
if (!strcmp(tables->arch, arch) && !strcmp_cpuid_str(tables->cpuid, cp... | [
0,
0
] |
Linux Kernel | tools/perf/pmu-events/empty-pmu-events.c |
int pmu_for_each_core_event(pmu_event_iter_fn fn, void *data) {
for (const struct pmu_events_map *tables = &pmu_events_map[0]; tables->arch;
tables++) {
int ret = pmu_events_table_for_each_event(&tables->table, fn, data);
if (ret)
return ret;
}
return 0;
} | [
0,
0
] |
Linux Kernel | tools/perf/scripts/python/Perf-Trace-Util/Context.c |
static struct scripting_context *get_args(PyObject *args, const char *name,
PyObject **arg2) {
int cnt = 1 + !!arg2;
PyObject *context;
if (!PyArg_UnpackTuple(args, name, 1, cnt, &context, arg2))
return NULL;
return _PyCapsule_GetPointer(context, NULL);
} | [
0,
0
] |
Linux Kernel | tools/perf/scripts/python/Perf-Trace-Util/Context.c |
static struct scripting_context *get_scripting_context(PyObject *args) {
return get_args(args, "context", NULL);
} | [
0,
0
] |
Linux Kernel | tools/perf/scripts/python/Perf-Trace-Util/Context.c | static PyObject *perf_sample_insn(PyObject *obj, PyObject *args) {
struct scripting_context *c = get_scripting_context(args);
if (!c)
return NULL;
if (c->sample->ip && !c->sample->insn_len && c->al->thread->maps &&
c->al->thread->maps->machine)
script_fetch_insn(c->sample, c->al->thread, c->al->th... | [
1,
0
] |
Linux Kernel | tools/perf/scripts/python/Perf-Trace-Util/Context.c |
static PyObject *perf_sample_src(PyObject *obj, PyObject *args,
bool get_srccode) {
struct scripting_context *c = get_scripting_context(args);
unsigned int line = 0;
char *srcfile = NULL;
char *srccode = NULL;
PyObject *result;
struct map *map;
int len = 0;
u64 addr;
... | [
1,
0
] |
Linux Kernel | tools/perf/scripts/python/Perf-Trace-Util/Context.c |
static PyObject *perf_sample_srccode(PyObject *obj, PyObject *args) {
return perf_sample_src(obj, args, true);
} | [
0,
0
] |
Linux Kernel | tools/perf/scripts/python/Perf-Trace-Util/Context.c | PyMODINIT_FUNC initperf_trace_context(void) {
(void)Py_InitModule("perf_trace_context", ContextMethods);
}
#else | [
0,
0
] |
Linux Kernel | tools/perf/tests/api-io.c |
static int do_test_get_hex(const char *test_string, __u64 val1, int ch1,
__u64 val2, int ch2, __u64 val3, int ch3,
bool end_eof) {
char path[PATH_MAX];
struct io io;
int ch, ret = 0;
__u64 hex;
if (setup_test(path, test_string, 4, &io))
return -1;
... | [
0,
0
] |
Linux Kernel | tools/perf/tests/backward-ring-buffer.c |
static void testcase(void) {
int i;
for (i = 0; i < NR_ITERS; i++) {
char proc_name[15];
snprintf(proc_name, sizeof(proc_name), "p:%d\n", i);
prctl(PR_SET_NAME, proc_name);
}
} | [
1,
0
] |
Linux Kernel | tools/perf/tests/bitmap.c |
static unsigned long *get_bitmap(const char *str, int nbits) {
struct perf_cpu_map *map = perf_cpu_map__new(str);
unsigned long *bm = NULL;
int i;
bm = bitmap_zalloc(nbits);
if (map && bm) {
for (i = 0; i < perf_cpu_map__nr(map); i++)
set_bit(perf_cpu_map__cpu(map, i).cpu, bm);
}
if (map)
... | [
1,
0
] |
Linux Kernel | tools/perf/tests/bpf-script-test-kbuild.c | int bpf_func__vfs_llseek(void *ctx) { return 0; } | [
0,
0
] |
Linux Kernel | tools/perf/tests/bpf-script-test-relocation.c | int bpf_func__sys_write(void *ctx) {
int key = 0;
int value = 0;
bpf_map_update_elem(&this_is_a_global_val, &key, &value, 0);
return 0;
} | [
0,
0
] |
Linux Kernel | tools/perf/tests/bpf.c |
static struct bpf_object *prepare_bpf(void *obj_buf, size_t obj_buf_sz,
const char *name) {
struct bpf_object *obj;
obj = bpf__prepare_load_buffer(obj_buf, obj_buf_sz, name);
if (IS_ERR(obj)) {
pr_debug("Compile BPF program failed.\n");
return NULL;
}
return obj... | [
0,
0
] |
Linux Kernel | tools/perf/tests/bpf.c |
static int __test__bpf(int idx) {
int ret;
void *obj_buf;
size_t obj_buf_sz;
struct bpf_object *obj;
ret = test_llvm__fetch_bpf_obj(&obj_buf, &obj_buf_sz,
bpf_testcase_table[idx].prog_id, false, NULL);
if (ret != TEST_OK || !obj_buf || !obj_buf_sz) {
pr_debug("Unable t... | [
1,
0
] |
Linux Kernel | tools/perf/tests/bpf.c |
static int test__basic_bpf_test(struct test_suite *test __maybe_unused,
int subtest __maybe_unused) {
#ifdef HAVE_LIBBPF_SUPPORT
return test__bpf(0);
#else
pr_debug("Skip BPF test because BPF support is not compiled\n");
return TEST_SKIP;
#endif
} | [
0,
0
] |
Linux Kernel | tools/perf/tests/bpf.c |
static int test__bpf_pinning(struct test_suite *test __maybe_unused,
int subtest __maybe_unused) {
#ifdef HAVE_LIBBPF_SUPPORT
return test__bpf(1);
#else
pr_debug("Skip BPF test because BPF support is not compiled\n");
return TEST_SKIP;
#endif
} | [
0,
0
] |
Linux Kernel | tools/perf/tests/bp_account.c |
static int wp_event(void *addr, struct perf_event_attr *attr) {
return __event(false, addr, attr);
} | [
0,
0
] |
Linux Kernel | tools/perf/tests/bp_account.c |
static int detect_ioctl(void) {
struct perf_event_attr attr;
int fd, ret = 1;
fd = wp_event((void *)&the_var, &attr);
if (fd > 0) {
ret = ioctl(fd, PERF_EVENT_IOC_MODIFY_ATTRIBUTES, &attr);
close(fd);
}
return ret ? 0 : 1;
} | [
0,
0
] |
Linux Kernel | tools/perf/tests/bp_signal.c |
static int bp_event(void *addr, int sig) { return __event(true, addr, sig); } | [
0,
0
] |
Linux Kernel | tools/perf/tests/bp_signal_overflow.c |
static void sig_handler(int signum __maybe_unused, siginfo_t *oh __maybe_unused,
void *uc __maybe_unused) {
overflows++;
} | [
0,
0
] |
Linux Kernel | tools/perf/tests/builtin-test-list.c | const struct script_file *list_script_files(void) {
char path_dir[PATH_MAX];
const char *path;
if (files)
return files;
path = shell_tests__dir(path_dir, sizeof(path_dir)); /* Walk dir */
append_scripts_in_dir(path);
return files;
} | [
1,
0
] |
Linux Kernel | tools/perf/tests/builtin-test-list.c | int list_script_max_width(void) {
list_script_files();
return files_max_width;
} | [
0,
0
] |
Linux Kernel | tools/perf/tests/builtin-test.c |
static bool perf_test__matches(const char *desc, int curr, int argc,
const char *argv[]) {
int i;
if (argc == 0)
return true;
for (i = 0; i < argc; ++i) {
char *end;
long nr = strtoul(argv[i], &end, 10);
if (*end == '\0') {
if (nr == curr + 1)
retur... | [
0,
0
] |
Linux Kernel | tools/perf/tests/builtin-test.c |
static int run_test(struct test_suite *test, int subtest) {
int status, err = -1, child = dont_fork ? 0 : fork();
char sbuf[STRERR_BUFSIZE];
if (child < 0) {
pr_err("failed to fork test: %s\n", str_error_r(errno, sbuf, sizeof(sbuf)));
return -1;
}
if (!child) {
if (!dont_fork) {
pr_debug(... | [
1,
0
] |
Linux Kernel | tools/perf/tests/builtin-test.c |
static int test_and_print(struct test_suite *t, int subtest) {
int err;
pr_debug("\n--- start ---\n");
err = run_test(t, subtest);
pr_debug("---- end ----\n");
if (!has_subtests(t))
pr_debug("%s:", t->desc);
else
pr_debug("%s subtest %d:", t->desc, subtest + 1);
switch (err) {
case TEST_OK:
... | [
1,
0
] |
Linux Kernel | tools/perf/tests/builtin-test.c |
static int shell_test__run(struct test_suite *test, int subdir __maybe_unused) {
int err;
char script[PATH_MAX];
struct shell_test *st = test->priv;
path__join(script, sizeof(script) - 3, st->dir, st->file);
if (verbose)
strncat(script, " -v", sizeof(script) - strlen(script) - 1);
err = system(scrip... | [
1,
0
] |
Linux Kernel | tools/perf/tests/builtin-test.c |
static int run_shell_tests(int argc, const char *argv[], int i, int width,
struct intlist *skiplist) {
struct shell_test st;
const struct script_file *files, *file;
files = list_script_files();
if (!files)
return 0;
for (file = files; file->dir; file++) {
int curr = i++;
... | [
0,
0
] |
Linux Kernel | tools/perf/tests/builtin-test.c |
static int perf_test__list_shell(int argc, const char **argv, int i) {
const struct script_file *files, *file;
files = list_script_files();
if (!files)
return 0;
for (file = files; file->dir; file++) {
int curr = i++;
struct test_suite t = {.desc = file->desc};
if (!perf_test__matches(t.desc,... | [
0,
0
] |
Linux Kernel | tools/perf/tests/code-reading.c |
static void dump_buf(unsigned char *buf, size_t len) {
size_t i;
for (i = 0; i < len; i++) {
pr_debug("0x%02x ", buf[i]);
if (i % 16 == 15)
pr_debug("\n");
}
pr_debug("\n");
} | [
0,
0
] |
Linux Kernel | tools/perf/tests/code-reading.c |
static int process_events(struct machine *machine, struct evlist *evlist,
struct state *state) {
union perf_event *event;
struct mmap *md;
int i, ret;
for (i = 0; i < evlist->core.nr_mmaps; i++) {
md = &evlist->mmap[i];
if (perf_mmap__read_init(&md->core) < 0)
continue;... | [
0,
0
] |
Linux Kernel | tools/perf/tests/code-reading.c |
static void fs_something(void) {
const char *test_file_name = "temp-perf-code-reading-test-file--";
FILE *f;
int i;
for (i = 0; i < 1000; i++) {
f = fopen(test_file_name, "w+");
if (f) {
fclose(f);
unlink(test_file_name);
}
}
} | [
1,
0
] |
Linux Kernel | tools/perf/tests/code-reading.c |
static void do_something(void) {
fs_something();
sort_something();
syscall_something();
} | [
0,
0
] |
Linux Kernel | tools/perf/tests/dlfilter-test.c |
static int test_result(const char *msg, int ret) {
pr_debug("%s\n", msg);
return ret;
} | [
0,
0
] |
Linux Kernel | tools/perf/tests/dlfilter-test.c |
bool have_gcc(void) {
pr_debug("Checking for gcc\n");
return !system_cmd("gcc --version");
} | [
0,
0
] |
Linux Kernel | tools/perf/tests/dlfilter-test.c |
static int write_attr(struct test_data *td, u64 sample_type, u64 *id) {
struct perf_event_attr attr = {
.size = sizeof(attr),
.type = PERF_TYPE_HARDWARE,
.config = PERF_COUNT_HW_BRANCH_INSTRUCTIONS,
.sample_type = sample_type,
.sample_period = 1,
};
return perf_event__synthesize_at... | [
1,
0
] |
Linux Kernel | tools/perf/tests/dlfilter-test.c |
static int write_comm(int fd, pid_t pid, pid_t tid, const char *comm_str) {
struct perf_record_comm comm;
ssize_t sz = sizeof(comm);
comm.header.type = PERF_RECORD_COMM;
comm.header.misc = PERF_RECORD_MISC_USER;
comm.header.size = sz;
comm.pid = pid;
comm.tid = tid;
strncpy(comm.comm, comm_str, 16);
... | [
1,
0
] |
Linux Kernel | tools/perf/tests/dlfilter-test.c |
static int write_mmap(int fd, pid_t pid, pid_t tid, u64 start, u64 len,
u64 pgoff, const char *filename) {
char buf[PERF_SAMPLE_MAX_SIZE];
struct perf_record_mmap *mmap = (struct perf_record_mmap *)buf;
size_t fsz = roundup(strlen(filename) + 1, 8);
ssize_t sz = sizeof(*mmap) - sizeof(mma... | [
1,
0
] |
Linux Kernel | tools/perf/tests/dlfilter-test.c |
static void close_fd(int fd) {
if (fd >= 0)
close(fd);
} | [
0,
0
] |
Linux Kernel | tools/perf/tests/dlfilter-test.c |
static int get_dlfilters_path(char *buf, size_t sz) {
char perf[PATH_MAX];
char path[PATH_MAX];
char *perf_path;
char *exec_path;
perf_exe(perf, sizeof(perf));
perf_path = dirname(perf);
snprintf(path, sizeof(path), "%s/dlfilters/dlfilter-test-api-v0.so",
perf_path);
if (access(path, R_OK))... | [
1,
0
] |
Linux Kernel | tools/perf/tests/dlfilter-test.c |
static int get_ip_addr(struct test_data *td) {
struct map *map;
struct symbol *sym;
map = dso__new_map(td->prog_file_name);
if (!map)
return -1;
sym = map__find_symbol_by_name(map, "foo");
if (sym)
td->foo = sym->start;
sym = map__find_symbol_by_name(map, "bar");
if (sym)
td->bar = sym->... | [
1,
0
] |
Linux Kernel | tools/perf/tests/dlfilter-test.c |
static int do_run_perf_script(struct test_data *td, int do_early) {
return system_cmd("%s script -i %s "
"--dlfilter %s/dlfilter-test-api-v0.so "
"--dlarg first "
"--dlarg %d "
"--dlarg %" PRIu64 " "
"--dlarg %" PRIu6... | [
1,
0
] |
Linux Kernel | tools/perf/tests/dlfilter-test.c |
static int test__dlfilter(struct test_suite *test __maybe_unused,
int subtest __maybe_unused) {
struct test_data td = {.fd = -1};
int pid = getpid();
int err;
perf_exe(td.perf, sizeof(td.perf));
snprintf(td.perf_data_file_name, PATH_MAX, "/tmp/dlfilter-test-%u-perf-data",
... | [
1,
0
] |
Linux Kernel | tools/perf/tests/dso-data.c | static int dso__data_fd(struct dso *dso, struct machine *machine) {
int fd = dso__data_get_fd(dso, machine);
if (fd >= 0)
dso__data_put_fd(dso);
return fd;
} | [
0,
0
] |
Linux Kernel | tools/perf/tests/dso-data.c |
static long open_files_cnt(void) {
char path[PATH_MAX];
struct dirent *dent;
DIR *dir;
long nr = 0;
scnprintf(path, PATH_MAX, "%s/self/fd", procfs__mountpoint());
pr_debug("fd path: %s\n", path);
dir = opendir(path);
TEST_ASSERT_VAL("failed to open fd directory", dir);
while ((dent = readdir(dir))... | [
0,
0
] |
Linux Kernel | tools/perf/tests/dso-data.c |
static int dsos__create(int cnt, int size) {
int i;
dsos = malloc(sizeof(*dsos) * cnt);
TEST_ASSERT_VAL("failed to alloc dsos array", dsos);
for (i = 0; i < cnt; i++) {
char *file;
file = test_file(size);
TEST_ASSERT_VAL("failed to get dso file", file);
dsos[i] = dso__new(file);
TEST_AS... | [
1,
0
] |
Linux Kernel | tools/perf/tests/dso-data.c |
static int set_fd_limit(int n) {
struct rlimit rlim;
if (getrlimit(RLIMIT_NOFILE, &rlim))
return -1;
pr_debug("file limit %ld, new %d\n", (long)rlim.rlim_cur, n);
rlim.rlim_cur = n;
return setrlimit(RLIMIT_NOFILE, &rlim);
} | [
0,
0
] |
Linux Kernel | tools/perf/tests/dso-data.c |
static long new_limit(int count) {
int fd = open("/dev/null", O_RDONLY);
long ret = fd;
if (count > 0)
ret = new_limit(--count);
close(fd);
return ret;
} | [
0,
0
] |
Linux Kernel | tools/perf/tests/event-times.c |
static int attach__current_disabled(struct evlist *evlist) {
struct evsel *evsel = evlist__last(evlist);
struct perf_thread_map *threads;
int err;
pr_debug("attaching to current thread as disabled\n");
threads = thread_map__new(-1, getpid(), UINT_MAX);
if (threads == NULL) {
pr_debug("thread_map__new... | [
0,
0
] |
Linux Kernel | tools/perf/tests/event-times.c |
static int attach__current_enabled(struct evlist *evlist) {
struct evsel *evsel = evlist__last(evlist);
struct perf_thread_map *threads;
int err;
pr_debug("attaching to current thread as enabled\n");
threads = thread_map__new(-1, getpid(), UINT_MAX);
if (threads == NULL) {
pr_debug("failed to call th... | [
0,
0
] |
Linux Kernel | tools/perf/tests/event-times.c |
static int attach__cpu_enabled(struct evlist *evlist) {
struct evsel *evsel = evlist__last(evlist);
struct perf_cpu_map *cpus;
int err;
pr_debug("attaching to CPU 0 as enabled\n");
cpus = perf_cpu_map__new("0");
if (cpus == NULL) {
pr_debug("failed to call perf_cpu_map__new\n");
return -1;
}
... | [
0,
0
] |
Linux Kernel | tools/perf/tests/event_update.c |
static int process_event_unit(struct perf_tool *tool __maybe_unused,
union perf_event *event,
struct perf_sample *sample __maybe_unused,
struct machine *machine __maybe_unused) {
struct perf_record_event_update *ev =
(str... | [
0,
0
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.