aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/power/x86/turbostat/turbostat.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index 3c063a00f3bf..77e76b11382f 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -656,8 +656,10 @@ int get_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p)
656{ 656{
657 int cpu = t->cpu_id; 657 int cpu = t->cpu_id;
658 658
659 if (cpu_migrate(cpu)) 659 if (cpu_migrate(cpu)) {
660 fprintf(stderr, "Could not migrate to CPU %d\n", cpu);
660 return -1; 661 return -1;
662 }
661 663
662 t->tsc = rdtsc(); /* we are running on local CPU of interest */ 664 t->tsc = rdtsc(); /* we are running on local CPU of interest */
663 665
@@ -1088,15 +1090,22 @@ int mark_cpu_present(int cpu)
1088void turbostat_loop() 1090void turbostat_loop()
1089{ 1091{
1090 int retval; 1092 int retval;
1093 int restarted = 0;
1091 1094
1092restart: 1095restart:
1096 restarted++;
1097
1093 retval = for_all_cpus(get_counters, EVEN_COUNTERS); 1098 retval = for_all_cpus(get_counters, EVEN_COUNTERS);
1094 if (retval < -1) { 1099 if (retval < -1) {
1095 exit(retval); 1100 exit(retval);
1096 } else if (retval == -1) { 1101 } else if (retval == -1) {
1102 if (restarted > 1) {
1103 exit(retval);
1104 }
1097 re_initialize(); 1105 re_initialize();
1098 goto restart; 1106 goto restart;
1099 } 1107 }
1108 restarted = 0;
1100 gettimeofday(&tv_even, (struct timezone *)NULL); 1109 gettimeofday(&tv_even, (struct timezone *)NULL);
1101 1110
1102 while (1) { 1111 while (1) {