Refactoring: extract function
@@ -153,6 +153,34 @@ def execute_benchmark(benchmark, output_handler):
else:
run_sets_executed += 1
+ _execute_run_set(
+ runSet,
+ benchmark,
+ output_handler,
+ coreAssignment,
+ memoryAssignment,
+ cpu_packages,
+ )
+
+ if throttle_check.has_throttled():
+ logging.warning(
+ "CPU throttled itself during benchmarking due to overheating. "
+ "Benchmark results are unreliable!"
+ )
+ if swap_check.has_swapped():
+ logging.warning(
+ "System has swapped during benchmarking. "
+ "Benchmark results are unreliable!"
+ )
+ pqos.reset_resources()
+ output_handler.output_after_benchmark(STOPPED_BY_INTERRUPT)
+
+ return 0
+
+
+def _execute_run_set(
+ runSet, benchmark, output_handler, coreAssignment, memoryAssignment, cpu_packages
+):
# get times before runSet
energy_measurement = EnergyMeasurement.create_if_supported()
ruBefore = resource.getrusage(resource.RUSAGE_CHILDREN)
@@ -218,21 +246,6 @@ def execute_benchmark(benchmark, output_handler):
runSet, cputime=usedCpuTime, walltime=usedWallTime, energy=energy
)
- if throttle_check.has_throttled():
- logging.warning(
- "CPU throttled itself during benchmarking due to overheating. "
- "Benchmark results are unreliable!"
- )
- if swap_check.has_swapped():
- logging.warning(
- "System has swapped during benchmarking. "
- "Benchmark results are unreliable!"
- )
- pqos.reset_resources()
- output_handler.output_after_benchmark(STOPPED_BY_INTERRUPT)
-
- return 0
-
def stop():
global STOPPED_BY_INTERRUPT
