Only include energy measurement for cpus used by run set
@@ -29,6 +29,7 @@ import threading
import time
from queue import Queue
+import benchexec.resources
from benchexec.model import CORELIMIT, MEMLIMIT, TIMELIMIT, SOFTTIMELIMIT
from benchexec import cgroups
from benchexec import containerexecutor
@@ -176,6 +177,10 @@ def execute_benchmark(benchmark, output_handler):
usedCpuTime = (ruAfter.ru_utime + ruAfter.ru_stime) \
- (ruBefore.ru_utime + ruBefore.ru_stime)
+ # Only include energy measurement for cpus used in runs
+ _, packages = benchexec.resources.get_cpus(my_cgroups)
+ energy = {cpu: energy[cpu] for cpu in packages.keys()}
+
if STOPPED_BY_INTERRUPT:
output_handler.set_error('interrupted', runSet)
output_handler.output_after_run_set(runSet, cputime=usedCpuTime, walltime=usedWallTime, energy=energy)
