tools/power turbostat: stop migrating, unless '-m'
Turbostat has the capability to set its own affinity to each CPU so that its MSR accesses are on the local CPU. However, using the in-kernel cross-call in the msr driver tends to be less invasive, so do that -- by-default. '-m' remains to get the old behaviour. Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
parent
f4fdf2b474
commit
c91fc8519d
|
@ -92,6 +92,7 @@ unsigned int do_ring_perf_limit_reasons;
|
||||||
unsigned int crystal_hz;
|
unsigned int crystal_hz;
|
||||||
unsigned long long tsc_hz;
|
unsigned long long tsc_hz;
|
||||||
int base_cpu;
|
int base_cpu;
|
||||||
|
int do_migrate;
|
||||||
double discover_bclk(unsigned int family, unsigned int model);
|
double discover_bclk(unsigned int family, unsigned int model);
|
||||||
unsigned int has_hwp; /* IA32_PM_ENABLE, IA32_HWP_CAPABILITIES */
|
unsigned int has_hwp; /* IA32_PM_ENABLE, IA32_HWP_CAPABILITIES */
|
||||||
/* IA32_HWP_REQUEST, IA32_HWP_STATUS */
|
/* IA32_HWP_REQUEST, IA32_HWP_STATUS */
|
||||||
|
@ -302,6 +303,9 @@ int for_all_cpus(int (func)(struct thread_data *, struct core_data *, struct pkg
|
||||||
|
|
||||||
int cpu_migrate(int cpu)
|
int cpu_migrate(int cpu)
|
||||||
{
|
{
|
||||||
|
if (!do_migrate)
|
||||||
|
return 0;
|
||||||
|
|
||||||
CPU_ZERO_S(cpu_affinity_setsize, cpu_affinity_set);
|
CPU_ZERO_S(cpu_affinity_setsize, cpu_affinity_set);
|
||||||
CPU_SET_S(cpu, cpu_affinity_setsize, cpu_affinity_set);
|
CPU_SET_S(cpu, cpu_affinity_setsize, cpu_affinity_set);
|
||||||
if (sched_setaffinity(0, cpu_affinity_setsize, cpu_affinity_set) == -1)
|
if (sched_setaffinity(0, cpu_affinity_setsize, cpu_affinity_set) == -1)
|
||||||
|
@ -5000,6 +5004,7 @@ void cmdline(int argc, char **argv)
|
||||||
{"hide", required_argument, 0, 'H'}, // meh, -h taken by --help
|
{"hide", required_argument, 0, 'H'}, // meh, -h taken by --help
|
||||||
{"Joules", no_argument, 0, 'J'},
|
{"Joules", no_argument, 0, 'J'},
|
||||||
{"list", no_argument, 0, 'l'},
|
{"list", no_argument, 0, 'l'},
|
||||||
|
{"migrate", no_argument, 0, 'm'},
|
||||||
{"out", required_argument, 0, 'o'},
|
{"out", required_argument, 0, 'o'},
|
||||||
{"quiet", no_argument, 0, 'q'},
|
{"quiet", no_argument, 0, 'q'},
|
||||||
{"show", required_argument, 0, 's'},
|
{"show", required_argument, 0, 's'},
|
||||||
|
@ -5011,7 +5016,7 @@ void cmdline(int argc, char **argv)
|
||||||
|
|
||||||
progname = argv[0];
|
progname = argv[0];
|
||||||
|
|
||||||
while ((opt = getopt_long_only(argc, argv, "+C:c:Ddhi:JM:m:o:qST:v",
|
while ((opt = getopt_long_only(argc, argv, "+C:c:Ddhi:Jmo:qST:v",
|
||||||
long_options, &option_index)) != -1) {
|
long_options, &option_index)) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'a':
|
case 'a':
|
||||||
|
@ -5054,6 +5059,9 @@ void cmdline(int argc, char **argv)
|
||||||
list_header_only++;
|
list_header_only++;
|
||||||
quiet++;
|
quiet++;
|
||||||
break;
|
break;
|
||||||
|
case 'm':
|
||||||
|
do_migrate = 1;
|
||||||
|
break;
|
||||||
case 'o':
|
case 'o':
|
||||||
outf = fopen_or_die(optarg, "w");
|
outf = fopen_or_die(optarg, "w");
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue