diff --git a/tools/power/x86/turbostat/turbostat.8 b/tools/power/x86/turbostat/turbostat.8 index 830c9f094765..c905198d0501 100644 --- a/tools/power/x86/turbostat/turbostat.8 +++ b/tools/power/x86/turbostat/turbostat.8 @@ -92,7 +92,7 @@ name as necessary to disambiguate it from others is necessary. Note that option '%x' hex identifier of the PMT MMIO region. .fi .PP -\fB--cpu cpu-set\fP limit output to system summary plus the specified cpu-set. If cpu-set is the string "core", then the system summary plus the first CPU in each core are printed -- eg. subsequent HT siblings are not printed. Or if cpu-set is the string "package", then the system summary plus the first CPU in each package is printed. Otherwise, the system summary plus the specified set of CPUs are printed. The cpu-set is ordered from low to high, comma delimited with ".." and "-" permitted to denote a range. eg. 1,2,8,14..17,21-44 +\fB--cpu cpu-set\fP limit output to system summary plus the specified cpu-set. If cpu-set is the string "core", then the system summary plus the first CPU in each core are printed -- eg. subsequent HT siblings are not printed. Or if cpu-set is the string "package", then the system summary plus the first CPU in each package is printed. Otherwise, the system summary plus the specified set of CPUs are printed. The cpu-set is ordered from low to high, comma delimited with ".." and "-" permitted to denote a range. eg. 1,2,8,14..17,21-44 Multiple invocations of --cpu are OR'd together. .PP \fB--hide column\fP do not show the specified built-in columns. May be invoked multiple times, or with a comma-separated list of column names. .PP diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index d7e68363e4dc..58a8a61bac7b 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -11552,16 +11552,18 @@ void parse_cpu_command(char *optarg) if (show_core_only || show_pkg_only) goto error; - cpu_subset = CPU_ALLOC(topo.max_cpu_num + 1); - if (cpu_subset == NULL) - err(3, "CPU_ALLOC"); + if (!cpu_subset) { + cpu_subset = CPU_ALLOC(topo.max_cpu_num + 1); + if (cpu_subset == NULL) + err(3, "CPU_ALLOC"); - CPU_ZERO_S(cpu_setsize, cpu_subset); + CPU_ZERO_S(cpu_setsize, cpu_subset); + } if (parse_cpu_str(optarg, cpu_subset, cpu_setsize)) goto error; if (debug) - print_cpu_set("cpu subsetset", cpu_subset); + print_cpu_set("--cpu", cpu_subset); return;