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()
1380 struct perf_header *ph __maybe_unused, in process_tracing_data()
1388 struct perf_header *ph, int fd, in process_build_id() argument
1391 if (perf_header__read_build_ids(ph, fd, section->offset, section->size)) in process_build_id()
1397 struct perf_header *ph, int fd, in process_hostname() argument
1400 ph->env.hostname = do_read_string(fd, ph); in process_hostname()
1401 return ph->env.hostname ? 0 : -ENOMEM; in process_hostname()
1405 struct perf_header *ph, int fd, in process_osrelease() argument
1408 ph->env.os_release = do_read_string(fd, ph); in process_osrelease()
1409 return ph->env.os_release ? 0 : -ENOMEM; in process_osrelease()
1413 struct perf_header *ph, int fd, in process_version() argument
1416 ph->env.version = do_read_string(fd, ph); in process_version()
1417 return ph->env.version ? 0 : -ENOMEM; in process_version()
1421 struct perf_header *ph, int fd, in process_arch() argument
1424 ph->env.arch = do_read_string(fd, ph); in process_arch()
1425 return ph->env.arch ? 0 : -ENOMEM; in process_arch()
1429 struct perf_header *ph, int fd, in process_nrcpus() argument
1439 if (ph->needs_swap) in process_nrcpus()
1442 ph->env.nr_cpus_avail = nr; in process_nrcpus()
1448 if (ph->needs_swap) in process_nrcpus()
1451 ph->env.nr_cpus_online = nr; in process_nrcpus()
1456 struct perf_header *ph, int fd, in process_cpudesc() argument
1459 ph->env.cpu_desc = do_read_string(fd, ph); in process_cpudesc()
1460 return ph->env.cpu_desc ? 0 : -ENOMEM; in process_cpudesc()
1464 struct perf_header *ph, int fd, in process_cpuid() argument
1467 ph->env.cpuid = do_read_string(fd, ph); in process_cpuid()
1468 return ph->env.cpuid ? 0 : -ENOMEM; in process_cpuid()
1472 struct perf_header *ph, int fd, in process_total_mem() argument
1482 if (ph->needs_swap) in process_total_mem()
1485 ph->env.total_mem = mem; in process_total_mem()
1542 struct perf_header *ph, int fd, in process_cmdline() argument
1553 if (ph->needs_swap) in process_cmdline()
1556 ph->env.nr_cmdline = nr; in process_cmdline()
1567 str = do_read_string(fd, ph); in process_cmdline()
1576 ph->env.cmdline = cmdline; in process_cmdline()
1577 ph->env.cmdline_argv = (const char **) argv; in process_cmdline()
1587 struct perf_header *ph, int fd, in process_cpu_topology() argument
1594 int cpu_nr = ph->env.nr_cpus_online; in process_cpu_topology()
1597 ph->env.cpu = calloc(cpu_nr, sizeof(*ph->env.cpu)); in process_cpu_topology()
1598 if (!ph->env.cpu) in process_cpu_topology()
1605 if (ph->needs_swap) in process_cpu_topology()
1608 ph->env.nr_sibling_cores = nr; in process_cpu_topology()
1613 str = do_read_string(fd, ph); in process_cpu_topology()
1622 ph->env.sibling_cores = strbuf_detach(&sb, NULL); in process_cpu_topology()
1628 if (ph->needs_swap) in process_cpu_topology()
1631 ph->env.nr_sibling_threads = nr; in process_cpu_topology()
1635 str = do_read_string(fd, ph); in process_cpu_topology()
1644 ph->env.sibling_threads = strbuf_detach(&sb, NULL); in process_cpu_topology()
1651 zfree(&ph->env.cpu); in process_cpu_topology()
1660 if (ph->needs_swap) in process_cpu_topology()
1668 ph->env.cpu[i].core_id = nr; in process_cpu_topology()
1674 if (ph->needs_swap) in process_cpu_topology()
1683 ph->env.cpu[i].socket_id = nr; in process_cpu_topology()
1691 zfree(&ph->env.cpu); in process_cpu_topology()
1696 struct perf_header *ph, int fd, in process_numa_topology() argument
1710 if (ph->needs_swap) in process_numa_topology()
1713 ph->env.nr_numa_nodes = nr; in process_numa_topology()
1730 if (ph->needs_swap) { in process_numa_topology()
1739 str = do_read_string(fd, ph); in process_numa_topology()
1747 ph->env.numa_nodes = strbuf_detach(&sb, NULL); in process_numa_topology()
1756 struct perf_header *ph, int fd, in process_pmu_mappings() argument
1769 if (ph->needs_swap) in process_pmu_mappings()
1777 ph->env.nr_pmu_mappings = pmu_num; in process_pmu_mappings()
1783 if (ph->needs_swap) in process_pmu_mappings()
1786 name = do_read_string(fd, ph); in process_pmu_mappings()
1795 ph->env.msr_pmu_type = type; in process_pmu_mappings()
1800 ph->env.pmu_mappings = strbuf_detach(&sb, NULL); in process_pmu_mappings()
1809 struct perf_header *ph, int fd, in process_group_desc() argument
1825 if (ph->needs_swap) in process_group_desc()
1828 ph->env.nr_groups = nr_groups; in process_group_desc()
1839 desc[i].name = do_read_string(fd, ph); in process_group_desc()
1849 if (ph->needs_swap) { in process_group_desc()
1858 session = container_of(ph, struct perf_session, header); in process_group_desc()
1903 struct perf_header *ph, int fd, in process_auxtrace() argument
1909 session = container_of(ph, struct perf_session, header); in process_auxtrace()
1912 ph->needs_swap); in process_auxtrace()
1967 struct perf_header *ph, in perf_file_section__fprintf_info() argument
1985 feat_ops[feat].print(ph, fd, hd->fp); in perf_file_section__fprintf_info()
2185 struct perf_header *ph, in perf_header__process_sections() argument
2236 static int try_all_file_abis(uint64_t hdr_sz, struct perf_header *ph) in try_all_file_abis() argument
2249 ph->needs_swap = true; in try_all_file_abis()
2253 ph->needs_swap); in try_all_file_abis()
2274 static int try_all_pipe_abis(uint64_t hdr_sz, struct perf_header *ph) in try_all_pipe_abis() argument
2285 ph->needs_swap = true; in try_all_pipe_abis()
2304 bool is_pipe, struct perf_header *ph) in check_magic_endian() argument
2311 ph->version = PERF_HEADER_VERSION_1; in check_magic_endian()
2314 return try_all_pipe_abis(hdr_sz, ph); in check_magic_endian()
2316 return try_all_file_abis(hdr_sz, ph); in check_magic_endian()
2323 ph->version = PERF_HEADER_VERSION_2; in check_magic_endian()
2333 ph->needs_swap = true; in check_magic_endian()
2339 struct perf_header *ph, int fd) in perf_file_header__read() argument
2350 header->attr_size, false, ph) < 0) { in perf_file_header__read()
2355 if (ph->needs_swap) { in perf_file_header__read()
2366 } else if (ph->needs_swap) { in perf_file_header__read()
2401 memcpy(&ph->adds_features, &header->adds_features, in perf_file_header__read()
2402 sizeof(ph->adds_features)); in perf_file_header__read()
2404 ph->data_offset = header->data.offset; in perf_file_header__read()
2405 ph->data_size = header->data.size; in perf_file_header__read()
2406 ph->feat_offset = header->data.offset + header->data.size; in perf_file_header__read()
2411 struct perf_header *ph, in perf_file_section__process() argument
2428 return feat_ops[feat].process(section, ph, fd, data); in perf_file_section__process()
2432 struct perf_header *ph, int fd, in perf_file_header__read_pipe() argument
2441 if (check_magic_endian(header->magic, header->size, true, ph) < 0) { in perf_file_header__read_pipe()
2446 if (ph->needs_swap) in perf_file_header__read_pipe()
2470 static int read_attr(int fd, struct perf_header *ph, in read_attr() argument
2491 if (ph->needs_swap) in read_attr()