Skip to content

Commit 1efabc2

Browse files
author
Judd
committed
add timing
1 parent d5e56c5 commit 1efabc2

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/alphageometry.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import pretty as pt
2929
import problem as pr
3030
import argparse
31+
import time
3132

3233
DEFINITIONS = None # contains definitions of construction actions
3334
RULES = None # contains rules of deductions
@@ -567,7 +568,7 @@ def parse_args():
567568
parser.add_argument(
568569
'--problems_file',
569570
type=str,
570-
default='examples\imo_ag_30.txt',
571+
default='examples/imo_ag_30.txt',
571572
help='text file contains the problem strings. See imo_ag_30.txt for example.')
572573

573574
parser.add_argument(
@@ -682,6 +683,7 @@ def main(FLAGS):
682683
)
683684
FLAGS = parse_args()
684685

686+
start_time = time.perf_counter()
685687
if FLAGS.problem_name != '':
686688
main(FLAGS)
687689
else:
@@ -690,4 +692,10 @@ def main(FLAGS):
690692
if name.startswith('#'): continue
691693
FLAGS.problem_name = name
692694
FLAGS.out_file = f"{out_file}/{name}.txt" if out_file != '' else ''
693-
main(FLAGS)
695+
try:
696+
main(FLAGS)
697+
except Exception as e:
698+
print(f"exception occurred on {name}:\n{e}")
699+
700+
elapsed_time = time.perf_counter() - start_time
701+
logging.info(f"Total time = {elapsed_time:.4f} seconds")

0 commit comments

Comments
 (0)