From 39ef545d1ddad210f632c2243ba0ec679fc2788e Mon Sep 17 00:00:00 2001 From: Arne Tarara Date: Sat, 11 Oct 2025 15:33:24 +0200 Subject: [PATCH 1/3] (fix): Max of cumulative phases RUNTIME must be of max_value, not of normal value --- lib/phase_stats.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/phase_stats.py b/lib/phase_stats.py index 7fc0106bf..d836f9e88 100644 --- a/lib/phase_stats.py +++ b/lib/phase_stats.py @@ -24,8 +24,8 @@ def reconstruct_runtime_phase(run_id, runtime_phase_idx): %s, SUM(value), type, - MAX(value), - MIN(value), + MAX(max_value), + MIN(min_value), AVG(sampling_rate_avg), -- approx, but good enough for overview. MAX(sampling_rate_max), AVG(sampling_rate_95p), -- approx, but good enough for overview From bec43f72f9cb594c750259d444a973944e2d18ea Mon Sep 17 00:00:00 2001 From: Arne Tarara Date: Sat, 11 Oct 2025 15:34:32 +0200 Subject: [PATCH 2/3] (fix): Wrong order of magnitude for surplus energy runtime fixed as power is alrady in mW --- lib/phase_stats.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/phase_stats.py b/lib/phase_stats.py index d836f9e88..ce290aaf5 100644 --- a/lib/phase_stats.py +++ b/lib/phase_stats.py @@ -304,7 +304,7 @@ def build_and_store_phase_stats(run_id, sci=None): if machine_power_current_phase and machine_power_baseline and cpu_utilization_machine and cpu_utilization_containers: surplus_power_runtime = machine_power_current_phase - machine_power_baseline - surplus_energy_runtime = machine_energy_current_phase - (machine_power_baseline * (Decimal(duration) / 1_000_000)) # we do not subtract phase energy here but calculate, becuase phases have different length + surplus_energy_runtime = machine_energy_current_phase - (machine_power_baseline * duration * Decimal(1e3)) # we cannot directly subtract baseline energy, but need to stretch it to not subtract phase energy here but calculate, bc phases have different length total_container_utilization = Decimal(sum(cpu_utilization_containers.values())) From 7a8a2e1b42753d936fc1455058ea17ccc36b10c1 Mon Sep 17 00:00:00 2001 From: Arne Tarara Date: Sat, 11 Oct 2025 15:35:06 +0200 Subject: [PATCH 3/3] (fix): Slice values are of power are MEAN and not TOTALS which led to wrong summation in reconstruction of RUNTIME phase --- lib/phase_stats.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/phase_stats.py b/lib/phase_stats.py index ce290aaf5..8ca85b645 100644 --- a/lib/phase_stats.py +++ b/lib/phase_stats.py @@ -315,9 +315,9 @@ def build_and_store_phase_stats(run_id, sci=None): splitting_ratio = container_utilization / total_container_utilization csv_buffer.write(generate_csv_line(phase['hidden'], run_id, 'psu_energy_cgroup_slice', detail_name, f"{idx:03}_{phase['name']}", machine_energy_current_phase * splitting_ratio, 'TOTAL', None, None, None, None, None, 'uJ')) - csv_buffer.write(generate_csv_line(phase['hidden'], run_id, 'psu_power_cgroup_slice', detail_name, f"{idx:03}_{phase['name']}", machine_power_current_phase * splitting_ratio, 'TOTAL', None, None, None, None, None, 'mW')) + csv_buffer.write(generate_csv_line(phase['hidden'], run_id, 'psu_power_cgroup_slice', detail_name, f"{idx:03}_{phase['name']}", machine_power_current_phase * splitting_ratio, 'MEAN', None, None, None, None, None, 'mW')) csv_buffer.write(generate_csv_line(phase['hidden'], run_id, 'psu_energy_cgroup_container', detail_name, f"{idx:03}_{phase['name']}", surplus_energy_runtime * splitting_ratio, 'TOTAL', None, None, None, None, None, 'uJ')) - csv_buffer.write(generate_csv_line(phase['hidden'], run_id, 'psu_power_cgroup_container', detail_name, f"{idx:03}_{phase['name']}", surplus_power_runtime * splitting_ratio, 'TOTAL', None, None, None, None, None, 'mW')) + csv_buffer.write(generate_csv_line(phase['hidden'], run_id, 'psu_power_cgroup_container', detail_name, f"{idx:03}_{phase['name']}", surplus_power_runtime * splitting_ratio, 'MEAN', None, None, None, None, None, 'mW')) # TODO: refactor to be a metric provider. Than it can also be per phase # pylint: disable=fixme if software_carbon_intensity_global.get('machine_carbon_ug', None) is not None \