Skip to content

Commit 87a1198

Browse files
authored
Update print_output.py
Fixed minor bug (divide by zero)
1 parent 5e26de7 commit 87a1198

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

print_output.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,11 @@ def print_timing(num_of_pcaps, statistics, logger):
104104
# Print total execution time
105105
total_time = divmod(time.time() - statistics['start_time'], 60)
106106
average_pcap_time = round((time.time() - statistics['start_time']) / num_of_pcaps, 2)
107-
average_chain_time = round((time.time() - statistics['start_time']) / statistics['total_chains'], 2)
108107
logger.info("Total execution time: " + str(int(total_time[0])) + " minutes and " + str(round(total_time[1], 2)) + " seconds!")
109108
logger.info("Average PCAP processing time: " + str(average_pcap_time) + " seconds!")
110-
logger.info("Average chain processing time: " + str(average_chain_time) + " seconds!\n")
109+
if statistics['total_chains'] > 0:
110+
average_chain_time = round((time.time() - statistics['start_time']) / statistics['total_chains'], 2)
111+
logger.info("Average chain processing time: " + str(average_chain_time) + " seconds!\n")
111112

112113

113114
def print_tree(tree, logger):
@@ -117,4 +118,4 @@ def print_tree(tree, logger):
117118
redirs_to_print = '/'.join(node.redirs)
118119
logger.info("%s%s (%s) [%s]" % (pre, node.name, redirs_to_print, node.seconds))
119120
else:
120-
logger.info("%s%s" % (pre, node.name))
121+
logger.info("%s%s" % (pre, node.name))

0 commit comments

Comments
 (0)