better profiling

This commit is contained in:
Thomas Lindner 2022-12-30 16:55:19 +01:00
parent 075001a2d5
commit 384079ad73

View file

@ -1,20 +1,24 @@
from blunderboard.blunderevaluator import BlunderEvaluator from blunderboard.blunderevaluator import BlunderEvaluator
from blunderboard.boardreader import BoardReader from blunderboard.boardreader import BoardReader
from blunderboard.movegenerator import MoveGenerator from blunderboard.movegenerator import MoveGenerator
from time import sleep
import cProfile import cProfile
from pstats import SortKey
from time import sleep
def main_content(): def main_content():
blunder_evaluator = BlunderEvaluator() try:
move_generator = MoveGenerator(blunder_evaluator) blunder_evaluator = BlunderEvaluator()
reader = BoardReader(move_generator) move_generator = MoveGenerator(blunder_evaluator)
reader.scan() reader = BoardReader(move_generator)
reader.print()
while True:
reader.scan() reader.scan()
sleep(0.1) reader.print()
while True:
reader.scan()
sleep(0.1)
except KeyboardInterrupt:
pass
def main(): def main():
cProfile.runctx("main_content()", globals(), locals(), filename=__file__) cProfile.runctx("main_content()", globals(), locals(), sort=SortKey.CUMULATIVE)