Commit 5499b5a
committed
tools/power turbostat: Harden one-shot mode against cpu offline
when turbostat interval mode can't migrate to a CPU, it complains,
prints no data, re-initializes with the new CPU configuration
and starts a new interval.
But this strategy in the face of a CPU hotplug offline during an interval
doesn't help in one-shot mode. When the missing CPU is discovered
at the end of the interval, the forked program has already returned
and there is nothing left for a new interval to measure.
So instead of aborting get_coutners() and delta_cpu() if a missing CPU
is detected, complain, but carry on and output what statistics are
actually present.
Use the same strategy for delta_cpu when aperf:mperf are observed
to have been reset -- complain, but carry on and print data for
the CPUs that are still present.
Interval mode error handling is unchanged.
One-shot mode can now do this:
$ sudo chcpu -e 1 ; sudo ./turbostat --quiet --show PkgWatt,Busy%,CPU chcpu -d 1
CPU 1 enabled
CPU 1 disabled
get_counters: Could not migrate to CPU 1
./turbostat: Counter reset detected
0.036920 sec
CPU Busy% PkgWatt
- 0.00 10.00
0 99.73 10.00
1 0.00
2 91.53
3 16.83
Suggested-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>1 parent b32c369 commit 5499b5a
1 file changed
+12
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2063 | 2063 | | |
2064 | 2064 | | |
2065 | 2065 | | |
| 2066 | + | |
| 2067 | + | |
2066 | 2068 | | |
2067 | 2069 | | |
2068 | 2070 | | |
| |||
2078 | 2080 | | |
2079 | 2081 | | |
2080 | 2082 | | |
2081 | | - | |
2082 | | - | |
2083 | | - | |
| 2083 | + | |
2084 | 2084 | | |
2085 | 2085 | | |
2086 | 2086 | | |
2087 | 2087 | | |
2088 | | - | |
| 2088 | + | |
2089 | 2089 | | |
2090 | 2090 | | |
2091 | 2091 | | |
| |||
3620 | 3620 | | |
3621 | 3621 | | |
3622 | 3622 | | |
3623 | | - | |
3624 | | - | |
3625 | 3623 | | |
3626 | 3624 | | |
3627 | 3625 | | |
3628 | | - | |
| 3626 | + | |
3629 | 3627 | | |
3630 | 3628 | | |
3631 | 3629 | | |
| |||
5748 | 5746 | | |
5749 | 5747 | | |
5750 | 5748 | | |
| 5749 | + | |
| 5750 | + | |
5751 | 5751 | | |
5752 | 5752 | | |
5753 | 5753 | | |
| |||
5769 | 5769 | | |
5770 | 5770 | | |
5771 | 5771 | | |
5772 | | - | |
5773 | | - | |
5774 | | - | |
| 5772 | + | |
5775 | 5773 | | |
5776 | 5774 | | |
5777 | 5775 | | |
5778 | 5776 | | |
5779 | | - | |
| 5777 | + | |
5780 | 5778 | | |
5781 | 5779 | | |
5782 | 5780 | | |
| |||
9462 | 9460 | | |
9463 | 9461 | | |
9464 | 9462 | | |
9465 | | - | |
9466 | | - | |
9467 | | - | |
9468 | | - | |
| 9463 | + | |
| 9464 | + | |
| 9465 | + | |
9469 | 9466 | | |
9470 | 9467 | | |
9471 | 9468 | | |
| |||
0 commit comments