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()
872 static void print_hostname(struct perf_header *ph, int fd __maybe_unused, in print_hostname() argument
875 fprintf(fp, "# hostname : %s\n", ph->env.hostname); in print_hostname()
878 static void print_osrelease(struct perf_header *ph, int fd __maybe_unused, in print_osrelease() argument
881 fprintf(fp, "# os release : %s\n", ph->env.os_release); in print_osrelease()
884 static void print_arch(struct perf_header *ph, int fd __maybe_unused, FILE *fp) in print_arch() argument
886 fprintf(fp, "# arch : %s\n", ph->env.arch); in print_arch()
889 static void print_cpudesc(struct perf_header *ph, int fd __maybe_unused, in print_cpudesc() argument
892 fprintf(fp, "# cpudesc : %s\n", ph->env.cpu_desc); in print_cpudesc()
895 static void print_nrcpus(struct perf_header *ph, int fd __maybe_unused, in print_nrcpus() argument
898 fprintf(fp, "# nrcpus online : %u\n", ph->env.nr_cpus_online); in print_nrcpus()
899 fprintf(fp, "# nrcpus avail : %u\n", ph->env.nr_cpus_avail); in print_nrcpus()
902 static void print_version(struct perf_header *ph, int fd __maybe_unused, in print_version() argument
905 fprintf(fp, "# perf version : %s\n", ph->env.version); in print_version()
908 static void print_cmdline(struct perf_header *ph, int fd __maybe_unused, in print_cmdline() argument
914 nr = ph->env.nr_cmdline; in print_cmdline()
915 str = ph->env.cmdline; in print_cmdline()
926 static void print_cpu_topology(struct perf_header *ph, int fd __maybe_unused, in print_cpu_topology() argument
932 nr = ph->env.nr_sibling_cores; in print_cpu_topology()
933 str = ph->env.sibling_cores; in print_cpu_topology()
940 nr = ph->env.nr_sibling_threads; in print_cpu_topology()
941 str = ph->env.sibling_threads; in print_cpu_topology()
965 read_event_desc(struct perf_header *ph, int fd) in read_event_desc() argument
979 if (ph->needs_swap) in read_event_desc()
986 if (ph->needs_swap) in read_event_desc()
1014 if (ph->needs_swap) in read_event_desc()
1023 if (ph->needs_swap) { in read_event_desc()
1028 evsel->name = do_read_string(fd, ph); in read_event_desc()
1043 if (ph->needs_swap) in read_event_desc()
1064 static void print_event_desc(struct perf_header *ph, int fd, FILE *fp) in print_event_desc() argument
1066 struct perf_evsel *evsel, *events = read_event_desc(ph, fd); in print_event_desc()
1096 static void print_total_mem(struct perf_header *ph, int fd __maybe_unused, in print_total_mem() argument
1099 fprintf(fp, "# total memory : %Lu kB\n", ph->env.total_mem); in print_total_mem()
1102 static void print_numa_topology(struct perf_header *ph, int fd __maybe_unused, in print_numa_topology() argument
1110 nr = ph->env.nr_numa_nodes; in print_numa_topology()
1111 str = ph->env.numa_nodes; in print_numa_topology()
1143 static void print_cpuid(struct perf_header *ph, int fd __maybe_unused, FILE *fp) in print_cpuid() argument
1145 fprintf(fp, "# cpuid : %s\n", ph->env.cpuid); in print_cpuid()
1148 static void print_branch_stack(struct perf_header *ph __maybe_unused, in print_branch_stack()
1154 static void print_pmu_mappings(struct perf_header *ph, int fd __maybe_unused, in print_pmu_mappings() argument
1162 pmu_num = ph->env.nr_pmu_mappings; in print_pmu_mappings()
1168 str = ph->env.pmu_mappings; in print_pmu_mappings()
1191 static void print_group_desc(struct perf_header *ph, int fd __maybe_unused, in print_group_desc() argument
1198 session = container_of(ph, struct perf_session, header); in print_group_desc()
1367 struct perf_header *ph __maybe_unused, in process_tracing_data()
1375 struct perf_header *ph, int fd, in process_build_id() argument
1378 if (perf_header__read_build_ids(ph, fd, section->offset, section->size)) in process_build_id()
1384 struct perf_header *ph, int fd, in process_hostname() argument
1387 ph->env.hostname = do_read_string(fd, ph); in process_hostname()
1388 return ph->env.hostname ? 0 : -ENOMEM; in process_hostname()
1392 struct perf_header *ph, int fd, in process_osrelease() argument
1395 ph->env.os_release = do_read_string(fd, ph); in process_osrelease()
1396 return ph->env.os_release ? 0 : -ENOMEM; in process_osrelease()
1400 struct perf_header *ph, int fd, in process_version() argument
1403 ph->env.version = do_read_string(fd, ph); in process_version()
1404 return ph->env.version ? 0 : -ENOMEM; in process_version()
1408 struct perf_header *ph, int fd, in process_arch() argument
1411 ph->env.arch = do_read_string(fd, ph); in process_arch()
1412 return ph->env.arch ? 0 : -ENOMEM; in process_arch()
1416 struct perf_header *ph, int fd, in process_nrcpus() argument
1426 if (ph->needs_swap) in process_nrcpus()
1429 ph->env.nr_cpus_avail = nr; in process_nrcpus()
1435 if (ph->needs_swap) in process_nrcpus()
1438 ph->env.nr_cpus_online = nr; in process_nrcpus()
1443 struct perf_header *ph, int fd, in process_cpudesc() argument
1446 ph->env.cpu_desc = do_read_string(fd, ph); in process_cpudesc()
1447 return ph->env.cpu_desc ? 0 : -ENOMEM; in process_cpudesc()
1451 struct perf_header *ph, int fd, in process_cpuid() argument
1454 ph->env.cpuid = do_read_string(fd, ph); in process_cpuid()
1455 return ph->env.cpuid ? 0 : -ENOMEM; in process_cpuid()
1459 struct perf_header *ph, int fd, in process_total_mem() argument
1469 if (ph->needs_swap) in process_total_mem()
1472 ph->env.total_mem = mem; in process_total_mem()
1529 struct perf_header *ph, int fd, in process_cmdline() argument
1541 if (ph->needs_swap) in process_cmdline()
1544 ph->env.nr_cmdline = nr; in process_cmdline()
1548 str = do_read_string(fd, ph); in process_cmdline()
1556 ph->env.cmdline = strbuf_detach(&sb, NULL); in process_cmdline()
1565 struct perf_header *ph, int fd, in process_cpu_topology() argument
1577 if (ph->needs_swap) in process_cpu_topology()
1580 ph->env.nr_sibling_cores = nr; in process_cpu_topology()
1584 str = do_read_string(fd, ph); in process_cpu_topology()
1592 ph->env.sibling_cores = strbuf_detach(&sb, NULL); in process_cpu_topology()
1598 if (ph->needs_swap) in process_cpu_topology()
1601 ph->env.nr_sibling_threads = nr; in process_cpu_topology()
1604 str = do_read_string(fd, ph); in process_cpu_topology()
1612 ph->env.sibling_threads = strbuf_detach(&sb, NULL); in process_cpu_topology()
1621 struct perf_header *ph, int fd, in process_numa_topology() argument
1635 if (ph->needs_swap) in process_numa_topology()
1638 ph->env.nr_numa_nodes = nr; in process_numa_topology()
1655 if (ph->needs_swap) { in process_numa_topology()
1664 str = do_read_string(fd, ph); in process_numa_topology()
1672 ph->env.numa_nodes = strbuf_detach(&sb, NULL); in process_numa_topology()
1681 struct perf_header *ph, int fd, in process_pmu_mappings() argument
1694 if (ph->needs_swap) in process_pmu_mappings()
1702 ph->env.nr_pmu_mappings = pmu_num; in process_pmu_mappings()
1708 if (ph->needs_swap) in process_pmu_mappings()
1711 name = do_read_string(fd, ph); in process_pmu_mappings()
1722 ph->env.pmu_mappings = strbuf_detach(&sb, NULL); in process_pmu_mappings()
1731 struct perf_header *ph, int fd, in process_group_desc() argument
1747 if (ph->needs_swap) in process_group_desc()
1750 ph->env.nr_groups = nr_groups; in process_group_desc()
1761 desc[i].name = do_read_string(fd, ph); in process_group_desc()
1771 if (ph->needs_swap) { in process_group_desc()
1780 session = container_of(ph, struct perf_session, header); in process_group_desc()
1872 struct perf_header *ph, in perf_file_section__fprintf_info() argument
1890 feat_ops[feat].print(ph, fd, hd->fp); in perf_file_section__fprintf_info()
2090 struct perf_header *ph, in perf_header__process_sections() argument
2141 static int try_all_file_abis(uint64_t hdr_sz, struct perf_header *ph) in try_all_file_abis() argument
2154 ph->needs_swap = true; in try_all_file_abis()
2158 ph->needs_swap); in try_all_file_abis()
2179 static int try_all_pipe_abis(uint64_t hdr_sz, struct perf_header *ph) in try_all_pipe_abis() argument
2190 ph->needs_swap = true; in try_all_pipe_abis()
2209 bool is_pipe, struct perf_header *ph) in check_magic_endian() argument
2216 ph->version = PERF_HEADER_VERSION_1; in check_magic_endian()
2219 return try_all_pipe_abis(hdr_sz, ph); in check_magic_endian()
2221 return try_all_file_abis(hdr_sz, ph); in check_magic_endian()
2228 ph->version = PERF_HEADER_VERSION_2; in check_magic_endian()
2238 ph->needs_swap = true; in check_magic_endian()
2244 struct perf_header *ph, int fd) in perf_file_header__read() argument
2255 header->attr_size, false, ph) < 0) { in perf_file_header__read()
2260 if (ph->needs_swap) { in perf_file_header__read()
2271 } else if (ph->needs_swap) { in perf_file_header__read()
2306 memcpy(&ph->adds_features, &header->adds_features, in perf_file_header__read()
2307 sizeof(ph->adds_features)); in perf_file_header__read()
2309 ph->data_offset = header->data.offset; in perf_file_header__read()
2310 ph->data_size = header->data.size; in perf_file_header__read()
2311 ph->feat_offset = header->data.offset + header->data.size; in perf_file_header__read()
2316 struct perf_header *ph, in perf_file_section__process() argument
2333 return feat_ops[feat].process(section, ph, fd, data); in perf_file_section__process()
2337 struct perf_header *ph, int fd, in perf_file_header__read_pipe() argument
2346 if (check_magic_endian(header->magic, header->size, true, ph) < 0) { in perf_file_header__read_pipe()
2351 if (ph->needs_swap) in perf_file_header__read_pipe()
2375 static int read_attr(int fd, struct perf_header *ph, in read_attr() argument
2396 if (ph->needs_swap) in read_attr()