summaryrefslogtreecommitdiffstats
path: root/tools/power
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2017-07-15 21:51:26 +0200
committerLen Brown <len.brown@intel.com>2018-06-01 18:13:04 +0200
commit072119606a239557bf8532c70af9c211d1028dff (patch)
treed970ce934120a23f0848de3a5e4c2fd24ec5c133 /tools/power
parenttools/power turbostat: on SIGINT: sample, print and exit (diff)
downloadlinux-072119606a239557bf8532c70af9c211d1028dff.tar.xz
linux-072119606a239557bf8532c70af9c211d1028dff.zip
tools/power turbostat: on SIGUSR1: sample, print and continue
Interval-mode turbostat now catches and discards SIGUSR1. Thus, SIGUSR1 can be used to tell turbostat to cut short the current measurement interval. Turbostat will then start the next measurement interval using the regular interval length. This can be used to give turbostat variable intervals. Invoke turbostat with --interval LARGE_NUMBER_SEC and have a program that has permission to send it a SIGUSR1 always before LARGE_NUMBER_SEC expires. It may also be useful to use "--enable Time_Of_Day_Seconds" to observe the actual interval length. Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'tools/power')
-rw-r--r--tools/power/x86/turbostat/turbostat.84
-rw-r--r--tools/power/x86/turbostat/turbostat.c6
2 files changed, 10 insertions, 0 deletions
diff --git a/tools/power/x86/turbostat/turbostat.8 b/tools/power/x86/turbostat/turbostat.8
index 2dafba4900ab..f99bddf16b8b 100644
--- a/tools/power/x86/turbostat/turbostat.8
+++ b/tools/power/x86/turbostat/turbostat.8
@@ -271,6 +271,10 @@ CPU PRF_CTRL
SIGINT will interrupt interval-mode.
The end-of-interval data will be collected and displayed before turbostat exits.
+
+SIGUSR1 will end current interval,
+end-of-interval data will be collected and displayed before turbostat
+starts a new interval.
.SH NOTES
.B "turbostat "
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index d9703b728fbb..dd9b2efbbb2a 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -2610,6 +2610,10 @@ static void signal_handler (int signal)
if (debug)
fprintf(stderr, " SIGINT\n");
break;
+ case SIGUSR1:
+ if (debug > 1)
+ fprintf(stderr, "SIGUSR1\n");
+ break;
}
}
@@ -2623,6 +2627,8 @@ void setup_signal_handler(void)
if (sigaction(SIGINT, &sa, NULL) < 0)
err(1, "sigaction SIGINT");
+ if (sigaction(SIGUSR1, &sa, NULL) < 0)
+ err(1, "sigaction SIGUSR1");
}
void turbostat_loop()
{