5
5
from collections import Counter
6
6
from pathlib import Path
7
7
from threading import Lock
8
- from time import sleep , time
8
+ from time import monotonic , sleep
9
9
from typing import Optional
10
10
11
11
from chia_rs import G1Element
@@ -172,9 +172,9 @@ def process_plot(plot_path: Path, plot_info: PlotInfo, num_start: int, num_end:
172
172
challenge = std_hash (i .to_bytes (32 , "big" ))
173
173
# Some plot errors cause get_qualities_for_challenge to throw a RuntimeError
174
174
try :
175
- quality_start_time = round (time () * 1000 )
175
+ quality_start_time = round (monotonic () * 1000 )
176
176
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
178
178
if quality_spent_time > 8000 :
179
179
log .warning (
180
180
f"\t Looking 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:
185
185
186
186
# Other plot errors cause get_full_proof or validate_proof to throw an AssertionError
187
187
try :
188
- proof_start_time = round (time () * 1000 )
188
+ proof_start_time = round (monotonic () * 1000 )
189
189
# TODO : todo_v2_plots handle v2 plots
190
190
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
192
192
if proof_spent_time > 15000 :
193
193
log .warning (
194
194
f"\t Finding 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:
210
210
f"{ type (e )} : { e } error in proving/verifying for plot { plot_path } . Filepath: { plot_path } "
211
211
)
212
212
caught_exception = True
213
- quality_start_time = round (time () * 1000 )
213
+ quality_start_time = round (monotonic () * 1000 )
214
214
except KeyboardInterrupt :
215
215
log .warning ("Interrupted, closing" )
216
216
return
0 commit comments