Skip to content

Commit 863d2bc

Browse files
committed
use monotonic clock to time check_plots operations
1 parent e6c5e88 commit 863d2bc

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

chia/plotting/check_plots.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from collections import Counter
66
from pathlib import Path
77
from threading import Lock
8-
from time import sleep, time
8+
from time import monotonic, sleep
99
from typing import Optional
1010

1111
from chia_rs import G1Element
@@ -172,9 +172,9 @@ def process_plot(plot_path: Path, plot_info: PlotInfo, num_start: int, num_end:
172172
challenge = std_hash(i.to_bytes(32, "big"))
173173
# Some plot errors cause get_qualities_for_challenge to throw a RuntimeError
174174
try:
175-
quality_start_time = round(time() * 1000)
175+
quality_start_time = round(monotonic() * 1000)
176176
for index, quality_str in enumerate(pr.get_qualities_for_challenge(challenge)):
177-
quality_spent_time = round(time() * 1000) - quality_start_time
177+
quality_spent_time = round(monotonic() * 1000) - quality_start_time
178178
if quality_spent_time > 8000:
179179
log.warning(
180180
f"\tLooking up qualities took: {quality_spent_time} ms. This should be below 8 seconds "
@@ -185,10 +185,10 @@ def process_plot(plot_path: Path, plot_info: PlotInfo, num_start: int, num_end:
185185

186186
# Other plot errors cause get_full_proof or validate_proof to throw an AssertionError
187187
try:
188-
proof_start_time = round(time() * 1000)
188+
proof_start_time = round(monotonic() * 1000)
189189
# TODO : todo_v2_plots handle v2 plots
190190
proof = pr.get_full_proof(challenge, index, parallel_read)
191-
proof_spent_time = round(time() * 1000) - proof_start_time
191+
proof_spent_time = round(monotonic() * 1000) - proof_start_time
192192
if proof_spent_time > 15000:
193193
log.warning(
194194
f"\tFinding proof took: {proof_spent_time} ms. This should be below 15 seconds "
@@ -210,7 +210,7 @@ def process_plot(plot_path: Path, plot_info: PlotInfo, num_start: int, num_end:
210210
f"{type(e)}: {e} error in proving/verifying for plot {plot_path}. Filepath: {plot_path}"
211211
)
212212
caught_exception = True
213-
quality_start_time = round(time() * 1000)
213+
quality_start_time = round(monotonic() * 1000)
214214
except KeyboardInterrupt:
215215
log.warning("Interrupted, closing")
216216
return

0 commit comments

Comments
 (0)