mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 04:31:50 +00:00
tools/power/x86/intel-speed-select: Improve output of perf-profile commands
Improve output of perf-profile commands: get-config-enabled get-lock-status Instead of showing 0/1, show meaningful strings. Also show error when command is failed. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
This commit is contained in:
parent
68e2f10971
commit
3d1a857981
@ -953,6 +953,7 @@ static void isst_print_platform_information(void)
|
||||
exit(0);
|
||||
}
|
||||
|
||||
static char *local_str0, *local_str1;
|
||||
static void exec_on_get_ctdp_cpu(int cpu, void *arg1, void *arg2, void *arg3,
|
||||
void *arg4)
|
||||
{
|
||||
@ -962,13 +963,14 @@ static void exec_on_get_ctdp_cpu(int cpu, void *arg1, void *arg2, void *arg3,
|
||||
fn_ptr = arg1;
|
||||
ret = fn_ptr(cpu, arg2);
|
||||
if (ret)
|
||||
perror("get_tdp_*");
|
||||
isst_display_error_info_message(1, "get_tdp_* failed", 0, 0);
|
||||
else
|
||||
isst_ctdp_display_core_info(cpu, outf, arg3,
|
||||
*(unsigned int *)arg4);
|
||||
*(unsigned int *)arg4,
|
||||
local_str0, local_str1);
|
||||
}
|
||||
|
||||
#define _get_tdp_level(desc, suffix, object, help) \
|
||||
#define _get_tdp_level(desc, suffix, object, help, str0, str1) \
|
||||
static void get_tdp_##object(int arg) \
|
||||
{ \
|
||||
struct isst_pkg_ctdp ctdp; \
|
||||
@ -979,6 +981,8 @@ static void exec_on_get_ctdp_cpu(int cpu, void *arg1, void *arg2, void *arg3,
|
||||
help); \
|
||||
exit(0); \
|
||||
} \
|
||||
local_str0 = str0; \
|
||||
local_str1 = str1; \
|
||||
isst_ctdp_display_information_start(outf); \
|
||||
if (max_target_cpus) \
|
||||
for_each_online_target_cpu_in_set( \
|
||||
@ -992,12 +996,12 @@ static void exec_on_get_ctdp_cpu(int cpu, void *arg1, void *arg2, void *arg3,
|
||||
isst_ctdp_display_information_end(outf); \
|
||||
}
|
||||
|
||||
_get_tdp_level("get-config-levels", levels, levels, "TDP levels");
|
||||
_get_tdp_level("get-config-version", levels, version, "TDP version");
|
||||
_get_tdp_level("get-config-enabled", levels, enabled, "TDP enable status");
|
||||
_get_tdp_level("get-config-levels", levels, levels, "Max TDP level", NULL, NULL);
|
||||
_get_tdp_level("get-config-version", levels, version, "TDP version", NULL, NULL);
|
||||
_get_tdp_level("get-config-enabled", levels, enabled, "perf-profile enable status", "disabled", "enabled");
|
||||
_get_tdp_level("get-config-current_level", levels, current_level,
|
||||
"Current TDP Level");
|
||||
_get_tdp_level("get-lock-status", levels, locked, "TDP lock status");
|
||||
"Current TDP Level", NULL, NULL);
|
||||
_get_tdp_level("get-lock-status", levels, locked, "TDP lock status", "unlocked", "locked");
|
||||
|
||||
struct isst_pkg_ctdp clx_n_pkg_dev;
|
||||
|
||||
|
@ -289,7 +289,7 @@ static void _isst_fact_display_information(int cpu, FILE *outf, int level,
|
||||
}
|
||||
|
||||
void isst_ctdp_display_core_info(int cpu, FILE *outf, char *prefix,
|
||||
unsigned int val)
|
||||
unsigned int val, char *str0, char *str1)
|
||||
{
|
||||
char header[256];
|
||||
char value[256];
|
||||
@ -301,8 +301,12 @@ void isst_ctdp_display_core_info(int cpu, FILE *outf, char *prefix,
|
||||
format_and_print(outf, 2, header, NULL);
|
||||
snprintf(header, sizeof(header), "cpu-%d", cpu);
|
||||
format_and_print(outf, 3, header, NULL);
|
||||
|
||||
snprintf(value, sizeof(value), "%u", val);
|
||||
if (str0 && !val)
|
||||
snprintf(value, sizeof(value), "%s", str0);
|
||||
else if (str1 && val)
|
||||
snprintf(value, sizeof(value), "%s", str1);
|
||||
else
|
||||
snprintf(value, sizeof(value), "%u", val);
|
||||
format_and_print(outf, 4, prefix, value);
|
||||
|
||||
format_and_print(outf, 1, NULL, NULL);
|
||||
|
@ -208,7 +208,7 @@ extern void isst_get_process_ctdp_complete(int cpu,
|
||||
extern void isst_ctdp_display_information(int cpu, FILE *outf, int tdp_level,
|
||||
struct isst_pkg_ctdp *pkg_dev);
|
||||
extern void isst_ctdp_display_core_info(int cpu, FILE *outf, char *prefix,
|
||||
unsigned int val);
|
||||
unsigned int val, char *str0, char *str1);
|
||||
extern void isst_ctdp_display_information_start(FILE *outf);
|
||||
extern void isst_ctdp_display_information_end(FILE *outf);
|
||||
extern void isst_pbf_display_information(int cpu, FILE *outf, int level,
|
||||
|
Loading…
Reference in New Issue
Block a user