From 781021d6cae04f4521df3e8ec1ed43dfd6a76c2c Mon Sep 17 00:00:00 2001 From: katianderic Date: Thu, 12 Mar 2020 23:38:58 +0100 Subject: [PATCH] trivial changes to aid debugging --- xwords4/common/comtypes.h | 2 +- xwords4/linux/scripts/discon_ok2.py | 12 +++++++----- xwords4/linux/xptypes.h | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/xwords4/common/comtypes.h b/xwords4/common/comtypes.h index 2a8a1e8f8..8fe6857aa 100644 --- a/xwords4/common/comtypes.h +++ b/xwords4/common/comtypes.h @@ -310,7 +310,7 @@ typedef struct _PlayerDicts { #endif #define LOG_FUNC() XP_LOGFF( "%s", "IN" ) -#define LOG_RETURNF(fmt, ...) XP_LOGF( "%s => " fmt, __func__, __VA_ARGS__ ) +#define LOG_RETURNF(fmt, ...) XP_LOGFF( "OUT: => " fmt, __VA_ARGS__ ) #define LOG_RETURN_VOID() LOG_RETURNF("%s","void") #define XP_LOGLOC() XP_LOGF( "%s(), line %d", __func__, __LINE__ ) #define LOG_POS(strm) XP_LOGF( "%s(); line %d; read_pos: %X", __func__, __LINE__, \ diff --git a/xwords4/linux/scripts/discon_ok2.py b/xwords4/linux/scripts/discon_ok2.py index 114789637..3e7448845 100755 --- a/xwords4/linux/scripts/discon_ok2.py +++ b/xwords4/linux/scripts/discon_ok2.py @@ -516,7 +516,7 @@ def build_cmds(args): COUNTER += 1 return devs -def summarizeTileCounts(devs, endTime, state): +def summarizeTileCounts(devs, endTime, state, changeSecs): global gDeadLaunches shouldGoOn = True data = [dev.getTilesCount() for dev in devs] @@ -591,7 +591,7 @@ def summarizeTileCounts(devs, endTime, state): state['lastChange'] = now state['tilesStr'] = tilesStr - return now - state['lastChange'] < datetime.timedelta(seconds = 30) + return now - state['lastChange'] < datetime.timedelta(seconds = changeSecs) def countCores(args): count = 0 @@ -619,7 +619,7 @@ def run_cmds(args, devs): # print stats every 5 seconds if now - lastPrint > datetime.timedelta(seconds = 5): lastPrint = now - if not summarizeTileCounts(devs, endTime, printState): + if not summarizeTileCounts(devs, endTime, printState, args.NO_CHANGE_SECS): print('no change in too long; exiting') break @@ -711,6 +711,8 @@ def mkParser(): help = 'number of roooms (default to --num-games)') parser.add_argument('--timeout-mins', dest = 'TIMEOUT_MINS', default = 10000, type = int, help = 'minutes after which to timeout') + parser.add_argument('--nochange-secs', dest = 'NO_CHANGE_SECS', default = 30, type = int, + help = 'seconds without change after which to timeout') parser.add_argument('--log-root', dest='LOGROOT', default = '.', help = 'where logfiles go') parser.add_argument('--dup-packets', dest = 'DUP_PACKETS', default = False, help = 'send all packet twice') parser.add_argument('--use-gtk', dest = 'USE_GTK', default = False, action = 'store_true', @@ -755,8 +757,8 @@ def mkParser(): parser.add_argument('--http-pct', dest = 'HTTP_PCT', default = 0, type = int, help = 'pct of games to be using web api') - parser.add_argument('--undo-pct', dest = 'UNDO_PCT', default = 0, type = int) - parser.add_argument('--trade-pct', dest = 'TRADE_PCT', default = 0, type = int) + parser.add_argument('--undo-pct', dest = 'UNDO_PCT', default = 5, type = int) + parser.add_argument('--trade-pct', dest = 'TRADE_PCT', default = 10, type = int) parser.add_argument('--add-sms', dest = 'ADD_SMS', default = False, action = 'store_true') parser.add_argument('--sms-fail-pct', dest = 'SMS_FAIL_PCT', default = 0, type = int) diff --git a/xwords4/linux/xptypes.h b/xwords4/linux/xptypes.h index b6dcc1fc0..89a50d191 100644 --- a/xwords4/linux/xptypes.h +++ b/xwords4/linux/xptypes.h @@ -125,7 +125,7 @@ void linux_lowerstr( XP_UCHAR* str ); #define XP_ABS(a) ((a)>=0?(a):-(a)) #ifdef DEBUG -# define XP_ASSERT(b) assert(b) +# define XP_ASSERT(B) do { if (!(B)) { XP_LOGFF( "%s", "firing assert"); } assert(B); } while (0) void linux_backtrace( void ); # define XP_BACKTRACE linux_backtrace #else