Skip to content

Commit 8382dce

Browse files
huangruishuahkh
authored andcommitted
cpupower: Add "perf" option to print AMD P-State information
Add "-c --perf" option in cpupower-frequency-info to get the performance and frequency values for AMD P-State. Commit message amended: Shuah Khan <skhan@linuxfoundation.org> Reviewed-by: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: Huang Rui <ray.huang@amd.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
1 parent d8363e2 commit 8382dce

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

tools/power/cpupower/man/cpupower-frequency-info.1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ human\-readable output for the \-f, \-w, \-s and \-y parameters.
5353
\fB\-n\fR \fB\-\-no-rounding\fR
5454
Output frequencies and latencies without rounding off values.
5555
.TP
56+
\fB\-c\fR \fB\-\-perf\fR
57+
Get performances and frequencies capabilities of CPPC, by reading it from hardware (only available on the hardware with CPPC).
58+
.TP
5659
.SH "REMARKS"
5760
.LP
5861
By default only values of core zero are displayed. How to display settings of

tools/power/cpupower/utils/cpufreq-info.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,17 @@ static int get_latency(unsigned int cpu, unsigned int human)
438438
return 0;
439439
}
440440

441+
/* --performance / -c */
442+
443+
static int get_perf_cap(unsigned int cpu)
444+
{
445+
if (cpupower_cpu_info.vendor == X86_VENDOR_AMD &&
446+
cpupower_cpu_info.caps & CPUPOWER_CAP_AMD_PSTATE)
447+
amd_pstate_show_perf_and_freq(cpu, no_rounding);
448+
449+
return 0;
450+
}
451+
441452
static void debug_output_one(unsigned int cpu)
442453
{
443454
struct cpufreq_available_frequencies *freqs;
@@ -466,6 +477,7 @@ static void debug_output_one(unsigned int cpu)
466477
if (get_freq_hardware(cpu, 1) < 0)
467478
get_freq_kernel(cpu, 1);
468479
get_boost_mode(cpu);
480+
get_perf_cap(cpu);
469481
}
470482

471483
static struct option info_opts[] = {
@@ -484,6 +496,7 @@ static struct option info_opts[] = {
484496
{"proc", no_argument, NULL, 'o'},
485497
{"human", no_argument, NULL, 'm'},
486498
{"no-rounding", no_argument, NULL, 'n'},
499+
{"performance", no_argument, NULL, 'c'},
487500
{ },
488501
};
489502

@@ -497,7 +510,7 @@ int cmd_freq_info(int argc, char **argv)
497510
int output_param = 0;
498511

499512
do {
500-
ret = getopt_long(argc, argv, "oefwldpgrasmybn", info_opts,
513+
ret = getopt_long(argc, argv, "oefwldpgrasmybnc", info_opts,
501514
NULL);
502515
switch (ret) {
503516
case '?':
@@ -520,6 +533,7 @@ int cmd_freq_info(int argc, char **argv)
520533
case 'e':
521534
case 's':
522535
case 'y':
536+
case 'c':
523537
if (output_param) {
524538
output_param = -1;
525539
cont = 0;
@@ -626,6 +640,9 @@ int cmd_freq_info(int argc, char **argv)
626640
case 'y':
627641
ret = get_latency(cpu, human);
628642
break;
643+
case 'c':
644+
ret = get_perf_cap(cpu);
645+
break;
629646
}
630647
if (ret)
631648
return ret;

0 commit comments

Comments
 (0)