Skip to content

Commit 4420756

Browse files
zhang-ruilenb
authored andcommitted
tools/power turbostat: Fix bogus SysWatt for forked program
Similar to delta_cpu(), delta_platform() is called in turbostat main loop. This ensures accurate SysWatt readings in periodic monitoring mode $ sudo turbostat -S -q --show power -i 1 CoreTmp PkgTmp PkgWatt CorWatt GFXWatt RAMWatt PKG_% RAM_% SysWatt 60 61 6.21 1.13 0.16 0.00 0.00 0.00 13.07 58 61 6.00 1.07 0.18 0.00 0.00 0.00 12.75 58 61 5.74 1.05 0.17 0.00 0.00 0.00 12.22 58 60 6.27 1.11 0.24 0.00 0.00 0.00 13.55 However, delta_platform() is missing for forked program and causes bogus SysWatt reporting, $ sudo turbostat -S -q --show power sleep 1 1.004736 sec CoreTmp PkgTmp PkgWatt CorWatt GFXWatt RAMWatt PKG_% RAM_% SysWatt 57 58 6.05 1.02 0.16 0.00 0.00 0.00 0.03 Add missing delta_platform() for forked program. Fixes: e5f687b ("tools/power turbostat: Add RAPL psys as a built-in counter") Signed-off-by: Zhang Rui <[email protected]> Signed-off-by: Len Brown <[email protected]>
1 parent d34fe50 commit 4420756

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tools/power/x86/turbostat/turbostat.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9827,6 +9827,7 @@ int fork_it(char **argv)
98279827
timersub(&tv_odd, &tv_even, &tv_delta);
98289828
if (for_all_cpus_2(delta_cpu, ODD_COUNTERS, EVEN_COUNTERS))
98299829
fprintf(outf, "%s: Counter reset detected\n", progname);
9830+
delta_platform(&platform_counters_odd, &platform_counters_even);
98309831

98319832
compute_average(EVEN_COUNTERS);
98329833
format_all_counters(EVEN_COUNTERS);

0 commit comments

Comments
 (0)