Skip to content

Commit e41861c

Browse files
committed
check for division by zero
1 parent 827c189 commit e41861c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

bin/wfbench

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,11 @@ def cpu_mem_benchmark(cpu_queue: multiprocessing.Queue,
181181
:rtype: List
182182
"""
183183
total_mem = f"{total_mem}B" if total_mem else f"{100.0 / os.cpu_count()}%"
184-
cpu_work_per_thread = int(1000000 * cpu_work / (16384 * cpu_threads))
184+
cpu_work_per_thread = int(1000000 * cpu_work / (16384 * cpu_threads)) if cpu_threads != 0 else int32_max**2
185185
cpu_samples = min(cpu_work_per_thread, int32_max)
186186
cpu_ops = (cpu_work_per_thread + int32_max - 1) // int32_max
187187
if cpu_ops > int32_max:
188-
log_info("Exceeded maximum number of cpu work.")
188+
log_info("Exceeded maximum allowed value of cpu work.")
189189
cpu_ops = int32_max
190190

191191
cpu_proc = None

0 commit comments

Comments
 (0)