|
3 | 3 | * turbostat -- show CPU frequency and C-state residency |
4 | 4 | * on modern Intel and AMD processors. |
5 | 5 | * |
6 | | - * Copyright (c) 2025 Intel Corporation. |
| 6 | + * Copyright (c) 2010 - 2026 Intel Corporation |
7 | 7 | * Len Brown <len.brown@intel.com> |
8 | 8 | */ |
9 | 9 |
|
@@ -2735,8 +2735,7 @@ void help(void) |
2735 | 2735 | " sets the Thermal Control Circuit temperature in\n" |
2736 | 2736 | " degrees Celsius\n" |
2737 | 2737 | " -h, --help\n" |
2738 | | - " print this help message\n" |
2739 | | - " -v, --version\n\t\tprint version information\n\nFor more help, run \"man turbostat\"\n"); |
| 2738 | + " print this help message\n -v, --version\n\t\tprint version information\n\nFor more help, run \"man turbostat\"\n"); |
2740 | 2739 | } |
2741 | 2740 |
|
2742 | 2741 | /* |
@@ -3671,11 +3670,9 @@ int format_counters(PER_THREAD_PARAMS) |
3671 | 3670 | if (DO_BIC(BIC_RAM_J)) |
3672 | 3671 | outp += sprintf(outp, fmt8, (printed++ ? delim : ""), rapl_counter_get_value(&p->energy_dram, RAPL_UNIT_JOULES, interval_float)); |
3673 | 3672 | if (DO_BIC(BIC_PKG__)) |
3674 | | - outp += |
3675 | | - sprintf(outp, fmt8, (printed++ ? delim : ""), rapl_counter_get_value(&p->rapl_pkg_perf_status, RAPL_UNIT_WATTS, interval_float)); |
| 3673 | + outp += sprintf(outp, fmt8, (printed++ ? delim : ""), rapl_counter_get_value(&p->rapl_pkg_perf_status, RAPL_UNIT_WATTS, interval_float)); |
3676 | 3674 | if (DO_BIC(BIC_RAM__)) |
3677 | | - outp += |
3678 | | - sprintf(outp, fmt8, (printed++ ? delim : ""), rapl_counter_get_value(&p->rapl_dram_perf_status, RAPL_UNIT_WATTS, interval_float)); |
| 3675 | + outp += sprintf(outp, fmt8, (printed++ ? delim : ""), rapl_counter_get_value(&p->rapl_dram_perf_status, RAPL_UNIT_WATTS, interval_float)); |
3679 | 3676 | /* UncMHz */ |
3680 | 3677 | if (DO_BIC(BIC_UNCORE_MHZ)) |
3681 | 3678 | outp += sprintf(outp, "%s%d", (printed++ ? delim : ""), p->uncore_mhz); |
@@ -3725,11 +3722,9 @@ int format_counters(PER_THREAD_PARAMS) |
3725 | 3722 | } |
3726 | 3723 |
|
3727 | 3724 | if (DO_BIC(BIC_SysWatt) && (t == average.threads)) |
3728 | | - outp += sprintf(outp, fmt8, (printed++ ? delim : ""), |
3729 | | - rapl_counter_get_value(&pplat_cnt->energy_psys, RAPL_UNIT_WATTS, interval_float)); |
| 3725 | + outp += sprintf(outp, fmt8, (printed++ ? delim : ""), rapl_counter_get_value(&pplat_cnt->energy_psys, RAPL_UNIT_WATTS, interval_float)); |
3730 | 3726 | if (DO_BIC(BIC_Sys_J) && (t == average.threads)) |
3731 | | - outp += sprintf(outp, fmt8, (printed++ ? delim : ""), |
3732 | | - rapl_counter_get_value(&pplat_cnt->energy_psys, RAPL_UNIT_JOULES, interval_float)); |
| 3727 | + outp += sprintf(outp, fmt8, (printed++ ? delim : ""), rapl_counter_get_value(&pplat_cnt->energy_psys, RAPL_UNIT_JOULES, interval_float)); |
3733 | 3728 |
|
3734 | 3729 | done: |
3735 | 3730 | if (*(outp - 1) != '\n') |
@@ -3942,7 +3937,7 @@ int delta_thread(struct thread_data *new, struct thread_data *old, struct core_d |
3942 | 3937 | /* check for TSC < 1 Mcycles over interval */ |
3943 | 3938 | if (old->tsc < (1000 * 1000)) |
3944 | 3939 | errx(-3, "Insanely slow TSC rate, TSC stops in idle?\n" |
3945 | | - "You can disable all c-states by booting with \"idle=poll\"\n" "or just the deep ones with \"processor.max_cstate=1\""); |
| 3940 | + "You can disable all c-states by booting with \"idle=poll\"\nor just the deep ones with \"processor.max_cstate=1\""); |
3946 | 3941 |
|
3947 | 3942 | old->c1 = new->c1 - old->c1; |
3948 | 3943 |
|
@@ -5546,8 +5541,7 @@ static void dump_turbo_ratio_limits(int trl_msr_offset) |
5546 | 5541 | int shift; |
5547 | 5542 |
|
5548 | 5543 | get_msr(master_cpu, trl_msr_offset, &msr); |
5549 | | - fprintf(outf, "cpu%d: MSR_%sTURBO_RATIO_LIMIT: 0x%08llx\n", |
5550 | | - master_cpu, trl_msr_offset == MSR_SECONDARY_TURBO_RATIO_LIMIT ? "SECONDARY_" : "", msr); |
| 5544 | + fprintf(outf, "cpu%d: MSR_%sTURBO_RATIO_LIMIT: 0x%08llx\n", master_cpu, trl_msr_offset == MSR_SECONDARY_TURBO_RATIO_LIMIT ? "SECONDARY_" : "", msr); |
5551 | 5545 |
|
5552 | 5546 | if (platform->trl_msrs & TRL_CORECOUNT) { |
5553 | 5547 | get_msr(master_cpu, MSR_TURBO_RATIO_LIMIT1, &core_counts); |
@@ -8019,8 +8013,7 @@ int print_rapl(PER_THREAD_PARAMS) |
8019 | 8013 | return -1; |
8020 | 8014 | } |
8021 | 8015 |
|
8022 | | - fprintf(outf, "cpu%d: %s: 0x%08llx (%f Watts, %f Joules, %f sec.)\n", cpu, msr_name, msr, |
8023 | | - rapl_power_units, rapl_energy_units, rapl_time_units); |
| 8016 | + fprintf(outf, "cpu%d: %s: 0x%08llx (%f Watts, %f Joules, %f sec.)\n", cpu, msr_name, msr, rapl_power_units, rapl_energy_units, rapl_time_units); |
8024 | 8017 |
|
8025 | 8018 | if (valid_rapl_msrs & RAPL_PKG_POWER_INFO) { |
8026 | 8019 |
|
@@ -8052,8 +8045,7 @@ int print_rapl(PER_THREAD_PARAMS) |
8052 | 8045 | return -9; |
8053 | 8046 |
|
8054 | 8047 | fprintf(outf, "cpu%d: MSR_VR_CURRENT_CONFIG: 0x%08llx\n", cpu, msr); |
8055 | | - fprintf(outf, "cpu%d: PKG Limit #4: %f Watts (%slocked)\n", |
8056 | | - cpu, ((msr >> 0) & 0x1FFF) * rapl_power_units, (msr >> 31) & 1 ? "" : "UN"); |
| 8048 | + fprintf(outf, "cpu%d: PKG Limit #4: %f Watts (%slocked)\n", cpu, ((msr >> 0) & 0x1FFF) * rapl_power_units, (msr >> 31) & 1 ? "" : "UN"); |
8057 | 8049 | } |
8058 | 8050 |
|
8059 | 8051 | if (valid_rapl_msrs & RAPL_DRAM_POWER_INFO) { |
@@ -8390,8 +8382,7 @@ void decode_misc_feature_control(void) |
8390 | 8382 | if (!get_msr(master_cpu, MSR_MISC_FEATURE_CONTROL, &msr)) |
8391 | 8383 | fprintf(outf, |
8392 | 8384 | "cpu%d: MSR_MISC_FEATURE_CONTROL: 0x%08llx (%sL2-Prefetch %sL2-Prefetch-pair %sL1-Prefetch %sL1-IP-Prefetch)\n", |
8393 | | - master_cpu, msr, msr & (0 << 0) ? "No-" : "", msr & (1 << 0) ? "No-" : "", |
8394 | | - msr & (2 << 0) ? "No-" : "", msr & (3 << 0) ? "No-" : ""); |
| 8385 | + master_cpu, msr, msr & (0 << 0) ? "No-" : "", msr & (1 << 0) ? "No-" : "", msr & (2 << 0) ? "No-" : "", msr & (3 << 0) ? "No-" : ""); |
8395 | 8386 | } |
8396 | 8387 |
|
8397 | 8388 | /* |
@@ -8433,12 +8424,10 @@ void decode_c6_demotion_policy_msr(void) |
8433 | 8424 | return; |
8434 | 8425 |
|
8435 | 8426 | if (!get_msr(master_cpu, MSR_CC6_DEMOTION_POLICY_CONFIG, &msr)) |
8436 | | - fprintf(outf, "cpu%d: MSR_CC6_DEMOTION_POLICY_CONFIG: 0x%08llx (%sable-CC6-Demotion)\n", |
8437 | | - master_cpu, msr, msr & (1 << 0) ? "EN" : "DIS"); |
| 8427 | + fprintf(outf, "cpu%d: MSR_CC6_DEMOTION_POLICY_CONFIG: 0x%08llx (%sable-CC6-Demotion)\n", master_cpu, msr, msr & (1 << 0) ? "EN" : "DIS"); |
8438 | 8428 |
|
8439 | 8429 | if (!get_msr(master_cpu, MSR_MC6_DEMOTION_POLICY_CONFIG, &msr)) |
8440 | | - fprintf(outf, "cpu%d: MSR_MC6_DEMOTION_POLICY_CONFIG: 0x%08llx (%sable-MC6-Demotion)\n", |
8441 | | - master_cpu, msr, msr & (1 << 0) ? "EN" : "DIS"); |
| 8430 | + fprintf(outf, "cpu%d: MSR_MC6_DEMOTION_POLICY_CONFIG: 0x%08llx (%sable-MC6-Demotion)\n", master_cpu, msr, msr & (1 << 0) ? "EN" : "DIS"); |
8442 | 8431 | } |
8443 | 8432 |
|
8444 | 8433 | void print_dev_latency(void) |
@@ -8756,8 +8745,7 @@ void rapl_perf_init(void) |
8756 | 8745 | /* Assumes msr_counter_info is populated */ |
8757 | 8746 | static int has_amperf_access(void) |
8758 | 8747 | { |
8759 | | - return cpuid_has_aperf_mperf && msr_counter_arch_infos[MSR_ARCH_INFO_APERF_INDEX].present && |
8760 | | - msr_counter_arch_infos[MSR_ARCH_INFO_MPERF_INDEX].present; |
| 8748 | + return cpuid_has_aperf_mperf && msr_counter_arch_infos[MSR_ARCH_INFO_APERF_INDEX].present && msr_counter_arch_infos[MSR_ARCH_INFO_MPERF_INDEX].present; |
8761 | 8749 | } |
8762 | 8750 |
|
8763 | 8751 | int *get_cstate_perf_group_fd(struct cstate_counter_info_t *cci, const char *group_name) |
@@ -8968,8 +8956,7 @@ void cstate_perf_init_(bool soft_c1) |
8968 | 8956 | if (!per_core && pkg_visited[pkg_id]) |
8969 | 8957 | continue; |
8970 | 8958 |
|
8971 | | - const bool counter_needed = BIC_IS_ENABLED(cai->bic_number) || |
8972 | | - (soft_c1 && (cai->flags & CSTATE_COUNTER_FLAG_SOFT_C1_DEPENDENCY)); |
| 8959 | + const bool counter_needed = BIC_IS_ENABLED(cai->bic_number) || (soft_c1 && (cai->flags & CSTATE_COUNTER_FLAG_SOFT_C1_DEPENDENCY)); |
8973 | 8960 | const bool counter_supported = (platform->supported_cstates & cai->feature_mask); |
8974 | 8961 |
|
8975 | 8962 | if (counter_needed && counter_supported) { |
@@ -9259,8 +9246,7 @@ void process_cpuid() |
9259 | 9246 | if (crystal_hz) { |
9260 | 9247 | tsc_hz = (unsigned long long)crystal_hz *ebx_tsc / eax_crystal; |
9261 | 9248 | if (!quiet) |
9262 | | - fprintf(outf, "TSC: %lld MHz (%d Hz * %d / %d / 1000000)\n", |
9263 | | - tsc_hz / 1000000, crystal_hz, ebx_tsc, eax_crystal); |
| 9249 | + fprintf(outf, "TSC: %lld MHz (%d Hz * %d / %d / 1000000)\n", tsc_hz / 1000000, crystal_hz, ebx_tsc, eax_crystal); |
9264 | 9250 | } |
9265 | 9251 | } |
9266 | 9252 | } |
@@ -9645,7 +9631,7 @@ void topology_probe(bool startup) |
9645 | 9631 | if (cpus[i].ht_id == 0) |
9646 | 9632 | topo.num_cores++; |
9647 | 9633 | } |
9648 | | - topo.max_core_id = max_core_id; /* within a package */ |
| 9634 | + topo.max_core_id = max_core_id; /* within a package */ |
9649 | 9635 | topo.max_package_id = max_package_id; |
9650 | 9636 | topo.num_cores = (max_core_id + 1) * topo.num_packages; /* per system */ |
9651 | 9637 |
|
@@ -9712,6 +9698,7 @@ void allocate_counters_1(struct counters *counters) |
9712 | 9698 | error: |
9713 | 9699 | err(1, "calloc counters_1"); |
9714 | 9700 | } |
| 9701 | + |
9715 | 9702 | void allocate_counters(struct counters *counters) |
9716 | 9703 | { |
9717 | 9704 | int i; |
@@ -10368,8 +10355,7 @@ void pmt_init(void) |
10368 | 10355 |
|
10369 | 10356 | if (BIC_IS_ENABLED(BIC_Diec6)) { |
10370 | 10357 | pmt_add_counter(PMT_MTL_DC6_GUID, PMT_MTL_DC6_SEQ, "Die%c6", PMT_TYPE_XTAL_TIME, |
10371 | | - PMT_COUNTER_MTL_DC6_LSB, PMT_COUNTER_MTL_DC6_MSB, PMT_COUNTER_MTL_DC6_OFFSET, |
10372 | | - SCOPE_PACKAGE, FORMAT_DELTA, 0, PMT_OPEN_TRY); |
| 10358 | + PMT_COUNTER_MTL_DC6_LSB, PMT_COUNTER_MTL_DC6_MSB, PMT_COUNTER_MTL_DC6_OFFSET, SCOPE_PACKAGE, FORMAT_DELTA, 0, PMT_OPEN_TRY); |
10373 | 10359 | } |
10374 | 10360 |
|
10375 | 10361 | if (BIC_IS_ENABLED(BIC_CPU_c1e)) { |
@@ -10547,7 +10533,7 @@ int get_and_dump_counters(void) |
10547 | 10533 |
|
10548 | 10534 | void print_version() |
10549 | 10535 | { |
10550 | | - fprintf(outf, "turbostat version 2026.02.04 - Len Brown <lenb@kernel.org>\n"); |
| 10536 | + fprintf(outf, "turbostat version 2026.02.14 - Len Brown <lenb@kernel.org>\n"); |
10551 | 10537 | } |
10552 | 10538 |
|
10553 | 10539 | #define COMMAND_LINE_SIZE 2048 |
@@ -11169,8 +11155,7 @@ void parse_add_command_pmt(char *add_command) |
11169 | 11155 | } |
11170 | 11156 |
|
11171 | 11157 | if (direct_path && has_guid) { |
11172 | | - printf("%s: path and guid+seq parameters are mutually exclusive\n" |
11173 | | - "notice: passed guid=0x%x and path=%s\n", __func__, guid, direct_path); |
| 11158 | + printf("%s: path and guid+seq parameters are mutually exclusive\nnotice: passed guid=0x%x and path=%s\n", __func__, guid, direct_path); |
11174 | 11159 | exit(1); |
11175 | 11160 | } |
11176 | 11161 |
|
|
0 commit comments