From ef39fc921b592d89ef3ebda54064d367986b329b Mon Sep 17 00:00:00 2001 From: Ben van Werkhoven Date: Tue, 19 Nov 2024 14:45:45 +0100 Subject: [PATCH] update observer to latest python bindings --- kernel_tuner/observers/powersensor.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/kernel_tuner/observers/powersensor.py b/kernel_tuner/observers/powersensor.py index 6d07e8977..b1b01a838 100644 --- a/kernel_tuner/observers/powersensor.py +++ b/kernel_tuner/observers/powersensor.py @@ -12,7 +12,7 @@ class PowerSensorObserver(BenchmarkObserver): """Observer that an external PowerSensor2 device to accurately measure power - Requires PowerSensor2 hardware and powersensor Python bindings. + Requires PowerSensor3 hardware and powersensor Python bindings. :param observables: A list of string, containing any of "ps_energy" or "ps_power". To measure energy in Joules or power consumption in Watt. @@ -51,9 +51,8 @@ def after_finish(self): ) # Joules self.results["ps_energy"].append(ps_measured_e) if "ps_power" in self.observables: - ps_measured_t = ( - end_state.time_at_read - self.begin_state.time_at_read - ) # seconds + ps_measured_t = ((end_state.time_at_read - self.begin_state.time_at_read).microseconds / 1e6) # Seconds + self.results["ps_power"].append(ps_measured_e / ps_measured_t) # Watt def get_results(self):