]> git.baikalelectronics.ru Git - kernel.git/commit
tools/power turbostat: show error on exec
authorLen Brown <len.brown@intel.com>
Thu, 23 Feb 2017 22:00:51 +0000 (17:00 -0500)
committerLen Brown <len.brown@intel.com>
Wed, 1 Mar 2017 05:14:25 +0000 (00:14 -0500)
commitaaaa0ec08d8312dcfc11ddfdd5dcf78d37ff48f5
treef1c99274f2f7b74d7c50d53c17d31e5b8a54ba07
parentc8af20dd550663f2ecaf7bd2304b35595a1df6cc
tools/power turbostat: show error on exec

When turbostat is run in one-shot command mode,
the parent takes the 'before' counter snapshot,
fork/exec/wait for the child to exit,
takes the 'after' counter snapshot,
and prints the results.

however, if the child fails to exec the command,
it immediately returns, without indicating that
anythign was wrong.

Add an error message showing that exec failed:

sudo turbostat sleeeep 4
...
turbostat: exec sleeeep: No such file or directory
...

Note that the parent will still print out the statistics,
because it can't tell the difference between the failed
exec and a command that is purposefully returning
the same status.  Unfortunately, this may obscure the
error message.  However, if the --out parameter is used,
the error message is evident on stderr.

Reported-by: Wendy Wang <wendy.wang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
tools/power/x86/turbostat/turbostat.c