diff options
author | Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> | 2024-04-26 14:39:44 -0700 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2024-04-29 13:31:50 +0200 |
commit | 8ebc39ace34e9b9944e29110598f8343f2d8c159 (patch) | |
tree | 4c87a799f18a93579e46fea5f115df3a1fde460f /tools | |
parent | 1fcf670e50645f23f026d1dca82e59200115f925 (diff) | |
download | linux-stable-8ebc39ace34e9b9944e29110598f8343f2d8c159.tar.gz linux-stable-8ebc39ace34e9b9944e29110598f8343f2d8c159.tar.bz2 linux-stable-8ebc39ace34e9b9944e29110598f8343f2d8c159.zip |
tools/power/x86/intel-speed-select: Display CPU as None for -1
When there is no CPU in a power domain, display "None" instead of -1.
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/power/x86/intel-speed-select/isst-display.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/tools/power/x86/intel-speed-select/isst-display.c b/tools/power/x86/intel-speed-select/isst-display.c index e30f6355e417..07ebd08f3202 100644 --- a/tools/power/x86/intel-speed-select/isst-display.c +++ b/tools/power/x86/intel-speed-select/isst-display.c @@ -172,12 +172,19 @@ static int print_package_info(struct isst_id *id, FILE *outf) int level = 1; if (out_format_is_json()) { - if (api_version() > 1) - snprintf(header, sizeof(header), "package-%d:die-%d:powerdomain-%d:cpu-%d", - id->pkg, id->die, id->punit, id->cpu); - else + if (api_version() > 1) { + if (id->cpu < 0) + snprintf(header, sizeof(header), + "package-%d:die-%d:powerdomain-%d:cpu-None", + id->pkg, id->die, id->punit); + else + snprintf(header, sizeof(header), + "package-%d:die-%d:powerdomain-%d:cpu-%d", + id->pkg, id->die, id->punit, id->cpu); + } else { snprintf(header, sizeof(header), "package-%d:die-%d:cpu-%d", id->pkg, id->die, id->cpu); + } format_and_print(outf, level, header, NULL); return 1; } @@ -189,7 +196,12 @@ static int print_package_info(struct isst_id *id, FILE *outf) snprintf(header, sizeof(header), "powerdomain-%d", id->punit); format_and_print(outf, level++, header, NULL); } - snprintf(header, sizeof(header), "cpu-%d", id->cpu); + + if (id->cpu < 0) + snprintf(header, sizeof(header), "cpu-None"); + else + snprintf(header, sizeof(header), "cpu-%d", id->cpu); + format_and_print(outf, level, header, NULL); return level; |