mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-18 22:26:30 +01:00
print based on time rather than number of iterations
This commit is contained in:
parent
ffaa47f893
commit
b7981cc8da
1 changed files with 7 additions and 5 deletions
|
@ -698,7 +698,7 @@ def summarizeTileCounts(devs, endTime, state):
|
||||||
if nTilesPool is None and nTilesTray is None:
|
if nTilesPool is None and nTilesTray is None:
|
||||||
txt = ('-' * colWidth)
|
txt = ('-' * colWidth)
|
||||||
elif int(nTilesPool) == 0 and not nTilesTray is None:
|
elif int(nTilesPool) == 0 and not nTilesTray is None:
|
||||||
txt = '+{:{width}d}'.format(nTilesTray, width=colWidth-1)
|
txt = '{:+{width}d}'.format(nTilesTray, width=colWidth-1)
|
||||||
else:
|
else:
|
||||||
txt = '{:{width}d}'.format(nTilesPool, width=colWidth)
|
txt = '{:{width}d}'.format(nTilesPool, width=colWidth)
|
||||||
totalTiles += int(nTilesPool)
|
totalTiles += int(nTilesPool)
|
||||||
|
@ -732,19 +732,21 @@ gDone = False
|
||||||
def run_cmds(args, devs):
|
def run_cmds(args, devs):
|
||||||
nCores = countCores()
|
nCores = countCores()
|
||||||
endTime = datetime.datetime.now() + datetime.timedelta(minutes = args.TIMEOUT_MINS)
|
endTime = datetime.datetime.now() + datetime.timedelta(minutes = args.TIMEOUT_MINS)
|
||||||
LOOPCOUNT = 0
|
|
||||||
printState = {}
|
printState = {}
|
||||||
|
lastPrint = datetime.datetime.now()
|
||||||
|
|
||||||
while len(devs) > 0 and not gDone:
|
while len(devs) > 0 and not gDone:
|
||||||
if countCores() > nCores:
|
if countCores() > nCores:
|
||||||
print('core file count increased; exiting')
|
print('core file count increased; exiting')
|
||||||
break
|
break
|
||||||
if datetime.datetime.now() > endTime:
|
now = datetime.datetime.now()
|
||||||
|
if now > endTime:
|
||||||
print('outta time; outta here')
|
print('outta time; outta here')
|
||||||
break
|
break
|
||||||
|
|
||||||
LOOPCOUNT += 1
|
# print stats every 5 seconds
|
||||||
if 0 == LOOPCOUNT % 20:
|
if now - lastPrint > datetime.timedelta(seconds = 5):
|
||||||
|
lastPrint = now
|
||||||
if not summarizeTileCounts(devs, endTime, printState):
|
if not summarizeTileCounts(devs, endTime, printState):
|
||||||
print('no change in too long; exiting')
|
print('no change in too long; exiting')
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in a new issue