tools/power/x86/intel-speed-select: Format get-assoc information
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Sat, 14 Sep 2019 19:45:45 +0000 (12:45 -0700)
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 19 Sep 2019 11:51:29 +0000 (14:51 +0300)
Format the get-assoc command output consistant with other commands.
For example:

Intel(R) Speed Select Technology
Executing on CPU model:142[0x8e]
 package-0
  die-0
    cpu-0
      get-assoc
        clos:0

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
tools/power/x86/intel-speed-select/isst-config.c
tools/power/x86/intel-speed-select/isst-display.c
tools/power/x86/intel-speed-select/isst.h

index e505aaf2beef19a1d84b85e6d7893d1233f0ad34..c2892d86be366ecc47d59686dd73ec4523264de2 100644 (file)
@@ -1249,7 +1249,7 @@ static void get_clos_assoc_for_cpu(int cpu, void *arg1, void *arg2, void *arg3,
        if (ret)
                perror("isst_clos_get_assoc_status");
        else
-               isst_display_result(cpu, outf, "core-power", "get-assoc", clos);
+               isst_clos_display_assoc_information(cpu, outf, clos);
 }
 
 static void get_clos_assoc(void)
@@ -1259,13 +1259,17 @@ static void get_clos_assoc(void)
                fprintf(stderr, "\tSpecify targeted cpu id with [--cpu|-c]\n");
                exit(0);
        }
-       if (max_target_cpus)
-               for_each_online_target_cpu_in_set(get_clos_assoc_for_cpu, NULL,
-                                                 NULL, NULL, NULL);
-       else {
+
+       if (!max_target_cpus) {
                fprintf(stderr,
                        "Invalid target cpu. Specify with [-c|--cpu]\n");
+               exit(0);
        }
+
+       isst_ctdp_display_information_start(outf);
+       for_each_online_target_cpu_in_set(get_clos_assoc_for_cpu, NULL,
+                                         NULL, NULL, NULL);
+       isst_ctdp_display_information_end(outf);
 }
 
 static struct process_cmd_struct isst_cmds[] = {
index df4aa99c4e92c62fe4bf8af6735676a0883db78f..bd7aaf27e4dedce6c75024fac51cf7927ebe2ee5 100644 (file)
@@ -503,6 +503,29 @@ void isst_clos_display_information(int cpu, FILE *outf, int clos,
        format_and_print(outf, 1, NULL, NULL);
 }
 
+void isst_clos_display_assoc_information(int cpu, FILE *outf, int clos)
+{
+       char header[256];
+       char value[256];
+
+       snprintf(header, sizeof(header), "package-%d",
+                get_physical_package_id(cpu));
+       format_and_print(outf, 1, header, NULL);
+       snprintf(header, sizeof(header), "die-%d", get_physical_die_id(cpu));
+       format_and_print(outf, 2, header, NULL);
+       snprintf(header, sizeof(header), "cpu-%d", cpu);
+       format_and_print(outf, 3, header, NULL);
+
+       snprintf(header, sizeof(header), "get-assoc");
+       format_and_print(outf, 4, header, NULL);
+
+       snprintf(header, sizeof(header), "clos");
+       snprintf(value, sizeof(value), "%d", clos);
+       format_and_print(outf, 5, header, value);
+
+       format_and_print(outf, 1, NULL, NULL);
+}
+
 void isst_display_result(int cpu, FILE *outf, char *feature, char *cmd,
                         int result)
 {
index 668f914d077fe86081fa546a5db44ecaef0cd748..48655d0dee2d063714791ec845ef04b536ce8e3b 100644 (file)
@@ -225,7 +225,7 @@ extern int isst_clos_associate(int cpu, int clos);
 extern int isst_clos_get_assoc_status(int cpu, int *clos_id);
 extern void isst_clos_display_information(int cpu, FILE *outf, int clos,
                                          struct isst_clos_config *clos_config);
-
+extern void isst_clos_display_assoc_information(int cpu, FILE *outf, int clos);
 extern int isst_read_reg(unsigned short reg, unsigned int *val);
 extern int isst_write_reg(int reg, unsigned int val);