Projectname large_stringclasses 15
values | Filepath large_stringlengths 4 106 ⌀ | Function large_stringlengths 11 3.45k | Label list |
|---|---|---|---|
Linux Kernel | tools/perf/util/cloexec.c |
unsigned long perf_event_open_cloexec_flag(void) {
static bool probed;
if (!probed) {
if (perf_flag_probe() <= 0)
flag = 0;
probed = true;
}
return flag;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/color.c |
int color_snprintf(char *bf, size_t size, const char *color, const char *fmt,
...) {
va_list args;
int r;
va_start(args, fmt);
r = color_vsnprintf(bf, size, color, fmt, args);
va_end(args);
return r;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/color.c |
int color_fprintf(FILE *fp, const char *color, const char *fmt, ...) {
va_list args;
int r;
va_start(args, fmt);
r = color_vfprintf(fp, color, fmt, args);
va_end(args);
return r;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/color.c | int color_fwrite_lines(FILE *fp, const char *color, size_t count,
const char *buf) {
if (!*color)
return fwrite(buf, count, 1, fp) != 1;
while (count) {
char *p = memchr(buf, '\n', count);
if (p != buf && (fputs(color, fp) < 0 ||
fwrite(buf, p ? (size_t)(p -... | [
1,
0
] |
Linux Kernel | tools/perf/util/color_config.c | int perf_config_colorbool(const char *var, const char *value,
int stdout_is_tty) {
if (value) {
if (!strcasecmp(value, "never"))
return 0;
if (!strcasecmp(value, "always"))
return 1;
if (!strcasecmp(value, "auto"))
goto auto_color;
}
if (!perf_config_bool(v... | [
0,
0
] |
Linux Kernel | tools/perf/util/comm.c |
void comm__free(struct comm *comm) {
comm_str__put(comm->comm_str);
free(comm);
} | [
1,
0
] |
Linux Kernel | tools/perf/util/comm.c |
const char *comm__str(const struct comm *comm) { return comm->comm_str->str; } | [
0,
0
] |
Linux Kernel | tools/perf/util/config.c |
static inline int iskeychar(int c) {
return isalnum(c) || c == '-' || c == '_';
} | [
1,
0
] |
Linux Kernel | tools/perf/util/config.c | static int get_value(config_fn_t fn, void *data, char *name, unsigned int len) {
int c;
char *value;
for (;;) {
c = get_next_char();
if (config_file_eof)
break;
if (!iskeychar(c))
break;
name[len++] = c;
if (len >= MAXNAME)
return -1;
}
name[len] = 0;
while (c == ' ' |... | [
0,
0
] |
Linux Kernel | tools/perf/util/config.c |
static int perf_parse_llong(const char *value, long long *ret) {
if (value && *value) {
char *end;
long long val = strtoll(value, &end, 0);
unsigned long factor = 1;
if (!parse_unit_factor(end, &factor))
return 0;
*ret = val * factor;
return 1;
}
return 0;
} | [
1,
0
] |
Linux Kernel | tools/perf/util/config.c |
static void bad_config(const char *name) {
if (config_file_name)
pr_warning("bad config value for '%s' in %s, ignoring...\n", name,
config_file_name);
else
pr_warning("bad config value for '%s', ignoring...\n", name);
} | [
0,
0
] |
Linux Kernel | tools/perf/util/config.c | static int perf_default_core_config(const char *var __maybe_unused,
const char *value __maybe_unused) {
if (!strcmp(var, "core.proc-map-timeout"))
proc_map_timeout = strtoul(value, NULL, 10);
return 0;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/config.c | int perf_default_config(const char *var, const char *value,
void *dummy __maybe_unused) {
if (strstarts(var, "core."))
return perf_default_core_config(var, value);
if (strstarts(var, "hist."))
return perf_hist_config(var, value);
if (strstarts(var, "ui."))
return perf_ui_conf... | [
0,
0
] |
Linux Kernel | tools/perf/util/config.c |
const char *perf_etc_perfconfig(void) {
static const char *system_wide;
if (!system_wide)
system_wide = system_path(ETC_PERFCONFIG);
return system_wide;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/config.c |
static int perf_env_bool(const char *k, int def) {
const char *v = getenv(k);
return v ? perf_config_bool(k, v) : def;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/config.c |
int perf_config_system(void) {
return !perf_env_bool("PERF_CONFIG_NOSYSTEM", 0);
} | [
0,
0
] |
Linux Kernel | tools/perf/util/config.c | static char *home_perfconfig(void) {
const char *home = NULL;
char *config;
struct stat st;
home = getenv("HOME");
if (!home || !*home || !perf_config_global())
return NULL;
config = strdup(mkpath("%s/.perfconfig", home));
if (config == NULL) {
pr_warning("Not enough memory to process %s/.perfc... | [
1,
0
] |
Linux Kernel | tools/perf/util/config.c |
static struct perf_config_section *add_section(struct list_head *sections,
const char *section_name) {
struct perf_config_section *section = zalloc(sizeof(*section));
if (!section)
return NULL;
INIT_LIST_HEAD(§ion->items);
section->name = strdup(section_... | [
1,
0
] |
Linux Kernel | tools/perf/util/config.c | static int collect_config(const char *var, const char *value,
void *perf_config_set) {
int ret = -1;
char *ptr, *key;
char *section_name, *name;
struct perf_config_section *section = NULL;
struct perf_config_item *item = NULL;
struct perf_config_set *set = perf_config_set;
struct... | [
1,
0
] |
Linux Kernel | tools/perf/util/config.c | static int perf_config_set__init(struct perf_config_set *set) {
int ret = -1;
if (config_exclusive_filename)
return perf_config_from_file(collect_config, config_exclusive_filename,
set);
if (perf_config_system() && !access(perf_etc_perfconfig(), R_OK)) {
if (perf_config_f... | [
0,
0
] |
Linux Kernel | tools/perf/util/config.c | int perf_config_set(struct perf_config_set *set, config_fn_t fn, void *data) {
int ret = 0;
char key[BUFSIZ];
struct perf_config_section *section;
struct perf_config_item *item;
perf_config_set__for_each_entry(set, section, item) {
char *value = item->value;
if (value) {
scnprintf(key, sizeof(... | [
1,
0
] |
Linux Kernel | tools/perf/util/config.c |
int perf_config(config_fn_t fn, void *data) {
if (config_set == NULL && perf_config__init())
return -1;
return perf_config_set(config_set, fn, data);
} | [
0,
0
] |
Linux Kernel | tools/perf/util/config.c |
static void perf_config_section__delete(struct perf_config_section *section) {
perf_config_section__purge(section);
zfree(§ion->name);
free(section);
} | [
1,
0
] |
Linux Kernel | tools/perf/util/config.c |
void perf_config_set__delete(struct perf_config_set *set) {
if (set == NULL)
return;
perf_config_set__purge(set);
free(set);
} | [
1,
0
] |
Linux Kernel | tools/perf/util/config.c |
static int perf_config_scan_cb(const char *var, const char *value, void *data) {
struct perf_config_scan_data *d = data;
if (!strcmp(var, d->name))
d->ret = vsscanf(value, d->fmt, d->args);
return 0;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/copyfile.c | static int copyfile_mode_ns(const char *from, const char *to, mode_t mode,
struct nsinfo *nsi) {
int fromfd, tofd;
struct stat st;
int err;
char *tmp = NULL, *ptr = NULL;
struct nscookie nsc;
nsinfo__mountns_enter(nsi, &nsc);
err = stat(from, &st);
nsinfo__mountns_exit(&nsc)... | [
1,
0
] |
Linux Kernel | tools/perf/util/counts.c |
void perf_counts__delete(struct perf_counts *counts) {
if (counts) {
xyarray__delete(counts->loaded);
xyarray__delete(counts->values);
free(counts);
}
} | [
1,
0
] |
Linux Kernel | tools/perf/util/counts.c |
void perf_counts__reset(struct perf_counts *counts) {
xyarray__reset(counts->loaded);
xyarray__reset(counts->values);
memset(&counts->aggr, 0, sizeof(struct perf_counts_values));
} | [
1,
0
] |
Linux Kernel | tools/perf/util/counts.c |
int evsel__alloc_counts(struct evsel *evsel) {
struct perf_cpu_map *cpus = evsel__cpus(evsel);
int nthreads = perf_thread_map__nr(evsel->core.threads);
evsel->counts = perf_counts__new(perf_cpu_map__nr(cpus), nthreads);
return evsel->counts != NULL ? 0 : -ENOMEM;
} | [
1,
0
] |
Linux Kernel | tools/perf/util/counts.h |
static inline struct perf_counts_values *
perf_counts(struct perf_counts *counts, int cpu_map_idx, int thread) {
return xyarray__entry(counts->values, cpu_map_idx, thread);
} | [
0,
0
] |
Linux Kernel | tools/perf/util/cpumap.c |
static struct perf_cpu_map *
cpu_map__from_mask(const struct perf_record_cpu_map_data *data) {
DECLARE_BITMAP(local_copy, 64);
int weight = 0, mask_nr = data->mask32_data.nr;
struct perf_cpu_map *map;
for (int i = 0; i < mask_nr; i++) {
perf_record_cpu_map_data__read_one_mask(data, i, local_copy);
wei... | [
0,
0
] |
Linux Kernel | tools/perf/util/cpumap.c |
struct perf_cpu_map *
cpu_map__new_data(const struct perf_record_cpu_map_data *data) {
switch (data->type) {
case PERF_CPU_MAP__CPUS:
return cpu_map__from_entries(data);
case PERF_CPU_MAP__MASK:
return cpu_map__from_mask(data);
case PERF_CPU_MAP__RANGE_CPUS:
return cpu_map__from_range(data);
defa... | [
0,
0
] |
Linux Kernel | tools/perf/util/cpumap.c |
size_t cpu_map__fprintf(struct perf_cpu_map *map, FILE *fp) {
#define BUFSIZE 1024
char buf[BUFSIZE];
cpu_map__snprint(map, buf, sizeof(buf));
return fprintf(fp, "%s\n", buf);
#undef BUFSIZE
} | [
1,
0
] |
Linux Kernel | tools/perf/util/cpumap.c |
struct cpu_aggr_map *cpu_aggr_map__empty_new(int nr) {
struct cpu_aggr_map *cpus =
malloc(sizeof(*cpus) + sizeof(struct aggr_cpu_id) * nr);
if (cpus != NULL) {
int i;
cpus->nr = nr;
for (i = 0; i < nr; i++)
cpus->map[i] = aggr_cpu_id__empty();
refcount_set(&cpus->refcnt, 1);
}
r... | [
1,
0
] |
Linux Kernel | tools/perf/util/cpumap.c |
static int cpu__get_topology_int(int cpu, const char *name, int *value) {
char path[PATH_MAX];
snprintf(path, PATH_MAX, "devices/system/cpu/cpu%d/topology/%s", cpu, name);
return sysfs__read_int(path, value);
} | [
0,
0
] |
Linux Kernel | tools/perf/util/cpumap.c |
int cpu__get_socket_id(struct perf_cpu cpu) {
int value,
ret = cpu__get_topology_int(cpu.cpu, "physical_package_id", &value);
return ret ?: value;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/cpumap.c |
static int aggr_cpu_id__cmp(const void *a_pointer, const void *b_pointer) {
struct aggr_cpu_id *a = (struct aggr_cpu_id *)a_pointer;
struct aggr_cpu_id *b = (struct aggr_cpu_id *)b_pointer;
if (a->node != b->node)
return a->node - b->node;
else if (a->socket != b->socket)
return a->socket - b->socket;... | [
0,
0
] |
Linux Kernel | tools/perf/util/cpumap.c |
int cpu__get_core_id(struct perf_cpu cpu) {
int value, ret = cpu__get_topology_int(cpu.cpu, "core_id", &value);
return ret ?: value;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/cpumap.c | static void set_max_cpu_num(void) {
const char *mnt;
char path[PATH_MAX];
int ret = -1;
max_cpu_num.cpu = 4096;
max_present_cpu_num.cpu = 4096;
mnt = sysfs__mountpoint();
if (!mnt)
goto out;
/* get the highest possible cpu number for a sparse allocation */
ret = snprintf(path, PATH_MAX, "%s/dev... | [
0,
0
] |
Linux Kernel | tools/perf/util/cpumap.c | int cpu__setup_cpunode_map(void) {
struct dirent *dent1, *dent2;
DIR *dir1, *dir2;
unsigned int cpu, mem;
char buf[PATH_MAX];
char path[PATH_MAX];
const char *mnt;
int n;
if (init_cpunode_map())
return -1;
mnt = sysfs__mountpoint();
if (!mnt)
return 0;
n = snprintf(path, PATH_MAX, "%s/d... | [
1,
0
] |
Linux Kernel | tools/perf/util/cpumap.c | const struct perf_cpu_map *cpu_map__online(void) {
static const struct perf_cpu_map *online = NULL;
if (!online)
online = perf_cpu_map__new(NULL);
return online;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/cpumap.c |
bool aggr_cpu_id__is_empty(const struct aggr_cpu_id *a) {
return a->thread_idx == -1 && a->node == -1 && a->socket == -1 &&
a->die == -1 && a->core == -1 && a->cpu.cpu == -1;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/cputopo.c | bool cpu_topology__core_wide(const struct cpu_topology *topology,
const char *user_requested_cpu_list) {
struct perf_cpu_map *user_requested_cpus;
if (!user_requested_cpu_list)
return true;
user_requested_cpus = perf_cpu_map__new(user_requested_cpu_list);
/* Check that every u... | [
0,
0
] |
Linux Kernel | tools/perf/util/cputopo.c | static int load_numa_node(struct numa_topology_node *node, int nr) {
char str[MAXPATHLEN];
char field[32];
char *buf = NULL, *p;
size_t len = 0;
int ret = -1;
FILE *fp;
u64 mem;
node->node = (u32)nr;
scnprintf(str, MAXPATHLEN, NODE_MEMINFO_FMT, sysfs__mountpoint(), nr);
fp = fopen(str, "r");
if ... | [
1,
0
] |
Linux Kernel | tools/perf/util/cputopo.c |
struct hybrid_topology *hybrid_topology__new(void) {
struct perf_pmu *pmu;
struct hybrid_topology *tp = NULL;
u32 nr, i = 0;
nr = perf_pmu__hybrid_pmu_num();
if (nr == 0)
return NULL;
tp = zalloc(sizeof(*tp) + sizeof(tp->nodes[0]) * nr);
if (!tp)
return NULL;
tp->nr = nr;
perf_pmu__for_eac... | [
1,
0
] |
Linux Kernel | tools/perf/util/cs-etm-decoder/cs-etm-decoder.c |
int cs_etm_decoder__reset(struct cs_etm_decoder *decoder) {
ocsd_datapath_resp_t dp_ret;
decoder->prev_return = OCSD_RESP_CONT;
decoder->suppress_printing = true;
dp_ret =
ocsd_dt_process_data(decoder->dcd_tree, OCSD_OP_RESET, 0, 0, NULL, NULL);
decoder->suppress_printing = false;
if (OCSD_DATA_RESP... | [
0,
0
] |
Linux Kernel | tools/perf/util/cs-etm-decoder/cs-etm-decoder.c |
static void cs_etm_decoder__gen_ete_config(struct cs_etm_trace_params *params,
ocsd_ete_cfg *config) {
config->reg_configr = params->ete.reg_configr;
config->reg_traceidr = params->ete.reg_traceidr;
config->reg_idr0 = params->ete.reg_idr0;
config->reg_idr1 = params->e... | [
0,
0
] |
Linux Kernel | tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | static void cs_etm_decoder__init_raw_frame_logging(
struct cs_etm_decoder_params *d_params __maybe_unused,
struct cs_etm_decoder *decoder __maybe_unused) {}
#endif | [
0,
0
] |
Linux Kernel | tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | static ocsd_datapath_resp_t
cs_etm_decoder__do_soft_timestamp(struct cs_etm_queue *etmq,
struct cs_etm_packet_queue *packet_queue,
const uint8_t trace_chan_id) {
if (!packet_queue->cs_timestamp)
return OCSD_RESP_CONT;
packet_queue->cs_timesta... | [
0,
0
] |
Linux Kernel | tools/perf/util/cs-etm-decoder/cs-etm-decoder.c |
void cs_etm_decoder__free(struct cs_etm_decoder *decoder) {
if (!decoder)
return;
ocsd_destroy_dcd_tree(decoder->dcd_tree);
decoder->dcd_tree = NULL;
free(decoder);
} | [
1,
0
] |
Linux Kernel | tools/perf/util/cs-etm-decoder/cs-etm-decoder.c |
const char *cs_etm_decoder__get_name(struct cs_etm_decoder *decoder) {
return decoder->decoder_name;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/cs-etm.c |
static u32 cs_etm__get_v7_protocol_version(u32 etmidr) {
etmidr &= ETMIDR_PTM_VERSION;
if (etmidr == ETMIDR_PTM_VERSION)
return CS_ETM_PROTO_PTM;
return CS_ETM_PROTO_ETMV3;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/cs-etm.c |
static int cs_etm__get_magic(u8 trace_chan_id, u64 *magic) {
struct int_node *inode;
u64 *metadata;
inode = intlist__find(traceid_list, trace_chan_id);
if (!inode)
return -EINVAL;
metadata = inode->priv;
*magic = metadata[CS_ETM_MAGIC];
return 0;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/cs-etm.c |
struct cs_etm_packet_queue *
cs_etm__etmq_get_packet_queue(struct cs_etm_queue *etmq, u8 trace_chan_id) {
struct cs_etm_traceid_queue *tidq;
tidq = cs_etm__etmq_get_traceid_queue(etmq, trace_chan_id);
if (tidq)
return &tidq->packet_queue;
return NULL;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/cs-etm.c | static void cs_etm__free(struct perf_session *session) {
int i;
struct int_node *inode, *tmp;
struct cs_etm_auxtrace *aux =
container_of(session->auxtrace, struct cs_etm_auxtrace, auxtrace);
cs_etm__free_events(session);
session->auxtrace = NULL;
intlist__for_each_entry_safe(inode, tmp, traceid_list)... | [
0,
0
] |
Linux Kernel | tools/perf/util/cs-etm.c |
static inline void
cs_etm__reset_last_branch_rb(struct cs_etm_traceid_queue *tidq) {
tidq->last_branch_pos = 0;
tidq->last_branch_rb->nr = 0;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/cs-etm.c |
static int cs_etm__event_synth(struct perf_tool *tool, union perf_event *event,
struct perf_sample *sample __maybe_unused,
struct machine *machine __maybe_unused) {
struct cs_etm_synth *cs_etm_synth =
container_of(tool, struct cs_etm_synth, dummy_to... | [
0,
0
] |
Linux Kernel | tools/perf/util/cs-etm.c | static bool cs_etm__is_syscall(struct cs_etm_queue *etmq,
struct cs_etm_traceid_queue *tidq, u64 magic) {
u8 trace_chan_id = tidq->trace_chan_id;
struct cs_etm_packet *packet = tidq->packet;
struct cs_etm_packet *prev_packet = tidq->prev_packet;
if (magic == __perf_cs_etmv3_magic... | [
0,
0
] |
Linux Kernel | tools/perf/util/cs-etm.c | static int cs_etm__process_traceid_queue(struct cs_etm_queue *etmq,
struct cs_etm_traceid_queue *tidq) {
int ret;
struct cs_etm_packet_queue *packet_queue;
packet_queue = &tidq->packet_queue;
while (1) {
ret = cs_etm_decoder__get_packet(packet_queue, tidq->packet);... | [
0,
0
] |
Linux Kernel | tools/perf/util/cs-etm.c | static int cs_etm__process_switch_cpu_wide(struct cs_etm_auxtrace *etm,
union perf_event *event) {
struct thread *th;
bool out = event->header.misc & PERF_RECORD_MISC_SWITCH_OUT;
if (etm->timeless_decoding)
return 0;
/*
* SWITCH_IN events carry the next proces... | [
0,
0
] |
Linux Kernel | tools/perf/util/cs-etm.c | static int
cs_etm__process_auxtrace_event(struct perf_session *session,
union perf_event *event,
struct perf_tool *tool __maybe_unused) {
struct cs_etm_auxtrace *etm =
container_of(session->auxtrace, struct cs_etm_auxtrace, auxtrace);
if (!etm->dat... | [
0,
0
] |
Linux Kernel | tools/perf/util/cs-etm.c | static int cs_etm__print_cpu_metadata_v1(__u64 *val, int *offset) {
int i = *offset, j, total_params = 0;
__u64 magic;
magic = val[i + CS_ETM_MAGIC];
total_params = val[i + CS_ETM_NR_TRC_PARAMS] + CS_ETM_COMMON_BLK_MAX_V1;
if (magic == __perf_cs_etmv3_magic) {
for (j = 0; j < total_params; j++, i++) {
... | [
0,
0
] |
Linux Kernel | tools/perf/util/cs-etm.c | static void cs_etm__print_auxtrace_info(__u64 *val, int num) {
int i, cpu = 0, version, err;
/* bail out early on bad header version */
version = val[0];
if (version > CS_HEADER_CURRENT_VERSION) {
/* failure.. return */
fprintf(stdout, " Unknown Header Version = %x, ", version);
fprintf(stdout, "Ve... | [
0,
0
] |
Linux Kernel | tools/perf/util/cs-etm.h | static inline int
cs_etm__process_auxtrace_info(union perf_event *event __maybe_unused,
struct perf_session *session __maybe_unused) {
return -1;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/cs-etm.h |
static inline struct cs_etm_packet_queue *
cs_etm__etmq_get_packet_queue(struct cs_etm_queue *etmq __maybe_unused,
u8 trace_chan_id __maybe_unused) {
return NULL;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/data-convert-bt.c |
static int value_set(struct bt_ctf_field_type *type, struct bt_ctf_event *event,
const char *name, u64 val) {
struct bt_ctf_field *field;
bool sign = bt_ctf_field_type_integer_get_signed(type);
int ret;
field = bt_ctf_field_create(type);
if (!field) {
pr_err("failed to create a fiel... | [
0,
0
] |
Linux Kernel | tools/perf/util/data-convert-bt.c |
static int string_set_value(struct bt_ctf_field *field, const char *string) {
char *buffer = NULL;
size_t len = strlen(string), i, p;
int err;
for (i = p = 0; i < len; i++, p++) {
if (isprint(string[i])) {
if (!buffer)
continue;
buffer[p] = string[i];
} else {
char numstr[5];... | [
1,
0
] |
Linux Kernel | tools/perf/util/data-convert-bt.c |
static struct ctf_stream *ctf_stream__create(struct ctf_writer *cw, int cpu) {
struct ctf_stream *cs;
struct bt_ctf_field *pkt_ctx = NULL;
struct bt_ctf_field *cpu_field = NULL;
struct bt_ctf_stream *stream = NULL;
int ret;
cs = zalloc(sizeof(*cs));
if (!cs) {
pr_err("Failed to allocate ctf stream\n... | [
1,
0
] |
Linux Kernel | tools/perf/util/data-convert-bt.c | static char *change_name(char *name, char *orig_name, int dup) {
char *new_name = NULL;
size_t len;
if (!name)
name = orig_name;
if (dup >= 10)
goto out;
if (dup < 0)
len = strlen(name) + sizeof("_");
else
len = strlen(orig_name) + sizeof("_dupl_X");
new_name = malloc(len);
if (!new_... | [
1,
0
] |
Linux Kernel | tools/perf/util/data-convert-bt.c | static int add_tracepoint_fields_types(struct ctf_writer *cw,
struct tep_format_field *fields,
struct bt_ctf_event_class *event_class) {
struct tep_format_field *field;
int ret;
for (field = fields; field; field = field->next) {
st... | [
1,
0
] |
Linux Kernel | tools/perf/util/data-convert-bt.c |
static int add_tracepoint_types(struct ctf_writer *cw, struct evsel *evsel,
struct bt_ctf_event_class *class) {
struct tep_format_field *common_fields =
evsel->tp_format->format.common_fields;
struct tep_format_field *fields = evsel->tp_format->format.fields;
int ret;
ret... | [
1,
0
] |
Linux Kernel | tools/perf/util/data-convert-bt.c |
static int
setup_non_sample_events(struct ctf_writer *cw,
struct perf_session *session __maybe_unused) {
int ret;
ret = add_comm_event(cw);
if (ret)
return ret;
ret = add_exit_event(cw);
if (ret)
return ret;
ret = add_fork_event(cw);
if (ret)
return ret;
ret = add_m... | [
0,
0
] |
Linux Kernel | tools/perf/util/data-convert-bt.c |
static void cleanup_events(struct perf_session *session) {
struct evlist *evlist = session->evlist;
struct evsel *evsel;
evlist__for_each_entry(evlist, evsel) {
struct evsel_priv *priv;
priv = evsel->priv;
bt_ctf_event_class_put(priv->event_class);
zfree(&evsel->priv);
}
evlist__delete(evl... | [
0,
0
] |
Linux Kernel | tools/perf/util/data-convert-bt.c |
static void ctf_writer__cleanup_data(struct ctf_writer *cw) {
unsigned int i;
for (i = 0; i < ARRAY_SIZE(cw->data.array); i++)
bt_ctf_field_type_put(cw->data.array[i]);
} | [
0,
0
] |
Linux Kernel | tools/perf/util/data-convert-bt.c |
static int ctf_writer__flush_streams(struct ctf_writer *cw) {
int cpu, ret = 0;
for (cpu = 0; cpu < cw->stream_cnt && !ret; cpu++)
ret = ctf_stream__flush(cw->stream[cpu]);
return ret;
} | [
1,
0
] |
Linux Kernel | tools/perf/util/data-convert-json.c | static void output_json_key_string(FILE *out, bool comma, int depth,
const char *key, const char *value) {
output_json_delimiters(out, comma, depth);
output_json_string(out, key);
fputs(": ", out);
output_json_string(out, value);
} | [
0,
0
] |
Linux Kernel | tools/perf/util/data.c |
void perf_data__close_dir(struct perf_data *data) {
close_dir(data->dir.files, data->dir.nr);
} | [
0,
0
] |
Linux Kernel | tools/perf/util/data.c |
static bool check_pipe(struct perf_data *data) {
struct stat st;
bool is_pipe = false;
int fd = perf_data__is_read(data) ? STDIN_FILENO : STDOUT_FILENO;
if (!data->path) {
if (!fstat(fd, &st) && S_ISFIFO(st.st_mode))
is_pipe = true;
} else {
if (!strcmp(data->path, "-"))
is_pipe = true;
... | [
0,
0
] |
Linux Kernel | tools/perf/util/data.c |
static int check_backup(struct perf_data *data) {
struct stat st;
if (perf_data__is_read(data))
return 0;
if (!stat(data->path, &st) && st.st_size) {
char oldname[PATH_MAX];
int ret;
snprintf(oldname, sizeof(oldname), "%s.old", data->path);
ret = rm_rf_perf_data(oldname);
if (ret) {
... | [
1,
0
] |
Linux Kernel | tools/perf/util/data.c |
static bool is_dir(struct perf_data *data) {
struct stat st;
if (stat(data->path, &st))
return false;
return (st.st_mode & S_IFMT) == S_IFDIR;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/data.c |
static int open_file_write(struct perf_data *data) {
int fd;
char sbuf[STRERR_BUFSIZE];
fd = open(data->file.path, O_CREAT | O_RDWR | O_TRUNC | O_CLOEXEC,
S_IRUSR | S_IWUSR);
if (fd < 0)
pr_err("failed to open %s : %s\n", data->file.path,
str_error_r(errno, sbuf, sizeof(sbuf)));
... | [
1,
0
] |
Linux Kernel | tools/perf/util/data.c |
void perf_data__close(struct perf_data *data) {
if (perf_data__is_dir(data))
perf_data__close_dir(data);
zfree(&data->file.path);
if (data->use_stdio)
fclose(data->file.fptr);
else
close(data->file.fd);
} | [
1,
0
] |
Linux Kernel | tools/perf/util/data.c |
ssize_t perf_data_file__write(struct perf_data_file *file, void *buf,
size_t size) {
return writen(file->fd, buf, size);
} | [
0,
0
] |
Linux Kernel | tools/perf/util/data.c | int perf_data__switch(struct perf_data *data, const char *postfix, size_t pos,
bool at_exit, char **new_filepath) {
int ret;
if (check_pipe(data))
return -EINVAL;
if (perf_data__is_read(data))
return -EINVAL;
if (asprintf(new_filepath, "%s.%s", data->path, postfix) < 0)
retur... | [
1,
0
] |
Linux Kernel | tools/perf/util/data.c |
unsigned long perf_data__size(struct perf_data *data) {
u64 size = data->file.size;
int i;
if (perf_data__is_single_file(data))
return size;
for (i = 0; i < data->dir.nr; i++) {
struct perf_data_file *file = &data->dir.files[i];
size += file->size;
}
return size;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/data.c |
bool is_perf_data(const char *path) {
bool ret = false;
FILE *file;
u64 magic;
file = fopen(path, "r");
if (!file)
return false;
if (fread(&magic, 1, 8, file) < 8)
goto out;
ret = is_perf_magic(magic);
out:
fclose(file);
return ret;
} | [
1,
0
] |
Linux Kernel | tools/perf/util/data.h |
static inline int perf_data__fd(struct perf_data *data) {
if (data->use_stdio)
return fileno(data->file.fptr);
return data->file.fd;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/db-export.c |
int db_export__evsel(struct db_export *dbe, struct evsel *evsel) {
if (evsel->db_id)
return 0;
evsel->db_id = ++dbe->evsel_last_db_id;
if (dbe->export_evsel)
return dbe->export_evsel(dbe, evsel);
return 0;
} | [
1,
0
] |
Linux Kernel | tools/perf/util/db-export.c |
int db_export__comm_thread(struct db_export *dbe, struct comm *comm,
struct thread *thread) {
u64 db_id;
db_id = ++dbe->comm_thread_last_db_id;
if (dbe->export_comm_thread)
return dbe->export_comm_thread(dbe, db_id, comm, thread);
return 0;
} | [
1,
0
] |
Linux Kernel | tools/perf/util/db-export.c |
int db_export__symbol(struct db_export *dbe, struct symbol *sym,
struct dso *dso) {
u64 *sym_db_id = symbol__priv(sym);
if (*sym_db_id)
return 0;
*sym_db_id = ++dbe->symbol_last_db_id;
if (dbe->export_symbol)
return dbe->export_symbol(dbe, sym, dso);
return 0;
} | [
1,
0
] |
Linux Kernel | tools/perf/util/db-export.c |
int db_export__branch_type(struct db_export *dbe, u32 branch_type,
const char *name) {
if (dbe->export_branch_type)
return dbe->export_branch_type(dbe, branch_type, name);
return 0;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/db-export.c |
int db_export__call_return(struct db_export *dbe, struct call_return *cr,
u64 *parent_db_id) {
int err;
err = db_export__call_path(dbe, cr->cp);
if (err)
return err;
if (!cr->db_id)
cr->db_id = ++dbe->call_return_last_db_id;
if (parent_db_id) {
if (!*parent_db_id)
... | [
1,
0
] |
Linux Kernel | tools/perf/util/debug.c |
int eprintf_time(int level, int var, u64 t, const char *fmt, ...) {
int ret = 0;
va_list args;
if (var >= level) {
va_start(args, fmt);
ret = veprintf_time(t, fmt, args);
va_end(args);
}
return ret;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/debug.c |
void trace_event(union perf_event *event) {
unsigned char *raw_event = (void *)event;
if (!dump_trace)
return;
print_binary(raw_event, event->header.size, 16, trace_event_printer, event);
} | [
1,
0
] |
Linux Kernel | tools/perf/util/dlfilter.c |
static void al_to_d_al(struct addr_location *al,
struct perf_dlfilter_al *d_al) {
struct symbol *sym = al->sym;
d_al->size = sizeof(*d_al);
if (al->map) {
struct dso *dso = al->map->dso;
if (symbol_conf.show_kernel_path && dso->long_name)
d_al->dso = dso->long_name;
els... | [
1,
0
] |
Linux Kernel | tools/perf/util/dlfilter.c |
static struct thread *get_thread(struct dlfilter *d) {
struct addr_location *al = get_al(d);
return al ? al->thread : NULL;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/dlfilter.c | static const struct perf_dlfilter_al *dlfilter__resolve_addr(void *ctx) {
struct dlfilter *d = (struct dlfilter *)ctx;
struct perf_dlfilter_al *d_addr_al = d->d_addr_al;
struct addr_location *addr_al = d->addr_al;
if (!d->ctx_valid || !d->d_sample->addr_correlates_sym)
return NULL;
if (d_addr_al->size)
... | [
1,
0
] |
Linux Kernel | tools/perf/util/dlfilter.c |
static char **dlfilter__args(void *ctx, int *dlargc) {
struct dlfilter *d = (struct dlfilter *)ctx;
if (dlargc)
*dlargc = 0;
else
return NULL;
if (!d->ctx_valid && !d->in_start && !d->in_stop)
return NULL;
*dlargc = d->dlargc;
return d->dlargv;
} | [
0,
0
] |
Linux Kernel | tools/perf/util/dlfilter.c |
static __s32 dlfilter__resolve_address(void *ctx, __u64 address,
struct perf_dlfilter_al *d_al_p) {
struct dlfilter *d = (struct dlfilter *)ctx;
struct perf_dlfilter_al d_al;
struct addr_location al;
struct thread *thread;
__u32 sz;
if (!d->ctx_valid || !d_al_p)
... | [
1,
0
] |
Linux Kernel | tools/perf/util/dlfilter.c |
static struct perf_event_attr *dlfilter__attr(void *ctx) {
struct dlfilter *d = (struct dlfilter *)ctx;
if (!d->ctx_valid)
return NULL;
return &d->evsel->core.attr;
} | [
1,
0
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.