Lines Matching refs:ph
107 static char *do_read_string(int fd, struct perf_header *ph) in do_read_string() argument
117 if (ph->needs_swap) in do_read_string()
871 static void print_hostname(struct perf_header *ph, int fd __maybe_unused, in print_hostname() argument
874 fprintf(fp, "# hostname : %s\n", ph->env.hostname); in print_hostname()
877 static void print_osrelease(struct perf_header *ph, int fd __maybe_unused, in print_osrelease() argument
880 fprintf(fp, "# os release : %s\n", ph->env.os_release); in print_osrelease()
883 static void print_arch(struct perf_header *ph, int fd __maybe_unused, FILE *fp) in print_arch() argument
885 fprintf(fp, "# arch : %s\n", ph->env.arch); in print_arch()
888 static void print_cpudesc(struct perf_header *ph, int fd __maybe_unused, in print_cpudesc() argument
891 fprintf(fp, "# cpudesc : %s\n", ph->env.cpu_desc); in print_cpudesc()
894 static void print_nrcpus(struct perf_header *ph, int fd __maybe_unused, in print_nrcpus() argument
897 fprintf(fp, "# nrcpus online : %u\n", ph->env.nr_cpus_online); in print_nrcpus()
898 fprintf(fp, "# nrcpus avail : %u\n", ph->env.nr_cpus_avail); in print_nrcpus()
901 static void print_version(struct perf_header *ph, int fd __maybe_unused, in print_version() argument
904 fprintf(fp, "# perf version : %s\n", ph->env.version); in print_version()
907 static void print_cmdline(struct perf_header *ph, int fd __maybe_unused, in print_cmdline() argument
912 nr = ph->env.nr_cmdline; in print_cmdline()
917 fprintf(fp, "%s ", ph->env.cmdline_argv[i]); in print_cmdline()
921 static void print_cpu_topology(struct perf_header *ph, int fd __maybe_unused, in print_cpu_topology() argument
926 int cpu_nr = ph->env.nr_cpus_online; in print_cpu_topology()
928 nr = ph->env.nr_sibling_cores; in print_cpu_topology()
929 str = ph->env.sibling_cores; in print_cpu_topology()
936 nr = ph->env.nr_sibling_threads; in print_cpu_topology()
937 str = ph->env.sibling_threads; in print_cpu_topology()
944 if (ph->env.cpu != NULL) { in print_cpu_topology()
947 ph->env.cpu[i].core_id, ph->env.cpu[i].socket_id); in print_cpu_topology()
968 read_event_desc(struct perf_header *ph, int fd) in read_event_desc() argument
982 if (ph->needs_swap) in read_event_desc()
989 if (ph->needs_swap) in read_event_desc()
1017 if (ph->needs_swap) in read_event_desc()
1026 if (ph->needs_swap) { in read_event_desc()
1031 evsel->name = do_read_string(fd, ph); in read_event_desc()
1046 if (ph->needs_swap) in read_event_desc()
1066 static void print_event_desc(struct perf_header *ph, int fd, FILE *fp) in print_event_desc() argument
1068 struct perf_evsel *evsel, *events = read_event_desc(ph, fd); in print_event_desc()
1098 static void print_total_mem(struct perf_header *ph, int fd __maybe_unused, in print_total_mem() argument
1101 fprintf(fp, "# total memory : %Lu kB\n", ph->env.total_mem); in print_total_mem()
1104 static void print_numa_topology(struct perf_header *ph, int fd __maybe_unused, in print_numa_topology() argument
1112 nr = ph->env.nr_numa_nodes; in print_numa_topology()
1113 str = ph->env.numa_nodes; in print_numa_topology()
1145 static void print_cpuid(struct perf_header *ph, int fd __maybe_unused, FILE *fp) in print_cpuid() argument
1147 fprintf(fp, "# cpuid : %s\n", ph->env.cpuid); in print_cpuid()
1150 static void print_branch_stack(struct perf_header *ph __maybe_unused, in print_branch_stack()
1156 static void print_auxtrace(struct perf_header *ph __maybe_unused, in print_auxtrace()
1162 static void print_pmu_mappings(struct perf_header *ph, int fd __maybe_unused, in print_pmu_mappings() argument
1170 pmu_num = ph->env.nr_pmu_mappings; in print_pmu_mappings()
1176 str = ph->env.pmu_mappings; in print_pmu_mappings()
1199 static void print_group_desc(struct perf_header *ph, int fd __maybe_unused, in print_group_desc() argument
1206 session = container_of(ph, struct perf_session, header); in print_group_desc()
1372 struct perf_header *ph __maybe_unused, in process_tracing_data()
1380 struct perf_header *ph, int fd, in process_build_id() argument
1383 if (perf_header__read_build_ids(ph, fd, section->offset, section->size)) in process_build_id()
1389 struct perf_header *ph, int fd, in process_hostname() argument
1392 ph->env.hostname = do_read_string(fd, ph); in process_hostname()
1393 return ph->env.hostname ? 0 : -ENOMEM; in process_hostname()
1397 struct perf_header *ph, int fd, in process_osrelease() argument
1400 ph->env.os_release = do_read_string(fd, ph); in process_osrelease()
1401 return ph->env.os_release ? 0 : -ENOMEM; in process_osrelease()
1405 struct perf_header *ph, int fd, in process_version() argument
1408 ph->env.version = do_read_string(fd, ph); in process_version()
1409 return ph->env.version ? 0 : -ENOMEM; in process_version()
1413 struct perf_header *ph, int fd, in process_arch() argument
1416 ph->env.arch = do_read_string(fd, ph); in process_arch()
1417 return ph->env.arch ? 0 : -ENOMEM; in process_arch()
1421 struct perf_header *ph, int fd, in process_nrcpus() argument
1431 if (ph->needs_swap) in process_nrcpus()
1434 ph->env.nr_cpus_avail = nr; in process_nrcpus()
1440 if (ph->needs_swap) in process_nrcpus()
1443 ph->env.nr_cpus_online = nr; in process_nrcpus()
1448 struct perf_header *ph, int fd, in process_cpudesc() argument
1451 ph->env.cpu_desc = do_read_string(fd, ph); in process_cpudesc()
1452 return ph->env.cpu_desc ? 0 : -ENOMEM; in process_cpudesc()
1456 struct perf_header *ph, int fd, in process_cpuid() argument
1459 ph->env.cpuid = do_read_string(fd, ph); in process_cpuid()
1460 return ph->env.cpuid ? 0 : -ENOMEM; in process_cpuid()
1464 struct perf_header *ph, int fd, in process_total_mem() argument
1474 if (ph->needs_swap) in process_total_mem()
1477 ph->env.total_mem = mem; in process_total_mem()
1534 struct perf_header *ph, int fd, in process_cmdline() argument
1545 if (ph->needs_swap) in process_cmdline()
1548 ph->env.nr_cmdline = nr; in process_cmdline()
1559 str = do_read_string(fd, ph); in process_cmdline()
1568 ph->env.cmdline = cmdline; in process_cmdline()
1569 ph->env.cmdline_argv = (const char **) argv; in process_cmdline()
1579 struct perf_header *ph, int fd, in process_cpu_topology() argument
1586 int cpu_nr = ph->env.nr_cpus_online; in process_cpu_topology()
1589 ph->env.cpu = calloc(cpu_nr, sizeof(*ph->env.cpu)); in process_cpu_topology()
1590 if (!ph->env.cpu) in process_cpu_topology()
1597 if (ph->needs_swap) in process_cpu_topology()
1600 ph->env.nr_sibling_cores = nr; in process_cpu_topology()
1605 str = do_read_string(fd, ph); in process_cpu_topology()
1614 ph->env.sibling_cores = strbuf_detach(&sb, NULL); in process_cpu_topology()
1620 if (ph->needs_swap) in process_cpu_topology()
1623 ph->env.nr_sibling_threads = nr; in process_cpu_topology()
1627 str = do_read_string(fd, ph); in process_cpu_topology()
1636 ph->env.sibling_threads = strbuf_detach(&sb, NULL); in process_cpu_topology()
1643 zfree(&ph->env.cpu); in process_cpu_topology()
1652 if (ph->needs_swap) in process_cpu_topology()
1660 ph->env.cpu[i].core_id = nr; in process_cpu_topology()
1666 if (ph->needs_swap) in process_cpu_topology()
1675 ph->env.cpu[i].socket_id = nr; in process_cpu_topology()
1683 zfree(&ph->env.cpu); in process_cpu_topology()
1688 struct perf_header *ph, int fd, in process_numa_topology() argument
1702 if (ph->needs_swap) in process_numa_topology()
1705 ph->env.nr_numa_nodes = nr; in process_numa_topology()
1722 if (ph->needs_swap) { in process_numa_topology()
1731 str = do_read_string(fd, ph); in process_numa_topology()
1739 ph->env.numa_nodes = strbuf_detach(&sb, NULL); in process_numa_topology()
1748 struct perf_header *ph, int fd, in process_pmu_mappings() argument
1761 if (ph->needs_swap) in process_pmu_mappings()
1769 ph->env.nr_pmu_mappings = pmu_num; in process_pmu_mappings()
1775 if (ph->needs_swap) in process_pmu_mappings()
1778 name = do_read_string(fd, ph); in process_pmu_mappings()
1787 ph->env.msr_pmu_type = type; in process_pmu_mappings()
1792 ph->env.pmu_mappings = strbuf_detach(&sb, NULL); in process_pmu_mappings()
1801 struct perf_header *ph, int fd, in process_group_desc() argument
1817 if (ph->needs_swap) in process_group_desc()
1820 ph->env.nr_groups = nr_groups; in process_group_desc()
1831 desc[i].name = do_read_string(fd, ph); in process_group_desc()
1841 if (ph->needs_swap) { in process_group_desc()
1850 session = container_of(ph, struct perf_session, header); in process_group_desc()
1895 struct perf_header *ph, int fd, in process_auxtrace() argument
1901 session = container_of(ph, struct perf_session, header); in process_auxtrace()
1904 ph->needs_swap); in process_auxtrace()
1959 struct perf_header *ph, in perf_file_section__fprintf_info() argument
1977 feat_ops[feat].print(ph, fd, hd->fp); in perf_file_section__fprintf_info()
2177 struct perf_header *ph, in perf_header__process_sections() argument
2228 static int try_all_file_abis(uint64_t hdr_sz, struct perf_header *ph) in try_all_file_abis() argument
2241 ph->needs_swap = true; in try_all_file_abis()
2245 ph->needs_swap); in try_all_file_abis()
2266 static int try_all_pipe_abis(uint64_t hdr_sz, struct perf_header *ph) in try_all_pipe_abis() argument
2277 ph->needs_swap = true; in try_all_pipe_abis()
2296 bool is_pipe, struct perf_header *ph) in check_magic_endian() argument
2303 ph->version = PERF_HEADER_VERSION_1; in check_magic_endian()
2306 return try_all_pipe_abis(hdr_sz, ph); in check_magic_endian()
2308 return try_all_file_abis(hdr_sz, ph); in check_magic_endian()
2315 ph->version = PERF_HEADER_VERSION_2; in check_magic_endian()
2325 ph->needs_swap = true; in check_magic_endian()
2331 struct perf_header *ph, int fd) in perf_file_header__read() argument
2342 header->attr_size, false, ph) < 0) { in perf_file_header__read()
2347 if (ph->needs_swap) { in perf_file_header__read()
2358 } else if (ph->needs_swap) { in perf_file_header__read()
2393 memcpy(&ph->adds_features, &header->adds_features, in perf_file_header__read()
2394 sizeof(ph->adds_features)); in perf_file_header__read()
2396 ph->data_offset = header->data.offset; in perf_file_header__read()
2397 ph->data_size = header->data.size; in perf_file_header__read()
2398 ph->feat_offset = header->data.offset + header->data.size; in perf_file_header__read()
2403 struct perf_header *ph, in perf_file_section__process() argument
2420 return feat_ops[feat].process(section, ph, fd, data); in perf_file_section__process()
2424 struct perf_header *ph, int fd, in perf_file_header__read_pipe() argument
2433 if (check_magic_endian(header->magic, header->size, true, ph) < 0) { in perf_file_header__read_pipe()
2438 if (ph->needs_swap) in perf_file_header__read_pipe()
2462 static int read_attr(int fd, struct perf_header *ph, in read_attr() argument
2483 if (ph->needs_swap) in read_attr()