]> git.baikalelectronics.ru Git - kernel.git/commit
tools/power turbostat: read from pipes too
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Wed, 14 Aug 2019 17:12:55 +0000 (20:12 +0300)
committerLen Brown <len.brown@intel.com>
Sat, 31 Aug 2019 18:48:39 +0000 (14:48 -0400)
commit2f6f92ab96a2ea9f5fa53ee404491861f5100959
tree85a9ea7e70e945eee70439af4c9834fb874ae0be
parentd872712b0b00b8b3eedcc290c4f74c382527434c
tools/power turbostat: read from pipes too

Commit 'f87fc7a99897 tools/power turbostat: fix printing on input' make
a valid fix, but it completely disabled piped stdin support, which is
a valuable use-case. Indeed, if stdin is a pipe, turbostat won't read
anything from it, so it becomes impossible to get turbostat output at
user-defined moments, instead of the regular intervals.

There is no reason why this should works for terminals, but not for
pipes. This patch improves the situation. Instead of ignoring pipes, we
read data from them but gracefully handle the EOF case.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
tools/power/x86/turbostat/turbostat.c