Lines Matching refs:t

606 					struct thread_data *t;  in for_all_cpus()  local
610 t = GET_THREAD(thread_base, thread_no, core_no, node_no, pkg_no); in for_all_cpus()
612 if (cpu_is_not_present(t->cpu_id)) in for_all_cpus()
618 retval = func(t, c, p); in for_all_cpus()
1019 int dump_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p) in dump_counters() argument
1024 outp += sprintf(outp, "t %p, c %p, p %p\n", t, c, p); in dump_counters()
1026 if (t) { in dump_counters()
1027 outp += sprintf(outp, "CPU: %d flags 0x%x\n", t->cpu_id, t->flags); in dump_counters()
1028 outp += sprintf(outp, "TSC: %016llX\n", t->tsc); in dump_counters()
1029 outp += sprintf(outp, "aperf: %016llX\n", t->aperf); in dump_counters()
1030 outp += sprintf(outp, "mperf: %016llX\n", t->mperf); in dump_counters()
1031 outp += sprintf(outp, "c1: %016llX\n", t->c1); in dump_counters()
1034 outp += sprintf(outp, "IPC: %lld\n", t->instr_count); in dump_counters()
1037 outp += sprintf(outp, "IRQ: %lld\n", t->irq_count); in dump_counters()
1039 outp += sprintf(outp, "SMI: %d\n", t->smi_count); in dump_counters()
1042 outp += sprintf(outp, "tADDED [%d] msr0x%x: %08llX\n", i, mp->msr_num, t->counter[i]); in dump_counters()
1102 int format_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p) in format_counters() argument
1112 if (show_core_only && !(t->flags & CPU_IS_FIRST_THREAD_IN_CORE)) in format_counters()
1116 if (show_pkg_only && !(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE)) in format_counters()
1120 …if ((t != &average.threads) && (cpu_subset && !CPU_ISSET_S(t->cpu_id, cpu_subset_size, cpu_subset)… in format_counters()
1127 timersub(&t->tv_end, &t->tv_begin, &tv); in format_counters()
1133 outp += sprintf(outp, "%10ld.%06ld\t", t->tv_end.tv_sec, t->tv_end.tv_usec); in format_counters()
1135 interval_float = t->tv_delta.tv_sec + t->tv_delta.tv_usec / 1000000.0; in format_counters()
1137 tsc = t->tsc * tsc_tweak; in format_counters()
1140 if (t == &average.threads) { in format_counters()
1164 outp += sprintf(outp, "%s%d", (printed++ ? delim : ""), cpus[t->cpu_id].die_id); in format_counters()
1169 if (t) in format_counters()
1171 (printed++ ? delim : ""), cpus[t->cpu_id].physical_node_id); in format_counters()
1182 outp += sprintf(outp, "%s%d", (printed++ ? delim : ""), t->cpu_id); in format_counters()
1184 outp += sprintf(outp, "%s%d", (printed++ ? delim : ""), t->apic_id); in format_counters()
1186 outp += sprintf(outp, "%s%d", (printed++ ? delim : ""), t->x2apic_id); in format_counters()
1190 …outp += sprintf(outp, "%s%.0f", (printed++ ? delim : ""), 1.0 / units * t->aperf / interval_float); in format_counters()
1193 outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 100.0 * t->mperf / tsc); in format_counters()
1198 sprintf(outp, "%s%.0f", (printed++ ? delim : ""), base_hz / units * t->aperf / t->mperf); in format_counters()
1201 tsc / units * t->aperf / t->mperf / interval_float); in format_counters()
1205 outp += sprintf(outp, "%s%.0f", (printed++ ? delim : ""), 1.0 * t->tsc / units / interval_float); in format_counters()
1208 outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 1.0 * t->instr_count / t->aperf); in format_counters()
1213 outp += sprintf(outp, "%s%8lld", (printed++ ? delim : ""), t->irq_count); in format_counters()
1215 outp += sprintf(outp, "%s%lld", (printed++ ? delim : ""), t->irq_count); in format_counters()
1220 outp += sprintf(outp, "%s%d", (printed++ ? delim : ""), t->smi_count); in format_counters()
1227 sprintf(outp, "%s0x%08x", (printed++ ? delim : ""), (unsigned int)t->counter[i]); in format_counters()
1229 outp += sprintf(outp, "%s0x%016llx", (printed++ ? delim : ""), t->counter[i]); in format_counters()
1232 outp += sprintf(outp, "%s%8lld", (printed++ ? delim : ""), t->counter[i]); in format_counters()
1234 outp += sprintf(outp, "%s%lld", (printed++ ? delim : ""), t->counter[i]); in format_counters()
1239 t->counter[i] / interval_float / 10000); in format_counters()
1241 outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 100.0 * t->counter[i] / tsc); in format_counters()
1247 outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), 100.0 * t->c1 / tsc); in format_counters()
1250 if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE)) in format_counters()
1297 if (!(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE)) in format_counters()
1434 void format_all_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p) in format_all_counters() argument
1448 for_all_cpus(format_counters, t, c, p); in format_all_counters()
1626 int delta_cpu(struct thread_data *t, struct core_data *c, in delta_cpu() argument
1632 if (t->flags & CPU_IS_FIRST_THREAD_IN_CORE) in delta_cpu()
1636 retval = delta_thread(t, t2, c2); /* c2 is core delta */ in delta_cpu()
1641 if (t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE) in delta_cpu()
1647 void clear_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p) in clear_counters() argument
1652 t->tv_begin.tv_sec = 0; in clear_counters()
1653 t->tv_begin.tv_usec = 0; in clear_counters()
1654 t->tv_end.tv_sec = 0; in clear_counters()
1655 t->tv_end.tv_usec = 0; in clear_counters()
1656 t->tv_delta.tv_sec = 0; in clear_counters()
1657 t->tv_delta.tv_usec = 0; in clear_counters()
1659 t->tsc = 0; in clear_counters()
1660 t->aperf = 0; in clear_counters()
1661 t->mperf = 0; in clear_counters()
1662 t->c1 = 0; in clear_counters()
1664 t->instr_count = 0; in clear_counters()
1666 t->irq_count = 0; in clear_counters()
1667 t->smi_count = 0; in clear_counters()
1670 t->flags = CPU_IS_FIRST_THREAD_IN_CORE | CPU_IS_FIRST_CORE_IN_PACKAGE; in clear_counters()
1711 t->counter[i] = 0; in clear_counters()
1720 int sum_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p) in sum_counters() argument
1727 average.threads.apic_id = t->apic_id; in sum_counters()
1729 average.threads.x2apic_id = t->x2apic_id; in sum_counters()
1733 average.threads.tv_begin = t->tv_begin; in sum_counters()
1736 average.threads.tv_end = t->tv_end; in sum_counters()
1738 average.threads.tsc += t->tsc; in sum_counters()
1739 average.threads.aperf += t->aperf; in sum_counters()
1740 average.threads.mperf += t->mperf; in sum_counters()
1741 average.threads.c1 += t->c1; in sum_counters()
1743 average.threads.instr_count += t->instr_count; in sum_counters()
1745 average.threads.irq_count += t->irq_count; in sum_counters()
1746 average.threads.smi_count += t->smi_count; in sum_counters()
1751 average.threads.counter[i] += t->counter[i]; in sum_counters()
1755 if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE)) in sum_counters()
1775 if (!(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE)) in sum_counters()
1829 void compute_average(struct thread_data *t, struct core_data *c, struct pkg_data *p) in compute_average() argument
1836 for_all_cpus(sum_counters, t, c, p); in compute_average()
2006 void get_apic_id(struct thread_data *t) in get_apic_id() argument
2014 t->apic_id = (ebx >> 24) & 0xff; in get_apic_id()
2036 t->x2apic_id = eax; in get_apic_id()
2048 t->x2apic_id = edx; in get_apic_id()
2050 if (debug && (t->apic_id != (t->x2apic_id & 0xff))) in get_apic_id()
2051 fprintf(outf, "cpu%d: BIOS BUG: apic 0x%x x2apic 0x%x\n", t->cpu_id, t->apic_id, t->x2apic_id); in get_apic_id()
2079 int get_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p) in get_counters() argument
2081 int cpu = t->cpu_id; in get_counters()
2092 gettimeofday(&t->tv_begin, (struct timezone *)NULL); in get_counters()
2095 get_apic_id(t); in get_counters()
2097 t->tsc = rdtsc(); /* we are running on local CPU of interest */ in get_counters()
2117 if (get_msr(cpu, MSR_IA32_APERF, &t->aperf)) in get_counters()
2120 t->tsc = rdtsc(); /* re-read close to APERF */ in get_counters()
2122 tsc_before = t->tsc; in get_counters()
2124 if (get_msr(cpu, MSR_IA32_APERF, &t->aperf)) in get_counters()
2129 if (get_msr(cpu, MSR_IA32_MPERF, &t->mperf)) in get_counters()
2150 t->aperf = t->aperf * aperf_mperf_multiplier; in get_counters()
2151 t->mperf = t->mperf * aperf_mperf_multiplier; in get_counters()
2155 if (read(get_instr_count_fd(cpu), &t->instr_count, sizeof(long long)) != sizeof(long long)) in get_counters()
2159 t->irq_count = irqs_per_cpu[cpu]; in get_counters()
2163 t->smi_count = msr & 0xFFFFFFFF; in get_counters()
2166 if (get_msr(cpu, MSR_CORE_C1_RES, &t->c1)) in get_counters()
2171 if (get_mp(cpu, mp, &t->counter[i])) in get_counters()
2176 if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE)) in get_counters()
2195 else if (t->is_atom) { in get_counters()
2231 if (!(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE)) in get_counters()
2343 gettimeofday(&t->tv_end, (struct timezone *)NULL); in get_counters()
2999 struct thread_data *t, *t2; in for_all_cpus_2() local
3003 t = GET_THREAD(thread_base, thread_no, core_no, node_no, pkg_no); in for_all_cpus_2()
3005 if (cpu_is_not_present(t->cpu_id)) in for_all_cpus_2()
3016 retval = func(t, c, p, t2, c2, p2); in for_all_cpus_2()
3421 static int update_msr_sum(struct thread_data *t, struct core_data *c, struct pkg_data *p) in update_msr_sum() argument
3424 int cpu = t->cpu_id; in update_msr_sum()
4303 int print_epb(struct thread_data *t, struct core_data *c, struct pkg_data *p) in print_epb() argument
4314 cpu = t->cpu_id; in print_epb()
4317 if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE) || !(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE)) in print_epb()
4352 int print_hwp(struct thread_data *t, struct core_data *c, struct pkg_data *p) in print_hwp() argument
4363 cpu = t->cpu_id; in print_hwp()
4366 if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE) || !(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE)) in print_hwp()
4438 int print_perf_limit(struct thread_data *t, struct core_data *c, struct pkg_data *p) in print_perf_limit() argument
4446 cpu = t->cpu_id; in print_perf_limit()
4449 if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE) || !(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE)) in print_perf_limit()
4842 int print_thermal(struct thread_data *t, struct core_data *c, struct pkg_data *p) in print_thermal() argument
4854 cpu = t->cpu_id; in print_thermal()
4857 if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE)) in print_thermal()
4865 if (do_ptm && (t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE)) { in print_thermal()
4916 int print_rapl(struct thread_data *t, struct core_data *c, struct pkg_data *p) in print_rapl() argument
4929 if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE) || !(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE)) in print_rapl()
4932 cpu = t->cpu_id; in print_rapl()
5224 int get_cpu_type(struct thread_data *t, struct core_data *c, struct pkg_data *p) in get_cpu_type() argument
5234 if (cpu_migrate(t->cpu_id)) { in get_cpu_type()
5235 fprintf(outf, "Could not migrate to CPU %d\n", t->cpu_id); in get_cpu_type()
5245 t->is_atom = true; in get_cpu_type()
5261 int set_temperature_target(struct thread_data *t, struct core_data *c, struct pkg_data *p) in set_temperature_target() argument
5275 if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE) || !(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE)) in set_temperature_target()
5278 cpu = t->cpu_id; in set_temperature_target()
6006 void allocate_counters(struct thread_data **t, struct core_data **c, struct pkg_data **p) in allocate_counters() argument
6012 *t = calloc(num_threads, sizeof(struct thread_data)); in allocate_counters()
6013 if (*t == NULL) in allocate_counters()
6017 (*t)[i].cpu_id = -1; in allocate_counters()
6049 struct thread_data *t; in init_counter() local
6059 t = GET_THREAD(thread_base, thread_id, core_id, node_id, pkg_id); in init_counter()
6063 t->cpu_id = cpu_id; in init_counter()
6065 t->flags |= CPU_IS_FIRST_THREAD_IN_CORE; in init_counter()
6067 t->flags |= CPU_IS_FIRST_CORE_IN_PACKAGE; in init_counter()