Skip to content

Commit 6ee9fc6

Browse files
dedekindlenb
authored andcommitted
tools/power turbostat: do not enforce 1ms
Turbostat works by taking a snapshot of counters, sleeping, taking another snapshot, calculating deltas, and printing out the table. The sleep time is controlled via -i option or by user sending a signal or a character to stdin. In the latter case, turbostat always adds 1 ms sleep before it reads the counters, in order to avoid larger imprecisions in the results in prints. While the 1 ms delay may be a good idea for a "dumb" user, it is a problem for an "aware" user. I do thousands and thousands of measurements over a short period of time (like 2ms), and turbostat unconditionally adds a 1ms to my interval, so I cannot get what I really need. This patch removes the unconditional 1ms sleep. This is an expert user tool, after all, and non-experts will unlikely ever use it in the non-fixed interval mode anyway, so I think it is OK to remove the 1ms delay. Signed-off-by: Artem Bityutskiy <[email protected]> Signed-off-by: Len Brown <[email protected]>
1 parent c026c23 commit 6ee9fc6

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

tools/power/x86/turbostat/turbostat.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ FILE *outf;
3939
int *fd_percpu;
4040
struct timeval interval_tv = {5, 0};
4141
struct timespec interval_ts = {5, 0};
42-
struct timespec one_msec = {0, 1000000};
4342
unsigned int num_iterations;
4443
unsigned int debug;
4544
unsigned int quiet;
@@ -2994,8 +2993,6 @@ static void signal_handler (int signal)
29942993
fprintf(stderr, "SIGUSR1\n");
29952994
break;
29962995
}
2997-
/* make sure this manually-invoked interval is at least 1ms long */
2998-
nanosleep(&one_msec, NULL);
29992996
}
30002997

30012998
void setup_signal_handler(void)
@@ -3046,8 +3043,6 @@ void do_sleep(void)
30463043
rest.tv_nsec = (tout.tv_usec % 1000000) * 1000;
30473044
nanosleep(&rest, NULL);
30483045
}
3049-
/* make sure this manually-invoked interval is at least 1ms long */
3050-
nanosleep(&one_msec, NULL);
30513046
}
30523047
}
30533048

0 commit comments

Comments
 (0)