From c7e0e3a9c3e23bb8d00e662851aff68cbaa48323 Mon Sep 17 00:00:00 2001 From: Tejas Kale Date: Tue, 18 Jan 2022 14:38:36 +0100 Subject: [PATCH] Print total power in monitor mode. --- throttled.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/throttled.py b/throttled.py index 02a637c..05fc619 100755 --- a/throttled.py +++ b/throttled.py @@ -898,6 +898,7 @@ def monitor(exit_event, wait): # ugly code, just testing... vcore = readmsr('IA32_PERF_STATUS', from_bit=32, to_bit=47, cpu=0) / (2.0 ** 13) * 1000 stats2 = {'VCore': '{:.0f} mV'.format(vcore)} + total = 0.0 for power_plane in ('Package', 'Graphics', 'DRAM'): energy_j = readmsr(power_plane_msr[power_plane], cpu=0) * rapl_power_unit now = time() @@ -906,6 +907,10 @@ def monitor(exit_event, wait): (energy_j - prev_energy[power_plane][0]) / (now - prev_energy[power_plane][1]), ) stats2[power_plane] = '{:.1f} W'.format(energy_w) + total += energy_w + + stats2['Total'] = '{:.1f} W'.format(total) + output2 = ('{:s}: {:s}'.format(label, stats2[label]) for label in stats2) terminator = '\n' if args.log else '\r' log(