Skip to content

Commit 2f7099a

Browse files
authored
Merge pull request #1069 from darshan-hpc/carns/div-zero-issue-1068
avoid div by zero in cli tools when there is no I/O
2 parents 0fc3911 + d9b6b02 commit 2f7099a

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

darshan-util/pydarshan/darshan/cli/file_stats.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,10 @@ def rich_print(df, mod, order_by):
212212
# calculate totals to plug in to table footer
213213
all_time_by_slowest = df["time_by_slowest"].sum()
214214
all_total_bytes = df["total_bytes"].sum()
215-
all_perf_by_slowest = all_total_bytes / all_time_by_slowest
215+
if all_total_bytes == 0:
216+
all_perf_by_slowest = 0
217+
else:
218+
all_perf_by_slowest = all_total_bytes / all_time_by_slowest
216219
all_bytes_read = df["bytes_read"].sum()
217220
all_bytes_written = df["bytes_written"].sum()
218221
all_reads = df["reads"].sum()

darshan-util/pydarshan/darshan/cli/job_stats.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,10 @@ def rich_print(df, mod, order_by):
130130
all_time_by_slowest = df['time_by_slowest'].sum()
131131
all_total_bytes = df['total_bytes'].sum()
132132
all_total_files = df['total_files'].sum()
133-
all_perf_by_slowest = all_total_bytes / all_time_by_slowest
133+
if all_total_bytes == 0:
134+
all_perf_by_slowest = 0
135+
else:
136+
all_perf_by_slowest = all_total_bytes / all_time_by_slowest
134137

135138
# instantiate a rich table and pretty print the dataframe
136139
console = Console()

0 commit comments

Comments
 (0)